Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
If you want to save the previous pageName via DTM without a Plugin (getPreviousValue), you can use Session Storage. Two Pageload Rules are needed.
[Adobe Analytics|DTM] Previous pageName
If you want to save the previous pageName via DTM without a Plugin (getPreviousValue), you can use Session Storage. Two Pageload Rules are needed.
First PLR:
- Trigger Rule at “DOM Ready”
- Rule Condition: Path “.*” (regex enabled)
- Custom Code “None-Sequential Javascript”:
if(typeof(Storage) != "undefined") {
if (typeof(s) !== "undefined") {
sessionStorage.pagename = s.pageName;
}
}
Second PLR:
- Trigger Rule at “Bottom of Page”
- Rule Condition: Path “.*” (regex enabled)
- Rule Condition: Custom:
if(typeof(Storage) !== "undefined") {
if(typeof(sessionStorage.getItem("pagename")) != "undefined") {
var prevPageName = sessionStorage.getItem("pagename");
_satellite.setVar("previousPage",prevPageName);
return true;
}
}
- Adobe Analytics: prop2 set as %previousPage%
@ryanpraski

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment