What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Gold Contributor
Gold Contributor
We are mapping a query string data source (cid) into an omniture campaign variable and want to prevent duplication of the campaign value passed. Omniture has a getvalueonce plugin, but we want avoid using omniture code in the tealium extensions.
7 REPLIES 7

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Employee Emeritus
Hi John, others may offer a better method but what I would do in this situation is: 1. Add the Persist Data Value Extension 2. Persist Variable CID 3. Duration: session 4. Update: Keep First Value Set 5: Condition: cid is defined 6: Store in Cookie: my_new_cookie Map my_new_cookie to the corresponding destination in Omniture

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Gold Contributor
Gold Contributor
Thanks Clint. It looks like this prevents the cid from being overwritten, but the value fires off on each following page view (as well as back button). What we're hoping to do is prevent it from firing off when someone refreshes or hits back. So we would only get one occurance of the value (when the page initially loads). If the user clicked another banner before the session ended, we are okay if it overwrites the initial value.

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Employee Emeritus

Ah, ok. It may end up that running the SC plugin via extensions is the best method (https://community.tealiumiq.com/t5/Tags/Adobe-Analytics-SiteCatalyst-Tag/ta-p/664) but it's possible that there are commonly used solutions for this that I'm not aware of. I'm going to invite one of our solutions engineers to take a stab at this one.

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Employee Emeritus
You could do it with a couple extensions: Follow Clint's steps 1-6 (don't do the mapping) and then: 1. Scope the the Persist Data Value extension to Sitecatalyst 2. Add a Set Data Value Extension, scope it to SiteCat, and put it before the PDV from step 1. 3. Set the value of a variable, e.g. 'mapped_cid', to the value you in the query string, not the cookie set in step 1 4. Set the conditions of the SDV extension to be 'if CID qsp is defined and populated AND if cookie from step 1 is NOT defined' 5. Map 'mapped_cid' to your SiteCat destination(s) This will give you the logic necessary to only set this value the first time around. After it sets the value, the PDV extension will set a cookie that will suppress it from doing it on any subsequent pageview that session.

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Employee Emeritus
Hey John, I would do what Clint suggested but add one more extension into the mix. Add another data source, which for this example I'm going to call "external_campaign" Add a Set Data Values Extension that is above the Persist Data Values extension in the list of extensions. Set up the Set Data Values Extension like so: Set: external_campaign To: variable -> cid (qp) Then the condition would be: If cid (qp) is defined AND my_new_cookie (cp) is undefined This will only allow the first cid value to be used in a given session. Then you would map external_campaign (js) to the eVar/prop you would like to populate. Make sure and remove the my_new_cookie mapping as described earlier. You would also leave the Duration setting in the Persist Data Values extension to "Session" Method 2 If you would like to update the cid value each time it changes this will need to be done in a JS Code extension. That code would look similar to: //Copy and paste this into a JavaScript Code Extension above the Persist Data values // Extension in the list of tags. if(typeof b['qp.cid']!="undefined" && (typeof b['cp.my_new_cookie']=="undefined" || b['cp.my_new_cookie']!=b['qp.cid'])){ b.external_campaign = b['qp.cid']; } This will act similar to the previous example; however, if the cid query param has been defined previously and it shows up later in the session, the my_new_cookie variable will store the first value and this will check to make sure there is a new value before overwriting the previous value. In this case you would also map external_campaign (js) to the eVar/prop you'd like to populate. Also, to use this you would need to change the Duration setting in the Persist Data Values extension to "Allow Update on Page View." Hope this helps. Cheers!

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Gold Contributor
Gold Contributor
Are you sure that you only want to count a unique campaign value once per visit? If your prospects are likely to go back and forward to your site several times in the same session, perhaps because they are comparing your offering with your competitors, then you may wish to count each genuine campaign click because your top paid search term may be clicked multiple times. Therefore, it would be simplest to use Marking Channels and Marketing Channel Processing Rules in the Adobe Analytics interface. The Paid Search Detection Rule should take care of PPC and for others, such as display or email, make sure when you set up your rules that you tick the box, â ignore hits matching internal URL filtersâ . In Tealium you can create an extension to do similar should you wish to mimic the Adobe campaign and Marketing Channel Processing Rules, for example to make use of the Tealium Channel Extension to set up your channel stacking.

What is the best way to prevent inflating a campaign tracking code value in the query string if the page is refreshed or the back arrow is used?

Gold Contributor
Gold Contributor
Thanks! That worked.
Public