{"id":141387,"date":"2025-03-18T09:54:16","date_gmt":"2025-03-18T09:54:16","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/two-ways-to-persist-data-via-google-tag-manager\/"},"modified":"2025-03-18T09:54:16","modified_gmt":"2025-03-18T09:54:16","slug":"two-ways-to-persist-data-via-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=141387","title":{"rendered":"Two Ways To Persist Data Via Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>The web is stateless. It\u2019s basically blind to your past, and it does a poor job of predicting what you might do in the future. When you browse to a website, the browser requests the page from the web server, and then proceeds to render it for you. This is a detached, clinical process, and any <em>personalized<\/em> or <em>stateful<\/em> data transfer is left to the sophistication of your web server.<\/p>\n<div style=\"aspect-ratio: 1838 \/ 446;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2015\/08\/cookies.jpg\" title=\"Cookies in the browser\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"446\" width=\"1838\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2015\/08\/cookies.jpg#ZgotmplZ\" alt=\"Cookies in the browser\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Statelessness has some implications to us concerned about web analytics and measuring our visitors. In <a href=\"https:\/\/tagmanager.google.com\/\">Google Tag Manager<\/a>, this is an ever-present elephant in the room. Indeed, many suffer over not being able to fire Tags for e.g. <strong>returning<\/strong> visitors, or <strong>after five<\/strong> page views, or if the <strong>original source<\/strong> of the Session was AdWords. GTM is (for now) blind to this type of thinking, as it\u2019s simply a JavaScript machine operating in a stateless environment. Any notion of <em>state<\/em> needs to be injected manually into the machine.<\/p>\n<p>And how is this done? <strong>Cookies<\/strong> and the <strong>Web Storage API<\/strong>.<\/p>\n<p>                <span class=\"simmer\"><br \/>\n  <span class=\"close\">X<\/span><\/p>\n<p>\n    <span class=\"fa fa-md fa-bell\"\/><br \/>\n    <strong>The Simmer Newsletter<\/strong>\n  <\/p>\n<p>\n    Subscribe to the <a href=\"https:\/\/www.simoahava.com\/newsletter\/\">Simmer newsletter<\/a> to get the latest news and content from Simo Ahava into your email inbox!\n  <\/p>\n<p>  <\/span><\/p>\n<h2 id=\"browser-cookies\">Browser cookies<\/h2>\n<p>Cookies in the browser are the de facto way of persisting information in the web. They\u2019ve been around for a long time (over 20 years!), and they\u2019re supported by pretty much all browsers &#8211; legacy and modern. For a refresher on what cookies are and how they work, check out <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTTP_cookie\">this Wikipedia article<\/a>. The most relevant features of browser cookies are:<\/p>\n<ol>\n<li>\n<p>4KB size limitation (per cookie)<\/p>\n<\/li>\n<li>\n<p>Unencrypted in a single string, stored in <code>document.cookie<\/code><\/p>\n<\/li>\n<li>\n<p>Sent to the server with every single HTTP request<\/p>\n<\/li>\n<li>\n<p>Can be set with an expiration date<\/p>\n<\/li>\n<\/ol>\n<p>The size limitation quickly becomes an issue with large payloads, and the fact that they are sent to the server unencrypted with each request can be a turn-off for those with security concerns.<\/p>\n<h2 id=\"web-storage-api\">Web Storage API<\/h2>\n<p>The <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Web_Storage_API\">Web Storage API<\/a> is a more recent innovation, and this is represented by lack of support from Internet Explorer 7 and older (who cares, though!). The API has two interfaces: <code>localStorage<\/code> and <code>sessionStorage<\/code>. The main difference is that the latter persists for the duration of the browser session (i.e. is flushed when the browser instance is shut down), and the former persists indefinitely.<\/p>\n<div style=\"aspect-ratio: 1142 \/ 516;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2015\/08\/localstorage.jpg\" title=\"localStorage API\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"516\" width=\"1142\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2015\/08\/localstorage.jpg#ZgotmplZ\" alt=\"localStorage API\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Features of the Web Storage API are:<\/p>\n<ol>\n<li>\n<p>Can only be read client-side in the browser. No data is sent to the server.<\/p>\n<\/li>\n<li>\n<p>Stores a maximum of 5MB per domain<\/p>\n<\/li>\n<li>\n<p>Stores data in a hash table, meaning you can make exact queries without having to parse the data<\/p>\n<\/li>\n<\/ol>\n<p>Basically, the Web Storage API is a logical evolution of persistence, taking the best of cookies and adding better data access and management features. The big drawback is the lack of server-side communication, so if you rely on cookies to pass information to the web server, migrating to the Web Storage API wouldn\u2019t be logical unless you manually send the data to the server (e.g. via POST request).<\/p>\n<h2 id=\"cookies-and-gtm\">Cookies and GTM<\/h2>\n<p>Google Tag Manager, thankfully, already provides us an interface to query for cookie values: the <a href=\"https:\/\/www.simoahava.com\/analytics\/variable-guide-google-tag-manager\/\">1st Party Cookie Variable<\/a>. When you set the Variable to a cookie name, it will always return whatever value is stored in that particular cookie. This is a huge help, since you don\u2019t need to go through the rather tedious process of parsing the entire cookie string for the name-value pair you\u2019re looking for.<\/p>\n<p>Setting a cookie, however, still needs to be done manually. The easiest way to set a cookie is to add the following code in a Custom HTML Tag:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#0aa\">document<\/span>.cookie = <span style=\"color:#a50\">'cookieName=cookieValue'<\/span>;\n<\/code><\/pre>\n<\/div>\n<p>This would set a cookie with the name <strong>cookieName<\/strong> and the value <strong>cookieValue<\/strong>. However, using this code alone would set the cookie to expire at the end of the <strong>browser session<\/strong> (i.e. when the browser is shut down), and the cookie would be set on the current <strong>path<\/strong> and the current <strong>domain<\/strong> only. The path and domain combination is especially important, as the cookie would only be accessible via the page it was set on.<\/p>\n<p>This is why it\u2019s customary to create a helper function, with which you can provide some important parameters. To create this type of helper in GTM\u2019s context, I suggest using a <strong>Custom JavaScript Variable<\/strong> named <strong>{{JS &#8211; setCookie}}<\/strong>:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">function<\/span>() {\n  <span style=\"color:#00a\">return<\/span> <span style=\"color:#00a\">function<\/span>(name, value, ms, path, domain) {\n    <span style=\"color:#00a\">if<\/span> (!name || !value) {\n      <span style=\"color:#00a\">return<\/span>;\n    }\n    <span style=\"color:#00a\">var<\/span> d;\n    <span style=\"color:#00a\">var<\/span> cpath = path ? <span style=\"color:#a50\">'; path='<\/span> + path : <span style=\"color:#a50\">''<\/span>;\n    <span style=\"color:#00a\">var<\/span> cdomain = domain ? <span style=\"color:#a50\">'; domain='<\/span> + domain : <span style=\"color:#a50\">''<\/span>;\n    <span style=\"color:#00a\">var<\/span> expires = <span style=\"color:#a50\">''<\/span>;\n    <span style=\"color:#00a\">if<\/span> (ms) {\n      d = <span style=\"color:#00a\">new<\/span> <span style=\"color:#0aa\">Date<\/span>();\n      d.setTime(d.getTime() + ms);\n      expires = <span style=\"color:#a50\">'; expires='<\/span> + d.toUTCString();\n    }\n    <span style=\"color:#0aa\">document<\/span>.cookie = name + <span style=\"color:#a50\">\"=\"<\/span> + value + expires + cpath + cdomain;\n  }\n}\n<\/code><\/pre>\n<\/div>\n<p>This handy little function actually <em>returns<\/em> another function, which takes a number of parameters:<\/p>\n<ul>\n<li>\n<p>name: <strong>Required<\/strong>. The cookie name.<\/p>\n<\/li>\n<li>\n<p>value: <strong>Required<\/strong>. Value for the cookie.<\/p>\n<\/li>\n<li>\n<p>ms: Expiration time of the cookie in milliseconds. If not set, defaults to <em>Session<\/em>.<\/p>\n<\/li>\n<li>\n<p>path: Path of the cookie. If not set, defaults to the current path.<\/p>\n<\/li>\n<li>\n<p>domain: Domain of the cookie. If not set, defaults to the current domain.<\/p>\n<\/li>\n<\/ul>\n<p>To use this Variable in a script, you need to use the following syntax:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\">{{JS - setCookie}}(<span style=\"color:#a50\">'session'<\/span>, <span style=\"color:#a50\">'true'<\/span>, <span style=\"color:#099\">1800000<\/span>, <span style=\"color:#a50\">'\/'<\/span>, <span style=\"color:#a50\">'simoahava.com'<\/span>);\n<\/code><\/pre>\n<\/div>\n<p>This would set a cookie with the name <strong>session<\/strong> and value <strong>true<\/strong>, which persists for <strong>30 minutes<\/strong>, and is written on the root page of the root domain.<\/p>\n<p>If you want to leave a parameter out, you\u2019ll need to replace it with <code>undefined<\/code>, if you still want to send one of the latter parameters. For example:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\">{{JS - setCookie}}(<span style=\"color:#a50\">'session'<\/span>, <span style=\"color:#a50\">'true'<\/span>, <span style=\"color:#00a\">undefined<\/span>, <span style=\"color:#00a\">undefined<\/span>, <span style=\"color:#a50\">'simoahava.com'<\/span>);\n<\/code><\/pre>\n<\/div>\n<p>Would set a cookie with name <strong>session<\/strong>, value <strong>true<\/strong>, which would be a Session cookie, written on the current page of the root domain.<\/p>\n<p>Phew! That\u2019s a mouthful of code. But it does its job nicely. Combine this with the excellent 1st Party Cookie Variable, and you\u2019ve managed to create a nice and handy cookie setter\/getter.<\/p>\n<h2 id=\"web-storage-api-and-gtm\">Web Storage API and GTM<\/h2>\n<p>You could create a fancy set of Custom JavaScript Variables for <code>localStorage<\/code> and <code>sessionStorage<\/code> as well, but why bother? They\u2019re dead simple to interact with.<\/p>\n<p>To set a key-value pair in storage, you can use the following syntax:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">if<\/span> (<span style=\"color:#0aa\">window<\/span>[<span style=\"color:#a50\">'Storage'<\/span>]) {\n  <span style=\"color:#aaa;font-style:italic\">\/\/ localStorage persists indefinitely\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  localStorage.setItem(<span style=\"color:#a50\">'session'<\/span>, <span style=\"color:#a50\">'true'<\/span>); \n  <span style=\"color:#aaa;font-style:italic\">\/\/ sessionStorage persists until the browser is closed\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  sessionStorage.setItem(<span style=\"color:#a50\">'session'<\/span>, <span style=\"color:#a50\">'true'<\/span>);\n} <span style=\"color:#00a\">else<\/span> {\n  <span style=\"color:#aaa;font-style:italic\">\/\/ Fallback for when the browser doesn't support Web Storage API\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  {{JS - setCookie}}(<span style=\"color:#a50\">'session'<\/span>, <span style=\"color:#a50\">'true'<\/span>);\n}\n<\/code><\/pre>\n<\/div>\n<p>First of all, you need to check if the browser supports the Web Storage API. That\u2019s just a simple <code>if...else<\/code> block. See what I did with the fallback? That\u2019s right! I used the <strong>{{JS &#8211; setCookie}}<\/strong> method we just created! What a beautiful segue.<\/p>\n<p>Web Storage only accepts strings as values, so you need to make sure whatever you\u2019re storing can be safely converted into a String. Don\u2019t worry, the Storage API does the casting for you, if you fail to explicitly save a String type.<\/p>\n<p>Unfortunately, as of yet GTM does not have a handy Variable you can use to fetch items from storage (I hope this changes soon!). But to retrieve a value is just as simple as setting one:<\/p>\n<div class=\"highlight\">\n<pre style=\"background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-javascript\" data-lang=\"javascript\"><span style=\"color:#00a\">if<\/span> (<span style=\"color:#0aa\">window<\/span>[<span style=\"color:#a50\">'Storage'<\/span>]) {\n  <span style=\"color:#00a\">var<\/span> localSession = localStorage.getItem(<span style=\"color:#a50\">'session'<\/span>);\n  <span style=\"color:#00a\">var<\/span> sessionSession = sessionStorage.getItem(<span style=\"color:#a50\">'session'<\/span>);\n}\n<\/code><\/pre>\n<\/div>\n<p>That\u2019s right, it\u2019s the <code>getItem()<\/code> method of the API that lets you access stored keys. It returns <code>null<\/code> if the item isn\u2019t found.<\/p>\n<p>And that\u2019s how you roll with the Web Storage API. You get by with a LOT less code, and the value lookup is way more intuitive than with cookies, though GTM does take a lot of the burden away from you with its awesome 1st Party Cookie Variable.<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>For many interactions, persisting data in the browser is very important. However, not all persistence should be left for the client, since servers do a far better and more robust job of storing user- and usage-based data. That\u2019s why Google Analytics shifted from client-side calculations (ga.js and older) to server-side algorithms (Universal Analytics). And that\u2019s why if you really have pressing and business-critical needs to persist information, you might want to talk to your developers about storing this in a proper data store or database, exposing the information in the <code>dataLayer<\/code> when and where relevant.<\/p>\n<p>But for the simple, session-scoped persistence, the two methods outlined in this guide should be quite useful. I strongly recommend using the Web Storage API, but unfortunately you might need to introduce a fallback with browser cookies, since there are still many fools out there using outdated browsers.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>The web is stateless. It\u2019s basically blind to your past, and it does a poor job of predicting what you might do in the future. When you browse to a website, the browser requests the page from the web server, and then proceeds to render it for you. This is a detached, clinical process, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":141388,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[11603,1531,14495,21084,1791,8023],"dealstore":[],"offerexpiration":[],"class_list":["post-141387","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-data","tag-google","tag-manager","tag-persist","tag-tag","tag-ways"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Two Ways To Persist Data Via Google Tag Manager - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=141387\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Two Ways To Persist Data Via Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"The web is stateless. It\u2019s basically blind to your past, and it does a poor job of predicting what you might do in the future. When you browse to a website, the browser requests the page from the web server, and then proceeds to render it for you. This is a detached, clinical process, and [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=141387\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-18T09:54:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1838\" \/>\n\t<meta property=\"og:image:height\" content=\"446\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=141387#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=141387\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Two Ways To Persist Data Via Google Tag Manager\",\"datePublished\":\"2025-03-18T09:54:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=141387\"},\"wordCount\":1310,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=141387#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg\",\"keywords\":[\"Data\",\"Google\",\"Manager\",\"persist\",\"TAG\",\"Ways\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=141387#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=141387\",\"url\":\"https:\/\/fivemor.com\/?p=141387\",\"name\":\"Two Ways To Persist Data Via Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=141387#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=141387#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg\",\"datePublished\":\"2025-03-18T09:54:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=141387#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=141387\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=141387#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg\",\"width\":1838,\"height\":446},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=141387#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Two Ways To Persist Data Via Google Tag Manager\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Two Ways To Persist Data Via Google Tag Manager - Som2ny Network","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fivemor.com\/?p=141387","og_locale":"en_US","og_type":"article","og_title":"Two Ways To Persist Data Via Google Tag Manager - Som2ny Network","og_description":"The web is stateless. It\u2019s basically blind to your past, and it does a poor job of predicting what you might do in the future. When you browse to a website, the browser requests the page from the web server, and then proceeds to render it for you. This is a detached, clinical process, and [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=141387","og_site_name":"Som2ny Network","article_published_time":"2025-03-18T09:54:16+00:00","og_image":[{"width":1838,"height":446,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=141387#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=141387"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Two Ways To Persist Data Via Google Tag Manager","datePublished":"2025-03-18T09:54:16+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=141387"},"wordCount":1310,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=141387#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg","keywords":["Data","Google","Manager","persist","TAG","Ways"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=141387#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=141387","url":"https:\/\/fivemor.com\/?p=141387","name":"Two Ways To Persist Data Via Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=141387#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=141387#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg","datePublished":"2025-03-18T09:54:16+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=141387#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=141387"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=141387#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/cookies.jpg","width":1838,"height":446},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=141387#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Two Ways To Persist Data Via Google Tag Manager"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/141387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=141387"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/141387\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/141388"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=141387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=141387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=141387"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=141387"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=141387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}