Install the plug-in manually implementing the Web SDK
This plug-in is not yet supported for use within a manual implementation of the Web SDK.
Install the plug-in using the Adobe Analytics extension
Adobe offers an extension that allows you to use most commonly-used plug-ins with Adobe Analytics.
-
Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
-
Click the desired tag property.
-
Go to the Extensions tab, then click on the Catalog button
-
Install and publish the Common Analytics Plugins extension
-
If you haven’t already, create a rule labeled “Initialize Plug-ins” with the following configuration:
- Condition: None
- Event: Core – Library Loaded (Page Top)
-
Add an action to the above rule with the following configuration:
- Extension: Common Analytics Plugins
- Action Type: Initialize getPreviousValue
-
Save and publish the changes to the rule.
Install the plug-in using custom code editor
If you do not want to use the Common Analytics Plugins plug-in extension, you can use the custom code editor.
- Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
- Click on the desired property.
- Go to the Extensions tab, then click the Configure button under the Adobe Analytics extension.
- Expand the Configure tracking using custom code accordion, which reveals the Open Editor button.
- Open the custom code editor and paste the plug-in code provided below into the edit window.
- Save and publish the changes to the Analytics extension.
Install the plug-in using AppMeasurement
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.
Use the plug-in
The getPreviousValue function uses the following arguments:
v(string, required): The variable that has the value that you want to pass over to the next image request. A common variable used iss.pageNameto retrieve the previous page value.c(string, optional): The name of the cookie that stores the value. If this argument is not set, it defaults to"s_gpv".
When you call this function, it returns the string value contained in the cookie. The plug-in then resets the cookie expiration, and assigns it the variable value from the v argument. The cookie expires after 30 minutes of inactivity.
Examples
Unlikely Quirks
If the variable associated with the v argument is set to a new value and the getPreviousValue plug-in runs BUT an Analytics server call is NOT sent at the same time, the new v argument value is still considered the “previous value” the next time the plug-in runs.
For example, assume the following code runs on the first page of the visit:
This code produces a server call where pageName is “Home” and prop7 is not set. However, the call to getPreviousValue stores the value of pageName in the gpv_Page cookie. Assume that immediately afterwards, on the same page, the following code runs:
Since the t() function does not run in this code block, another image request is not sent. However, when the getPreviousValue function code runs this time, prop7 is set to the previous value of pageName (“Home”), then stores the new value of pageName (“New value”) in the gpv_Page cookie. Next, assume the visitor navigates to a different page and the following code runs on this page:
When the t() function runs, it creates an image request where pageName is “Page 2” and prop7 is “New value”, which was the value of pageName when the last call to getPreviousValue took place. The prop7 value of "Home" was never contained in an image request, even though “Home” was the first value passed to pageName.
Version History
3.0 (March 19, 2021)
- Added version number as context data.
v2.0 (October 7, 2019)
- Point release (complete logic rewrite).
More help on this topic
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAdobe CX Analytics Portfolio Roadmap Webinar - Americas & EMEA
Preview the CX Analytics roadmap across CJA, Adobe Analytics, and more. Ask the team.
Adobe CX Analytics Portfolio Roadmap Webinar - Americas & APAC
Preview the CX Analytics roadmap across CJA, Adobe Analytics, and more. Ask the team.