Campaign tracking code variable is being set multiple times during one session



Hi there,

Our customer had observed an issue with not finding some of their campaigns inside reaching Reports > Campaigns > Tracking Code > Tracking Code report. Once I looked into it, I had observed two things:

1) When I am loading campaign url into the browser (either latest Chrome or Firefox) - I see (inside Adobe Site Catalyst Debugger chrome extention / Firefox bookmark) Campaign variable being sent to SC, and event25 too - as expected. I can also see this right away reflected inside the report "Reports > Campaigns > Tracking Code > Tracking Code ". Which makes me think that the issue is browser related. Can you please tell, if there is a known issue around "getValOnce()" and / or "getQueryParam()" and / or "apl()"  that takes place when certain browser is used? The customer in question has version H.25.1. of Site Catalyst script.

2) According to this article (sadly, I did not find official API reference via googling for it), getValOnce() should set campaign tracking once per session: . However, when I am running tests, for me (in both Firefox and Chrome) the campaign variable and event25 is sent every time I reload page with update url (every time I submit new cmpid value to the url), e.g. multiple times during the same session. Can you please explain why this is happening? TrackingCode variable has following settings for this customer: allocation - most recent (last), expire after - week, reset - do not reset. The code that sets campaign variable is as follows below:

if (!omt_s.campaign) { omt_s.campaign = omt_s.getQueryParam('cmpid'); omt_s.campaign = omt_s.getValOnce(omt_s.campaign, 'ecmpid', 0); if (omt_s.campaign) = omt_s.apl(, 'event25', ',', 1); }

Thank you very much for your help.

Warm regards


Accepted Solutions (1)

Accepted Solutions (1)



@Zoryana -

Each time a value is passed into the getValOnce() plugin, the value stored in the cookie updates. Because of this, each time your cmpid value changes, getValOnce() returns the new value.

In the following example, assume that each call to getValOnce() occurs in the order listed, during a single session/visit:

  1. omt_s.getValOnce("first_value", "ecmpid", 0) // returns "first_value"
  2. omt_s.getValOnce("first_value", "ecmpid", 0) // returns "" because the campaign value ("first_value") has NOT changed
  3. omt_s.getValOnce("second_value", "ecmpid", 0) // returns "second_value" because the campaign value HAS changed
  4. omt_s.getValOnce("first_value", "ecmpid", 0) // returns "first_value" again, because the campaign value changed from "second_value"
  5. omt_s.getValOnce("first_value", "ecmpid", 0) // returns "" because the campaign value ("first_value") has NOT changed
  6. omt_s.getValOnce("third_value", "ecmpid", 0) // returns "third_value" because the campaign value HAS changed

So, based on the description in your question, I believe the plugin is working as expected. If you are looking for a different behavior, you may need to build custom logic.

Answers (0)