Common Analytics Plugin : getQueryParam issue | Community
Skip to main content
Level 3
October 26, 2023
Question

Common Analytics Plugin : getQueryParam issue

  • October 26, 2023
  • 1 reply
  • 479 views

Hi everyone,

I have initialised  Common Analytics Plugin : getQueryParam and when I  set it 

in Adobe Analytics extension : Custom code editor ,

like this 

s.campaign = getQueryParam('cid');

it is blocking my Adobe Analytics hits and extensions. 

Why is this common Analytics plugin blocking my Analytics when s.campaign set using getQueryParam? 

Anyone else using this plugin and have some insights to share about getQueryParam function?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
October 26, 2023

There is a likely a JS issue occurring in how the code has been added... 

 

Are you seeing errors in your console? You may have to turn on debugging

// Turn on Debugging _satellite.setDebug(true); // Turn off Debugging _satellite.setDebug(false);

 

Can you share a screenshot, or post the entire custom code? 

 

But in theory the custom code block should look like:

s.usePlugins = true; function s_doPlugins(s) { s.campaign = getQueryParam('cid'); } /******************************************* BEGIN CODE TO DEPLOY *******************************************/ /* Adobe Consulting Plugin: getQueryParam v4.0.1 */ function getQueryParam(a,d,f){function n(g,c){c=c.split("?").join("&");c=c.split("#").join("&");var e=c.indexOf("&");if(g&&(-1<e||c.indexOf("=")>e)){e=c.substring(e+1);e=e.split("&");for(var h=0,p=e.length;h<p;h++){var l=e[h].split("="),q=l[1];if(l[0].toLowerCase()===g.toLowerCase())return decodeURIComponent(q||!0)}}return""}if("-v"===a)return{plugin:"getQueryParam",version:"4.0.1"};var b=function(){if("undefined"!==typeof window.s_c_il)for(var g=0,c;g<window.s_c_il.length;g++)if(c=window.s_c_il[g],c._c&&"s_c"===c._c)return c}();"undefined"!==typeof b&&(b.contextData.getQueryParam="4.0");if(a){d=d||"";f=(f||"undefined"!==typeof b&&b.pageURL||location.href)+"";(4<d.length||-1<d.indexOf("="))&&f&&4>f.length&&(b=d,d=f,f=b);b="";for(var m=a.split(","),r=m.length,k=0;k<r;k++)a=n(m[k],f),"string"===typeof a?(a=-1<a.indexOf("#")?a.substring(0,a.indexOf("#")):a,b+=b?d+a:a):b=""===b?a:b+(d+a);return b}}; /******************************************** END CODE TO DEPLOY ********************************************/

 

Using the doPlugins function to run the QueryParam extraction at the correct time in the execution..

 

 

However, there is a much easier solution... 

 

Create a Data Element:

 

And setting it to your Campaign Variable (generally only on your page view rules, instead of on every beacon including click tracking):

 

The one week attribution will maintain the value for your click tracking, but not set the "instance" event, so that you can see exactly where the campaign was set vs carried forward.