Highlighted

How do I use the Tealium Custom Container to load Adobe Analytics custom tracking functions (with data being passed into the function)?

I am using the Tealium Custom Container tag to add functions that I would like to call, specifically as onClick actions throughout my websites. These functions look like this: function pageModules( obj, detail ) { var s=s_gi ("the report suite here"); pageTitle = "the page title here"; pageUrl= "the page URL"; someOtherVariable= "other variable mapping"; var ostring = pageTitle+" | "+detail.action+" : "+detail.position; s.linkTrackVars="eVar35,events"; s.linkTrackEvents="event25"; s.eVar35=ostring; s.events="event25"; s.tl(true, 'o', ostring); } Basically, these are custom link tracking functions that I will then call through an onClick action. I have gotten this to work by writing in the report suite ID and leaving the variables with sample text. But what I can not do is figure out: - How do I pass variables that I have mapped in my Data Layer (these are all configured as JavaScript Variables)? Do I have to add them to the tag? How do I map them and how do I actually call them in my function above? - In what part of the Tealium Custom Container should I place my function, and any additional code that I may be missing? I have this entire function currently in the /* Start Tag Library Code */ area. Thank you! -André Moraes
1 REPLY 1
Highlighted

How do I use the Tealium Custom Container to load Adobe Analytics custom tracking functions (with data being passed into the function)?

Employee Emeritus

Andre, First I will answer your question. Second I will suggest a best practice way of doing this. I would suggest the following for this use case. Remove the Tealium Custom Container and paste the code into a JavaScript code extension. Scope this extension to the SiteCatalyst tag. You'll probably need to slightly change the syntax of the first line to be: window.pageModules = function( obj, detail ) {...} In answer to your first question, you will need to use the 'utag.data' object to reference data in your data layer. For example: If you want to pass a value from your data layer into eVar10 using the above function you would use: s.eVar10 = utag.data.some_var Hope that answers your questions. Now I would look at this post: https://community.tealiumiq.com/t5/Tealium-iQ/Event-Tracking-with-SiteCatalyst/ta-p/13643 Here you will be able to define your onClick events directly in Tealium and define the data points you want to pass. Tealium will take care of the heavy lifting for you and you don't need to use all the raw JavaScript Code.