Conditional logic in an extension using utag_main cookie session number value _sn

Gold Contributor
Gold Contributor
I have an extension that loads a random opinionlab survey to 5 percent of our audience. I want to modify that extension to over sample new visitors to the site. I was hoping to use the utag_main session number. Something like this if (b['cp._sn'] == '1') { responseRate: 95, //Percentage of users who will receive the invitation repromptTime: 7776000, //90 days in seconds promptDelay: 5, //Time in seconds prompt will be delayed } else { responseRate: 5, //Percentage of users who will receive the invitation repromptTime: 7776000, //90 days in seconds promptDelay: 5, //Time in seconds prompt will be delayed } Do I need to setup the data source still if it is already in being set in the utag_main cookie? Also would _sn = 1 indicate the users first session?
1 REPLY 1

Conditional logic in an extension using utag_main cookie session number value _sn

Employee Emeritus
Joseph Here is a good article that defines all the tealium cookies. https://community.tealiumiq.com/posts/638067-tealium-cookies If you are wanting to access the cookie in a javascript extension, you will need to change your code to: if(utag.data["cp.utag_main__sn"]){ Depending on the scope of your extension, you can also use: if(b["cp.utag_main__sn"]){ If you are using a javascript extension, you do not need to add the Data Source to the TiQ Data Layer. However if you would like the Data Source to show up in the TiQ dropdown menus, then you need to add it to the Data Layer in TiQ. Please reach out to your account manager if you need more assistance than this. Thank you.
Public