Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion extensions/lib_books/set_mediaID_from_contentID
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//Runs only on Tealium link events for video interactions.
// Ensures contentID is present before extracting media_id.

(function (a, b) {

// Only run on link events where event_name === "video"
Expand All @@ -8,14 +9,23 @@
}

// Get contentID from data layer
var cid = utag.data.contentID;
var cid = b.contentID || utag.data.contentID;

// Validate contentID
if (!cid || typeof cid !== "string") return;

// Clean stray quotes/spaces
cid = cid.trim().replace(/^\"+|\"+$/g, "");

// Always set media_type for video events (keeps legacy behavior for non-live)
if (cid.indexOf("personalstream") > -1) {
b.media_type = "video : 24/7 live";
} else {
b.media_type = "video"; // keep existing value so reports don’t change
}
utag.data.media_type = b.media_type;


var mediaID;

// Extract media ID based on content-discovery pattern
Expand Down
Loading
Loading