Skip to content

Instantly share code, notes, and snippets.

@jsn789
jsn789 / dataLayerHistory.js
Created November 24, 2018 17:14 — forked from sahava/dataLayerHistory.js
JavaScript for persisting dataLayer array and data model composition across pages
(function() {
// Set the timeout for when the dataLayer history should be purged. The default is 30 minutes.
// The timeout needs to be in milliseconds.
var timeout = 30*60*1000;
// Change dataLayerName only if you've defined another named for the dataLayer array in your
// GTM container snippet.
var dataLayerName = 'dataLayer';
// Don't change anything below.