- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
10-29-2015 10:34 AM
I have the following code in a custom tag:
var arrLPvars = [
{ scope:'page', name:'unit', value:'service-myaccount', mobile:true },
{ scope:'page', name:'section', value:'', mobile:true } //Pass an appropriate value to distinguish sections of the myaccount site.
];
I need to populate the highlighted with the page name for our Adobe Analytics.
I've set up the data source to take the value of page_name (js) and pass to pageVar.section but this isn't adding it to the array?
Can anyone provide any pointers?
Steve
10-30-2015 01:05 AM
Hi @steve_bowsher this code is implemented in a JavaScript Code extension, rather than in the template of a custom tag.
Within any JavaScript extension, you have access to the "b object" which is a reference to the data object (utag_data) for the event that has been passed.
So you can reference any data field like this:
{ scope:'page', name:'section', value:b.page_name, mobile:true }
Note that it's not in quotes, because you want the value of b.page_name (or whatever data layer value you choose) rather than the literal string "b.page_name".
I hope that helps. I can do this for you, or you can give a go and see how it works out.
Fiann
Copyright All Rights Reserved © 2008-2023