getQueryParam SiteCatalyst Plug-in

The getQueryParam plug‐in captures a value from the query string of a URL. Once
captured, the value can be populated into any other JavaScript variable.

Plug-in Prototype

Parameter Descriptions
p=comma delimited list of case insensitive query string parameter names
d=(optional) delimiter used to separate query string parameter values if multiple values
are found. If omitted and multiple parameters from p are found, the strings are
appended to each other without a delimiter.
u=(optional) URL to take query string from. If omitted, pageURL or window.location is
used. If ‘f’, the top‐most frameset URL is used (in case you want to use the URL from the
address bar and the code is inside a frame).

Here is an example use of the plugin to populate the s.campaign variable with the value
of cid that appears in the URL query string.


Plug-in Code

 * Plugin: getQueryParam 2.3
s.getQueryParam=new Function("p","d","u",""
+"var s=this,v='',i,t;d=d?d:'';u=u?u:(s.pageURL?s.pageURL:s.wd.locati"
+"=p.length?i:i+1)}return v");
s.p_gpv=new Function("k","u",""
+"var s=this,v='',i=u.indexOf('?'),q;if(k&&i>-1){q=u.substring(i+1);v"
+",'&','p_gvf',k)}return v");
s.p_gvf=new Function("t","k",""
+"if(t){var s=this,i=t.indexOf('='),p=i<0?t:t.substring(0,i),v=i<0?'T"
+"rue':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s."
+"epa(v)}return ''");