Highlighted

Passing section value to live person custom tag

Rookie Contributor

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

1 REPLY 1
Highlighted

Passing section value to live person custom tag

Employee Emeritus

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