Skip to content

Instantly share code, notes, and snippets.

@ryanpraski
Created August 28, 2018 15:02
Show Gist options
  • Save ryanpraski/6b7e17c0ff3e1300fcab96482db7abf9 to your computer and use it in GitHub Desktop.
Save ryanpraski/6b7e17c0ff3e1300fcab96482db7abf9 to your computer and use it in GitHub Desktop.
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%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment