{"id":167079,"date":"2025-04-01T18:15:45","date_gmt":"2025-04-01T18:15:45","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/fun-with-google-tag-manager-part-1\/"},"modified":"2025-04-01T18:15:45","modified_gmt":"2025-04-01T18:15:45","slug":"fun-with-google-tag-manager-part-1","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=167079","title":{"rendered":"Fun With Google Tag Manager: Part 1"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>It\u2019s time to dig into my tip library for some pretty cool things you can do with <a href=\"https:\/\/www.google.com\/tagmanager\">Google Tag Manager<\/a> to enhance your site tagging. Some of these are <a href=\"https:\/\/www.simoahava.com\/analytics\/macro-magic-google-tag-manager\/\">macro magic<\/a> through and through, some of these are best practices, and some of these are things that will make your life easier while <em>managing<\/em> a tag management solution.<\/p>\n<div style=\"aspect-ratio: 670 \/ 242;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/05\/google-tag-manager-tips.jpg\" title=\"Google Tag Manager tips\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"242\" width=\"670\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/05\/google-tag-manager-tips.jpg#ZgotmplZ\" alt=\"Google Tag Manager tips\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>I\u2019ve split this post into two parts to make it more Hobbit and less Lord Of the Rings length-wise.<\/p>\n<p>Here\u2019s what you\u2019ll find within this first part:<\/p>\n<ol>\n<li>\n<p>Unbind jQuery<\/p>\n<\/li>\n<li>\n<p>Undefined fields are not sent to GA<\/p>\n<\/li>\n<li>\n<p>Track copy event<\/p>\n<\/li>\n<li>\n<p>Errors as events<\/p>\n<\/li>\n<\/ol>\n<p>Keep your eyes peeled for the second part.<\/p>\n<p>I know, the anticipation is probably killing you.<\/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=\"1-unbind-jquery\">1. Unbind jQuery<\/h2>\n<p>I\u2019m not a huge fan of <a href=\"http:\/\/jquery.com\/\">jQuery<\/a>. I mean, it\u2019s definitely useful, since it simplifies a lot of the difficult and error-prone syntax that complex JavaScript entails. At the same time, I enjoy complex challenges, and learning the hard way has definitely made me a better developer.<\/p>\n<p>In my experience, and this is definitely a <strong>very<\/strong> marginal view, jQuery introduces a certain degree of, erm, <em>sloppiness<\/em>. I know the \u201cit\u2019s too easy\u201d argument is infantile, but in some cases the lack of transparency to what\u2019s actually happening in the code can invite some pretty poor development work. In a way, jQuery is more about <a href=\"http:\/\/api.jquery.com\/\">reading a manual<\/a> than about actually creating code, and that sucks. Especially with event handlers, some development decisions are clearly influenced by how easy it is to bind the handlers to elements.<\/p>\n<p>For Google Tag Manager, this is <a href=\"https:\/\/www.simoahava.com\/analytics\/dont-gtm-listeners-work\/\">all too familiar<\/a>. An innocuous <code>return false;<\/code> or <code>e.stopPropagation()<\/code> will prevent your GTM listeners from ever retrieving the DOM event. Often the only reason propagation is cancelled like this is the fact that the code was copy-pasted from some Stack Overflow discussion completely unrelated to your website\u2019s markup.<\/p>\n<p>OK, sorry for the rant. Here\u2019s what I suggest. Whenever your GTM listener doesn\u2019t fire when it should, open the JavaScript console and type the following line of code there\u2026<\/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:#00a\">typeof<\/span>(jQuery)!==<span style=\"color:#a50\">'undefined'<\/span>){jQuery(<span style=\"color:#a50\">'body'<\/span>).find(<span style=\"color:#a50\">'*'<\/span>).off();}\n<\/code><\/pre>\n<\/div>\n<p>\u2026and press enter. Then try clicking or form submitting again.<\/p>\n<p>What this simple line does is it unbinds <strong>all<\/strong> jQuery event handlers from all HTML elements in the document body. If your GTM listener works after this, it means that there\u2019s some interfering jQuery script. The next step is to find the problematic script, and ask your developer to fix it so that propagation isn\u2019t prevented.<\/p>\n<p>(Be sure to check out my <a href=\"https:\/\/www.simoahava.com\/analytics\/gtm-auto-event-listener-debugger-v1-1\/\">Chrome extension<\/a>, where this feature is handily one button click away!).<\/p>\n<p>Or you can choose the hacker route. If you find the interfering script, and if you find the function that\u2019s grabbing your clicks or submits and preventing propagation, you can use a Custom HTML tag to fix it.<\/p>\n<p><strong>NOTE!<\/strong> This is a <em>hack<\/em>. Be sure to test, test and TEST before publishing a container where you unbind jQuery. Also, it wouldn\u2019t hurt to consult with someone who has an understanding of just what event handlers are used on the site.<\/p>\n<p>Let\u2019s say you have a Back To Top button which is not sending clicks to GTM\u2019s listeners. You find the code in one of the page assets, and it looks something like this:<\/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\">jQuery(<span style=\"color:#a50\">'.top-of-page, a[href=\"#top\"]'<\/span>).click(<span style=\"color:#00a\">function<\/span> () {\n  jQuery(<span style=\"color:#a50\">'html, body'<\/span>).animate({\n    scrollTop: <span style=\"color:#099\">0<\/span>\n  }, <span style=\"color:#099\">400<\/span>);\n  <span style=\"color:#00a\">return<\/span> <span style=\"color:#00a\">false<\/span>;\n});\n<\/code><\/pre>\n<\/div>\n<p>As you can see, the dreaded <code>return false;<\/code> is there. That\u2019s what\u2019s stopping the events from climbing up the DOM tree.<\/p>\n<p>To fix this, create a new Custom HTML tag with the following code within:<\/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-html\" data-lang=\"html\">script&gt;\n  jQuery(<span style=\"color:#a50\">'.top-of-page, a[href=\"#top\"]'<\/span>).off(<span style=\"color:#a50\">'click'<\/span>);\n  jQuery(<span style=\"color:#a50\">'.top-of-page, a[href=\"#top\"]'<\/span>).click(<span style=\"color:#00a\">function<\/span>(e) {\n    e.preventDefault();\n    jQuery(<span style=\"color:#a50\">'html, body'<\/span>).animate({\n      scrollTop: <span style=\"color:#099\">0<\/span>\n    }, <span style=\"color:#099\">400<\/span>);\n  });\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>If jQuery and the problematic script are loaded in the <code\/> of your template, you can have this tag fire on <strong>{{url}} matches RegEx .<\/strong>*. If they\u2019re loaded elsewhere (like in the footer of your page), you might need some other event rule such as <strong>{{event}} equals gtm.load<\/strong>.<\/p>\n<p>On the first line, I unbind the original click handler. Then, I add <code>e<\/code> as an argument of the new click function. This <code>e<\/code> contains the event object, and I can then use its <code>preventDefault()<\/code> method to stop the original action of the click <em>without<\/em> stopping its propagation. Finally, I remove the <code>return false;<\/code> from the end of the function.<\/p>\n<p>Naturally, you\u2019ll need to test, test, test and then test some more whether this hack breaks down your entire site or not.<\/p>\n<p>Of course, it\u2019s not just jQuery that might interfere with your listeners. It might be vanilla JavaScript or some other library. This chapter focuses on jQuery simply because it\u2019s so widely spread that most of the time it really is the source of the problem.<\/p>\n<h2 id=\"2-undefined-fields-are-not-sent-to-ga\">2. Undefined fields are not sent to GA<\/h2>\n<p>Here\u2019s a fun fact about the Google Analytics API: if a field such as Custom Dimension is <em>undefined<\/em> when the GA endpoint is called, the Custom Dimension is left out of the payload. How is this fun? Well, it introduces an opportunity to make your tags a bit more dynamic.<\/p>\n<p>It would be nice to get a list of all the fields that behave this way, and also how they behave with other return values such as <strong>false<\/strong> or <strong>0<\/strong>.<\/p>\n<p>So, let\u2019s say you have a Custom Dimension such as <em>blog author<\/em> that you want to send with your page view tags. Naturally, you only set the blog author on blog pages. You don\u2019t want to send a dummy value like \u201cempty\u201d or \u201cn\/a\u201d on other pages on your site, so you\u2019re absolutely certain that you need two tags: one when the blog author is populated (and can be sent as a Custom Dimension), and one on all the other pages (where the Custom Dimension will be left out of the tag).<\/p>\n<div style=\"aspect-ratio: 647 \/ 186;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/05\/undefined-custom-dimension.jpg\" title=\"undefined-custom-dimension\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"186\" width=\"647\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/05\/undefined-custom-dimension.jpg#ZgotmplZ\" alt=\"undefined-custom-dimension\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>However, thanks to how the GA API works, you only need one tag. Just make sure that the macro which returns the Custom Dimension value resolves to <em>undefined type<\/em> when the dimension doesn\u2019t have a value. There are a bunch of ways you can do this:<\/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\">var<\/span> t;\n  <span style=\"color:#00a\">var<\/span> y = <span style=\"color:#a50\">\"\"<\/span>;\n  <span style=\"color:#00a\">return<\/span> t; <span style=\"color:#aaa;font-style:italic\">\/\/ returns undefined type\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">return<\/span>; <span style=\"color:#aaa;font-style:italic\">\/\/ returns undefined type\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">return<\/span> <span style=\"color:#00a\">undefined<\/span>; <span style=\"color:#aaa;font-style:italic\">\/\/ returns undefined type\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">return<\/span> <span style=\"color:#00a\">false<\/span>; <span style=\"color:#aaa;font-style:italic\">\/\/ returns boolean type\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">return<\/span> y; <span style=\"color:#aaa;font-style:italic\">\/\/ returns string type\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">return<\/span> x; <span style=\"color:#aaa;font-style:italic\">\/\/ throws ReferenceError\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>}\n<\/code><\/pre>\n<\/div>\n<p>As you can see, returning <strong>false<\/strong>, an empty string, or a variable which hasn\u2019t been declared will not do.<\/p>\n<p>The cool thing about GTM is that if you have a Data Layer Variable Macro which doesn\u2019t resolve, it will be automatically set to <em>undefined type<\/em>, meaning a Custom Dimension which refers to this macro will not get sent. So the best way to navigate through this particular scenario is to have <strong>blog-author<\/strong> declared in the dataLayer declaration before the container snippet on the page template. If the page isn\u2019t a blog page, then this declaration can just be left out.<\/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-html\" data-lang=\"html\">script&gt;\n  <span style=\"color:#00a\">var<\/span> dataLayer = [{<span style=\"color:#a50\">'blog-author'<\/span>: <span style=\"color:#a50\">'Simo Ahava'<\/span>}]; <span style=\"color:#aaa;font-style:italic\">\/\/ Blog author declared, dimension will get sent\n<\/span><span style=\"color:#aaa;font-style:italic\"\/><span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;\n...\nscript&gt;\n  <span style=\"color:#00a\">var<\/span> dataLayer = []; <span style=\"color:#aaa;font-style:italic\">\/\/ Blog author not declared, dimension will not get sent\n<\/span><span style=\"color:#aaa;font-style:italic\"\/><span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>Then, when you create a Data Layer Variable Macro, on pages with <strong>blog-author<\/strong> in the array, it will fire the Custom Dimension with the blog author\u2019s name as the value. On all other pages the dimension will not get sent.<\/p>\n<p>Once you familiarize yourself with JavaScript and understand all the different ways how GTM and JavaScript resolve variables to <em>undefined<\/em> type, you can get really creative with this feature, making your tags even more leaner.<\/p>\n<h2 id=\"3-track-copy-event\">3. Track copy event<\/h2>\n<p>Ever wondered how often people copy text using CTRL+C or some other means? Well, wonder no more, because now you can track it as an event!<\/p>\n<p>Create this simple 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-html\" data-lang=\"html\">script&gt;\n  <span style=\"color:#00a\">var<\/span> c = <span style=\"color:#0aa\">document<\/span>.getElementById(<span style=\"color:#a50\">\"entry-content\"<\/span>);\n  <span style=\"color:#00a\">if<\/span>(<span style=\"color:#00a\">typeof<\/span>(c)!==<span style=\"color:#a50\">'undefined'<\/span>) {\n    c.addEventListener(<span style=\"color:#a50\">'copy'<\/span>, <span style=\"color:#00a\">function<\/span>(evt) {\n      dataLayer.push({<span style=\"color:#a50\">'event'<\/span>: <span style=\"color:#a50\">'copy'<\/span>});\n    });\n  }\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>This is a very simple script that pushes the dataLayer event \u2018copy\u2019 whenever someone copies something on your page within the HTML element with ID <em>entry-content<\/em> (e.g. <code\/>).<\/p>\n<p>Be sure to change the element whose content you want to track with the event listener to match the markup on your website.<\/p>\n<p>You can make it more versatile by exploring the contents of the <code>evt<\/code> argument, which is the event object. Its <code>target<\/code> property contains the HTML element which was the target of the event. Here are some ideas:<\/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\">...\ndataLayer.push({<span style=\"color:#a50\">'event'<\/span>: <span style=\"color:#a50\">'copy'<\/span>, <span style=\"color:#a50\">'copy-id'<\/span>: evt.target.id, <span style=\"color:#a50\">'copy-content'<\/span>: evt.target.innerHTML});\n...\n<\/code><\/pre>\n<\/div>\n<p>And so on. Note that <code>evt.target<\/code> stores the element where the copy event started. So if the copy action takes place over multiple paragraphs, headers, or spans, for example, you\u2019ll only be able to observe the properties of the first element targeted by the action.<\/p>\n<h2 id=\"4-errors-as-events\">4. Errors as events<\/h2>\n<p>Google Tag Manager has this cool thing called the <a href=\"https:\/\/support.google.com\/tagmanager\/answer\/3415369?hl=en#JSErrorListener\">JavaScript Error Listener<\/a>. This fires whenever an <em>unchecked<\/em> exception occurs on the site. For example, consider the following:<\/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\">var<\/span> myText = <span style=\"color:#a50\">\"Hello!\"<\/span>;\nalert(myTxt); <span style=\"color:#aaa;font-style:italic\">\/\/ Unchecked ReferenceError, will fire GTM's error listener\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>\n<span style=\"color:#aaa;font-style:italic\">\/\/ Exception caught, will not fire GTM's error listener\n<\/span><span style=\"color:#aaa;font-style:italic\"\/><span style=\"color:#00a\">try<\/span> {\n  alert(myTxt);\n} <span style=\"color:#00a\">catch<\/span>(e) {\n  console.log(e.message);\n}\n<\/code><\/pre>\n<\/div>\n<p>With GTM\u2019s error listener, you can send each uncaught error as an event to Google Analytics. You can then analyze these events to find problems with your scripts. If you have a huge site, you might get hundreds of these errors, so you\u2019ll need to adjust the code to perhaps only listen for certain pages or errors.<\/p>\n<div style=\"aspect-ratio: 483 \/ 379;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/05\/javascript-errors.jpg\" title=\"JavaScript errors on site\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"379\" width=\"483\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/05\/javascript-errors.jpg#ZgotmplZ\" alt=\"JavaScript errors on site\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>I\u2019m hoping at some point we can have the listener fire only for errors propagated by GTM\u2019s tags and macros. This way you can debug your GTM installation without having to worry about all the other errors on your website (<strong>even though you definitely should!<\/strong>).<\/p>\n<p>To get the listener up and running, do the following:<\/p>\n<ol>\n<li>\n<p>Create a new JavaScript Error Listener tag<\/p>\n<\/li>\n<li>\n<p>Have it fire on all pages (or some other rule of your choice)<\/p>\n<\/li>\n<li>\n<p>Create a new rule <strong>Event &#8211; gtm.pageError<\/strong>, where <strong>{{event}} equals gtm.pageError<\/strong><\/p>\n<\/li>\n<li>\n<p>Create three new Data Layer Variable macros:<\/p>\n<\/li>\n<\/ol>\n<pre><code>1. {{Error - Message}}, where variable name is gtm.errorMessage\n\n2. {{Error - Line}}, where variable name is gtm.errorLineNumber\n\n3. {{Error - URL}}, where variable name is gtm.errorUrl\n<\/code><\/pre>\n<ol start=\"5\">\n<li>\n<p>Create a new Event tag and configure it to your liking<\/p>\n<\/li>\n<li>\n<p>Make sure the Event tag fires on the rule you created in (3)<\/p>\n<\/li>\n<\/ol>\n<div style=\"aspect-ratio: 509 \/ 360;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/06\/javascript-error-listener.jpg\" title=\"JavaScript Error Event Tag\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"360\" width=\"509\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/06\/javascript-error-listener.jpg#ZgotmplZ\" alt=\"JavaScript Error Event Tag\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p><strong>Remember to set the Non-Interaction Hit parameter of the Event tag to true.<\/strong> You don\u2019t want to kill your bounce rate with errors on your site!<\/p>\n<p>If you\u2019re seeing a lot of <strong>Script error.<\/strong> hits, it means that the errors occur in JavaScript resources loaded from other domains. Due to browser \/ cross-domain security policies the actual error name and message are obfuscated.<\/p>\n<h2 id=\"conclusions\">Conclusions<\/h2>\n<p>The second part of this post is on its way. I didn\u2019t want to puke too much text into a simple tips &amp; tricks post, but this one is 1800+ words already, so\u2026 \ud83d\ude42 Topics in the next post are:<\/p>\n<ol>\n<li>\n<p>dataLayer declaration vs. dataLayer.push()<\/p>\n<\/li>\n<li>\n<p>How to stop a GTM timer listener<\/p>\n<\/li>\n<li>\n<p>Adopting a proper naming convention<\/p>\n<\/li>\n<li>\n<p>Annotating container versions with names and notes<\/p>\n<\/li>\n<\/ol>\n<p>Anyway, I love nothing better than to explore the versatility of Google Tag Manager. There\u2019s so much you can do with JavaScript, DOM API, and the Google Tag Manager library!<\/p>\n<p>All that\u2019s required is a bit of know-how with JavaScript and the Document Object Model, a lot of creativity, and a lot of testing, previewing and debugging.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s time to dig into my tip library for some pretty cool things you can do with Google Tag Manager to enhance your site tagging. Some of these are macro magic through and through, some of these are best practices, and some of these are things that will make your life easier while managing a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":167080,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[1304,1531,14495,3341,1791],"dealstore":[],"offerexpiration":[],"class_list":["post-167079","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-fun","tag-google","tag-manager","tag-part","tag-tag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Fun With Google Tag Manager: Part 1 - 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=167079\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fun With Google Tag Manager: Part 1 - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"It\u2019s time to dig into my tip library for some pretty cool things you can do with Google Tag Manager to enhance your site tagging. Some of these are macro magic through and through, some of these are best practices, and some of these are things that will make your life easier while managing a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=167079\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-01T18:15:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"670\" \/>\n\t<meta property=\"og:image:height\" content=\"242\" \/>\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=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=167079#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=167079\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Fun With Google Tag Manager: Part 1\",\"datePublished\":\"2025-04-01T18:15:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=167079\"},\"wordCount\":1673,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=167079#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg\",\"keywords\":[\"Fun\",\"Google\",\"Manager\",\"PART\",\"TAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=167079#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=167079\",\"url\":\"https:\/\/fivemor.com\/?p=167079\",\"name\":\"Fun With Google Tag Manager: Part 1 - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=167079#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=167079#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg\",\"datePublished\":\"2025-04-01T18:15:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=167079#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=167079\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=167079#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg\",\"width\":670,\"height\":242},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=167079#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fun With Google Tag Manager: Part 1\"}]},{\"@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":"Fun With Google Tag Manager: Part 1 - 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=167079","og_locale":"en_US","og_type":"article","og_title":"Fun With Google Tag Manager: Part 1 - Som2ny Network","og_description":"It\u2019s time to dig into my tip library for some pretty cool things you can do with Google Tag Manager to enhance your site tagging. Some of these are macro magic through and through, some of these are best practices, and some of these are things that will make your life easier while managing a [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=167079","og_site_name":"Som2ny Network","article_published_time":"2025-04-01T18:15:45+00:00","og_image":[{"width":670,"height":242,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=167079#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=167079"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Fun With Google Tag Manager: Part 1","datePublished":"2025-04-01T18:15:45+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=167079"},"wordCount":1673,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=167079#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg","keywords":["Fun","Google","Manager","PART","TAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=167079#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=167079","url":"https:\/\/fivemor.com\/?p=167079","name":"Fun With Google Tag Manager: Part 1 - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=167079#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=167079#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg","datePublished":"2025-04-01T18:15:45+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=167079#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=167079"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=167079#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/04\/google-tag-manager-tips.jpg","width":670,"height":242},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=167079#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Fun With Google Tag Manager: Part 1"}]},{"@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\/167079","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=167079"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/167079\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/167080"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167079"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=167079"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=167079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}