{"id":161177,"date":"2025-03-28T06:15:12","date_gmt":"2025-03-28T06:15:12","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/gtmtips-rules-in-a-nutshell\/"},"modified":"2025-03-28T06:15:12","modified_gmt":"2025-03-28T06:15:12","slug":"gtmtips-rules-in-a-nutshell","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=161177","title":{"rendered":"#GTMtips: Rules In A Nutshell"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>Rules are the cornerstone of Google Tag Manager. As with any critical element in a system, they are easy to get wrong. This tip is just a refresher on how GTM firing and blocking rules work.<\/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=\"tip-3-google-tag-manager-rules-in-a-nutshell\">Tip 3: Google Tag Manager rules in a nutshell<\/h2>\n<div style=\"aspect-ratio: 1518 \/ 848;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2014\/09\/rules-in-a-nutshell.jpg\" title=\"Rules in Google Tag Manager\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"848\" width=\"1518\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2014\/09\/rules-in-a-nutshell.jpg#ZgotmplZ\" alt=\"Rules in Google Tag Manager\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>So, let\u2019s go through these points one-by-one.<\/p>\n<p><strong>Every tag requires a firing rule to work<\/strong> &#8211; this is a given. Without a firing rule, your tag will not be written in the document object, and it will never be executed.<\/p>\n<p><strong>Every firing rule requires an {{event}} condition<\/strong> &#8211; this is a bit more complex. Every time an \u2018event\u2019 variable is pushed with some value into dataLayer, every single rule on every single tag will be evaluated against this value. Thus, every tag needs some value lookup for <strong>{{event}}<\/strong> in their firing rules.<\/p>\n<p><strong>{{event}} equals gtm.js is the \u201cdefault\u201d event<\/strong> &#8211; if there\u2019s no explicit <strong>{{event}}<\/strong> condition in your firing rule, GTM will evaluate the tag as having <strong>{{event}} equals gtm.js<\/strong> as its firing rule. This event occurs at the earliest possible moment when the GTM Container Snippet is written on the page.<\/p>\n<p><strong>A single rule can have many conditions<\/strong> &#8211; but every single condition must be matched for this rule to work as a trigger. You can introduce some OR-logic into conditions by using e.g. <strong>{{event}} matches RegEx ^gtm.(js|linkClick)$<\/strong>, but this is generally better to do with multiple firing rules rather than this crude manipulation of rule conditions.<\/p>\n<p><strong>A single tag can have many firing rules<\/strong> &#8211; this is <strong>very<\/strong> important! Every single firing rule that the tag has can and <strong>will<\/strong> fire the tag if the rule conditions are met. Thus, if you have a rule <strong>{{event}} equals gtm.dom<\/strong> (fire the tag after DOM has loaded) AND <strong>{{url path}} matches RegEx ^\/thankyou$<\/strong>, this tag will fire once on every page, and <strong>twice<\/strong> on the \/thankyou-page: first for <strong>{{event}} equals gtm.js<\/strong> and second for <strong>{{event}} equals gtm.dom<\/strong>! Note that the tag will still fire only once for a given event. So even if you manage to botch things by having three <strong>{{event}} equals gtm.js<\/strong> rules in a single tag, the tag will fire just once when the event occurs.<\/p>\n<p><strong>A blocking rule overrides any firing rule<\/strong> &#8211; if you have a blocking rule, it will override any firing rule you might have on the tag. For example, if the firing rule is <strong>{{url}} matches RegEx .<\/strong>* and the blocking rule is **{{url path}} matches RegEx ^\/thankyou$**, the tag will fire on all pages except the \/thankyou-page. The good thing about using blocking rules is that the same rule you block this tag can be used as a firing rule on some other page, e.g. the actual \/thankyou-page for your Transaction Tag!<\/p>\n<p><strong>A tag is written and run only when the firing rules activate it<\/strong> &#8211; thus, the moment the firing rule activates the tag, the tag is added to the document object and <em>any macros referred to in the tag are evaluated<\/em>. This is important, since it means that by the time the tag fires, any macros it refers to have to be available. Many eCommerce setups have failed because the Transaction Tag fires before the eCommerce payload is in the dataLayer.<\/p>\n<p>One thing about macros (this is an extra tip). When a tag fires, all macros referred to in the tag are resolved. This means that it\u2019s extremely difficult to know, especially with large implementations, how many times any macro will be resolved upon any event, as you can refer to the same macro in as many tags as you wish. Thus, it is highly recommended that you do <strong>not<\/strong> use macros to set or push data.<\/p>\n<p><strong>So be careful!<\/strong> As the wise members of the GTM product team always remind us: macros should not have side effects. They should be for value retrieval only &#8211; not to set or push data.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Rules are the cornerstone of Google Tag Manager. As with any critical element in a system, they are easy to get wrong. This tip is just a refresher on how GTM firing and blocking rules work. X The Simmer Newsletter Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":161178,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[14492,66071,11149],"dealstore":[],"offerexpiration":[],"class_list":["post-161177","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-gtmtips","tag-nutshell","tag-rules"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>#GTMtips: Rules In A Nutshell - 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=161177\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"#GTMtips: Rules In A Nutshell - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"Rules are the cornerstone of Google Tag Manager. As with any critical element in a system, they are easy to get wrong. This tip is just a refresher on how GTM firing and blocking rules work. X The Simmer Newsletter Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=161177\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-28T06:15:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1\" \/>\n\t<meta property=\"og:image:height\" content=\"1\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=161177#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=161177\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"#GTMtips: Rules In A Nutshell\",\"datePublished\":\"2025-03-28T06:15:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=161177\"},\"wordCount\":689,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=161177#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg\",\"keywords\":[\"GTMTips\",\"Nutshell\",\"Rules\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=161177#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=161177\",\"url\":\"https:\/\/fivemor.com\/?p=161177\",\"name\":\"#GTMtips: Rules In A Nutshell - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=161177#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=161177#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg\",\"datePublished\":\"2025-03-28T06:15:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=161177#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=161177\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=161177#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=161177#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"#GTMtips: Rules In A Nutshell\"}]},{\"@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":"#GTMtips: Rules In A Nutshell - 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=161177","og_locale":"en_US","og_type":"article","og_title":"#GTMtips: Rules In A Nutshell - Som2ny Network","og_description":"Rules are the cornerstone of Google Tag Manager. As with any critical element in a system, they are easy to get wrong. This tip is just a refresher on how GTM firing and blocking rules work. X The Simmer Newsletter Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=161177","og_site_name":"Som2ny Network","article_published_time":"2025-03-28T06:15:12+00:00","og_image":[{"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg","width":1,"height":1,"type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=161177#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=161177"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"#GTMtips: Rules In A Nutshell","datePublished":"2025-03-28T06:15:12+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=161177"},"wordCount":689,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=161177#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg","keywords":["GTMTips","Nutshell","Rules"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=161177#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=161177","url":"https:\/\/fivemor.com\/?p=161177","name":"#GTMtips: Rules In A Nutshell - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=161177#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=161177#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg","datePublished":"2025-03-28T06:15:12+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=161177#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=161177"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=161177#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/03\/rules-in-a-nutshell.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=161177#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"#GTMtips: Rules In A Nutshell"}]},{"@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\/161177","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=161177"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/161177\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/161178"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161177"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=161177"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=161177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}