This plug-in is provided by Adobe Consulting as a courtesy to help you get more value out of Adobe Analytics. Adobe Customer Care does not provide support with this plug-in, including installation or troubleshooting. If you require help with this plug-in, contact your organization’s Account Manager. They can arrange a meeting with a consultant for assistance.
The pt
plug-in executes a function or method on a list of Analytics variables. For example, you can selectively run the clearVars
method on several variables without manually calling the method each time. Several other plug-ins depend on this code to run correctly. This plug-in is not necessary if you have no need to run a specific function on more than one Analytics variable at a time, or if you’re not using any dependent plug-ins.
Adobe offers an extension that allows you to use most commonly-used plug-ins.
If you do not want to use the plug-in extension, you can use the custom code editor.
Copy and paste the following code anywhere in the AppMeasurement file after the Analytics tracking object is instantiated (using s_gi
). Preserving comments and version numbers of the code in your implementation helps Adobe with troubleshooting any potential issues.
/******************************************* BEGIN CODE TO DEPLOY *******************************************/
/* Adobe Consulting Plugin: pt v2.01 */
s.pt=function(l,de,cf,fa){if(l&&this[cf]){l=l.split(de||",");de=l.length;for(var e,c=0;c<de;c++)if(e=this[cf](l[c],fa))return e}};
/******************************************** END CODE TO DEPLOY ********************************************/
The pt
method uses the following arguments:
l
(required, string): A list of variables that the function contained in the cf
argument can execute against.de
(optional, string): The delimiter that separates the list of variables in the l
argument. Defaults to a comma (,
).cf
(required, string): The name of the callback function contained in the AppMeasurement object to be called against each of the variables contained in the l
argument.fa
(optional, string): If the function in the cf
argument calls for additional arguments when it runs, include them here. Defaults to undefined
.Calling this method returns a value if the callback function (in the cf
argument) returns a value.
The following code is part of the getQueryParam plug-in. It runs the getParameterValue helper function against each of the key-value pairs that are contained in the URL’s querystring (fullQueryString). In other to extract each key-value pair, the fullQueryString must be delimited and split out by an ampersand “&” character. The parameterKey refers to the query string parameter that the plug-in is specifically trying to extract from the query string
returnValue = s.pt(fullQueryString, "&", "getParameterValue", parameterKey)
The above line is a shortcut for running code that resembles the following:
var returnValue = "",
parameters = fullQueryString.split("&"),
parametersLength = parameters.length;
for(var i = 0; i < parametersLength; i++)
{
returnValue = s.getParameterValue(parameters[i], parameterKey);
if(returnValue !== "") break;
}