{"id":93467,"date":"2025-02-17T11:04:03","date_gmt":"2025-02-17T11:04:03","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/gtmtips-the-mysterious-macro-call-in-custom-html-tags\/"},"modified":"2025-02-17T11:04:03","modified_gmt":"2025-02-17T11:04:03","slug":"gtmtips-the-mysterious-macro-call-in-custom-html-tags","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=93467","title":{"rendered":"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>When previewing <strong>Custom HTML tags<\/strong> in <a href=\"https:\/\/tagmanager.google.com\/\">Google Tag Manager<\/a> you\u2019ve almost certainly run into a situation where the <a href=\"https:\/\/www.simoahava.com\/analytics\/variable-guide-google-tag-manager\/\">GTM variable<\/a> shows up as a weird JavaScript method resembling something like this:<\/p>\n<p><code>google_tag_manager[\"GTM-ABCD123\"].macro(15)<\/code><\/p>\n<p>And this is when you were expecting it to show the actual, resolved value!<\/p>\n<p>It doesn\u2019t help that every now and then the preview mode actually shows to <strong>correct<\/strong> value in the preview mode.<\/p>\n<p>What\u2019s up with that? Well, there\u2019s a fairly logical explanation to this. Read on!<\/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<div style=\"aspect-ratio: 960 \/ 540;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/macro-call-custom-html-tag.jpg\" title=\"Macro call in Custom HTML tags\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"540\" width=\"960\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/macro-call-custom-html-tag.jpg#ZgotmplZ\" alt=\"Macro call in Custom HTML tags\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Let\u2019s start with the good news.<\/p>\n<p>Your <strong>tag<\/strong> and the <strong>variables<\/strong> are <em>most likely<\/em> working as they should.<\/p>\n<p>When you create a <strong>Custom HTML tag<\/strong> in Google Tag Manager, you are actually creating HTML elements that are appended to the end of the <code\/> element when the tag fires.<\/p>\n<p>This means that if the HTML element you are injecting is a <code><script\/><\/code> block, i.e. a JavaScript execution context, the code isn\u2019t run <em>until<\/em> 1) the HTML element is appended to the end of <code\/>, and 2) the browser has rendered the element and is ready to execute the JavaScript within the <code><script\/><\/code> block.\nNow, when you add a <strong>Google Tag Manager variable<\/strong> to a Custom HTML tag, you use the <code>{{variableName}}<\/code> syntax.\n<div style=\"aspect-ratio: 365 \/ 140;\" class=\"figure nocaption\">\n    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/gtm-variable.jpg\" title=\"GTM variable\">\n    <img decoding=\"async\" class=\"fig-img\" height=\"140\" width=\"365\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/gtm-variable.jpg#ZgotmplZ\" alt=\"GTM variable\"\/>\n    <\/a>\n<\/div>\nBecause it would make little sense to resolve the variable before the surrounding JavaScript code is run, what follows is that GTM does not resolve the variables until the Custom HTML tag has been injected to the end of <code\/>.\nTo be able to defer the variables to wait for injection, this must mean that the variables themselves must be some type of function calls that the surrounding script will execute and resolve once the tag has been injected.\n<strong>Enter <code>google_tag_manager['GTM-ABCD123'].macro(n)<\/code>!<\/strong>\nEvery single Google Tag Manager used in a Custom HTML tag will receive its own, unique value for <code>n<\/code>, which will then be passed to the <code>.macro()<\/code> method <strong>when the tag code is executed<\/strong>.\n<blockquote>\n<strong>Note!<\/strong> This is not a deterministic value. The <code>n<\/code> can change from container version to another, so you should NOT build any sort of logic around having some specific variable always assigned some specific value for <code>n<\/code>.\n<\/blockquote>\n<h3 id=\"so-why-doesnt-it-resolve-in-preview-mode\">So why doesn\u2019t it resolve in Preview mode?<\/h3>\nFirst of all, this is a good question. Google Tag Manager shows you what the call to <code>macro()<\/code> looks like and doesn\u2019t actually replace the call with the value of the variable at the time of inspecting the tag.\nThe most likely reason why GTM doesn\u2019t resolve the <code>macro()<\/code> call is because it would have to resolve the entire Custom HTML tag content to be able to adjust the value returned by <code>macro()<\/code> depending on context.\nAnd this makes no sense &#8211; GTM can\u2019t start resolving Custom HTML tags within the Preview mode window &#8211; how would it render things like HTML elements? How would it resolve things like <code>document.getElementById()<\/code> when the iframe has no access to the actual page itself?\nSo GTM can\u2019t resolve the Custom HTML tag while in Preview mode, <strong>which is why it shows you the pre-injection status of the Custom HTML tag<\/strong>, together with the <code>.macro()<\/code> calls and all.\nIt\u2019s only <strong>after<\/strong> the Custom HTML tag is added to the page that the <code>.macro()<\/code> calls are executed. This bears repeating since it\u2019s an important point.\n<h3 id=\"but-why-do-some-variables-resolve-in-preview-mode\">But why do SOME variables resolve in Preview mode?<\/h3>\nHahaa! You found the exception.\nTake a look at this Custom HTML tag:\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\">function<\/span>() {\n    console.log({{Container ID}});\n    console.log(<span style=\"color:#a50\">\"{{Container ID}}\"<\/span>);\n  })();\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\nSee the difference? The first logs the variable plainly, without regard to what its return type is. The second <strong>casts the variable as a string<\/strong> before logging it.\nLet\u2019s take a look at what Preview mode shows.\n<div style=\"aspect-ratio: 758 \/ 226;\" class=\"figure nocaption\">\n    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/cast-as-string.jpg\" title=\"Cast as string\">\n    <img decoding=\"async\" class=\"fig-img\" height=\"226\" width=\"758\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/cast-as-string.jpg#ZgotmplZ\" alt=\"Cast as string\"\/>\n    <\/a>\n<\/div>\nFascinating! Why does casting the variable as a string force GTM to resolve the variable?\nSimple. Imagine if GTM did NOT resolve the <code>.macro()<\/code> call. The second line would become:\n<code>console.log(\"google_tag_manager['GTM-ABCD123'].macro(15)\");<\/code>\nIn other words, the whole function call would be cast into a string, which would end up writing <code>google_tag_manager['GTM-ABCD123'].macro(15)<\/code> into the browser console rather than <code>GTM-ABCD123<\/code>!\nSo when you cast the variable into a string, GTM <strong>will resolve it<\/strong> pre-injection.\n<h3 id=\"how-do-i-know-its-working\">How do I know it\u2019s working?<\/h3>\nBecause Google Tag Manager shows variables as <code>macro()<\/code> calls, it\u2019s really difficult to quickly check if the Custom HTML tag nevertheless works. However, here are some tips:\n<h4 id=\"1-check-the-value-of-the-variable-in-the-variables-tab\">1. Check the value of the variable in the Variables tab<\/h4>\nThis is an easy way to get a good idea if the variable works or not. You know what the variable should be (e.g. \u201cContainer ID\u201d in my case), so all you have to do is <strong>select the trigger event that fires the Custom HTML tag<\/strong>, open the <em>Variables<\/em> tab in Preview mode, and check the value of the variable.\n<div style=\"aspect-ratio: 981 \/ 317;\" class=\"figure nocaption\">\n    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/variable-in-preview.jpg\" title=\"Variable in preview mode\">\n    <img decoding=\"async\" class=\"fig-img\" height=\"317\" width=\"981\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/variable-in-preview.jpg#ZgotmplZ\" alt=\"Variable in preview mode\"\/>\n    <\/a>\n<\/div>\nThe variable value <strong>should<\/strong> match the one in the injected Custom HTML tag.\n<h4 id=\"2-add-some-consolelog-calls\">2. Add some <code>console.log()<\/code> calls<\/h4>\nAnother slightly awkward way to debug is to add <code>console.log()<\/code> calls to the Custom HTML tag. Have the variable value log into console just before you use it to verify it actually has the right value.\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\"><script><![CDATA[\n  (<span style=\"color:#00a\">function() {\n    <span style=\"color:#00a\">var log = <span style=\"color:#00a\">function(msg) {\n      <span style=\"color:#00a\">if ({{Debug Mode}}) {\n        console.log(msg);\n      }\n    };\n\n    log({{Some Variable}});\n    <span style=\"color:#0aa\">window.someFunction({{Some Variable}});\n  })();\n<<span style=\"color:#f00;background-color:#faa\">\/script>\n]]><\/script><\/code><\/pre>\n<\/div>\n<p>In the code sample above, there is a global method <code>window.someFunction<\/code> to which we want to pass the variable <code>{{Some Variable}}<\/code>. However, we are uncertain what its actual value is since Preview mode isn\u2019t very helpful.<\/p>\n<p>Because of this, we log the value of <code>{{Some Variable}}<\/code> into the <a href=\"https:\/\/support.airtable.com\/hc\/en-us\/articles\/232313848-How-to-open-the-developer-console\">browser JavaScript console<\/a>.<\/p>\n<p>Furthermore, I\u2019ve built a helper function named <code>log()<\/code> that only logs the value to console if GTM is in Preview mode. This way you avoid your tags from writing arbitrary log messages into the live browser console.<\/p>\n<h4 id=\"3-debug-the-tag-result\">3. Debug the tag <em>result<\/em><\/h4>\n<p>This is the most difficult way to debug whether or not the variable worked. Unfortunately, it\u2019s also the best way to do it.<\/p>\n<p>When you add JavaScript to a Custom HTML tag, it should <strong>do something<\/strong>. Maybe it adds some text to an HTML element, maybe it creates a new pixel or Ajax call, or perhaps it pushes something to <code>dataLayer<\/code>.<\/p>\n<p>In any case, the best way to ensure whether or not the <code>.macro()<\/code> call resolved to its correct value is to check the <strong>output<\/strong> or <strong>result<\/strong> of the tag itself to see if whatever value the variable was supposed to pass was done correctly.<\/p>\n<p>For example, let\u2019s say your tag creates a pixel request 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-html\" data-lang=\"html\">script&gt;\n  (<span style=\"color:#00a\">function<\/span>() {\n    <span style=\"color:#00a\">var<\/span> imgId = <span style=\"color:#a50\">'?id='<\/span> + {{Container ID}};\n    <span style=\"color:#00a\">var<\/span> imgUrl = <span style=\"color:#a50\">'https:\/\/www.somedomain.com\/img'<\/span> + imgId;\n    <span style=\"color:#00a\">var<\/span> el = <span style=\"color:#0aa\">document<\/span>.createElement(<span style=\"color:#a50\">'img'<\/span>);\n    el.src = imgUrl;\n    <span style=\"color:#0aa\">document<\/span>.body.appendChild(el);\n  })();\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>It\u2019s a simple, almost nonsensical example, but it should serve to highlight the debug process nicely.<\/p>\n<p>The tag creates a new image element whose URL is <code>https:\/\/www.somedomain.com\/img<\/code> plus the string <code>?id=<\/code> concatenated with whatever is returned by the <code>{{Container ID}}<\/code> variable.<\/p>\n<p>This is what it looks like in Preview mode:<\/p>\n<div style=\"aspect-ratio: 757 \/ 251;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/img-tag-macro.jpg\" title=\"IMG tag macro\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"251\" width=\"757\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/img-tag-macro.jpg#ZgotmplZ\" alt=\"IMG tag macro\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>This is what it looks like <strong>after<\/strong> injection in the Inspect Elements pane:<\/p>\n<div style=\"aspect-ratio: 1268 \/ 54;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/inspect-elements.jpg\" title=\"Inspect elements\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"54\" width=\"1268\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/inspect-elements.jpg#ZgotmplZ\" alt=\"Inspect elements\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<blockquote>\n<p><strong>Note!<\/strong> As you can see, in Inspect Elements the script element <em>still<\/em> has the <code>.macro()<\/code> call. This is how the browser works. GTM injected an element with the <code>.macro()<\/code> call and this is what was added to the page. If you remember, the script isn\u2019t executed until AFTER injection.<\/p>\n<\/blockquote>\n<p>Finally, you can inspect the <strong>Network Requests<\/strong> to find the image request with the ID in place.<\/p>\n<div style=\"aspect-ratio: 775 \/ 230;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2019\/10\/network-requests.jpg\" title=\"Network requests\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"230\" width=\"775\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2019\/10\/network-requests.jpg#ZgotmplZ\" alt=\"Network requests\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Also, because the tag did its own little injection with <code>document.body.appendChild(el)<\/code>, you can find the image element at the end of <code\/> by inspecting the elements on the page.<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>I hope this article has alleviated your concerns. If you see a call to <code>.macro()<\/code> in Google Tag Manager\u2019s Preview mode, <strong>don\u2019t worry<\/strong>. It\u2019s what you\u2019re <em>supposed<\/em> to see.<\/p>\n<p>GTM will not resolve variables until the Custom HTML tag has been injected at the end of <code\/> and the browser has begun to render any JavaScript between <code><script\/><\/code> and <code\/> within the Custom HTML tag.<\/p>\n<p>The main exception is variables cast into strings, which Google Tag Manager will <em>have<\/em> to resolve before injection or else it will end up casting the function expression itself into a string which is not helpful.<\/p>\n<p>Hopefully this article is helpful in offering you a number of ways you can debug those pesky <code>.macro()<\/code> calls just to be sure that things are working as they should.<\/p>\n<p>Let me know if you\u2019ve run into edge cases where it still doesn\u2019t work, or if you have other examples in addition to cast strings where GTM resolves the variable in Preview mode.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>When previewing Custom HTML tags in Google Tag Manager you\u2019ve almost certainly run into a situation where the GTM variable shows up as a weird JavaScript method resembling something like this: google_tag_manager[&#8220;GTM-ABCD123&#8221;].macro(15) And this is when you were expecting it to show the actual, resolved value! It doesn\u2019t help that every now and then the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":93468,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[1254,834,14492,13834,33546,5220,1725],"dealstore":[],"offerexpiration":[],"class_list":["post-93467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-call","tag-custom","tag-gtmtips","tag-html","tag-macro","tag-mysterious","tag-tags"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>#GTMTips: The Mysterious .macro() Call In Custom HTML Tags - 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=93467\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"When previewing Custom HTML tags in Google Tag Manager you\u2019ve almost certainly run into a situation where the GTM variable shows up as a weird JavaScript method resembling something like this: google_tag_manager[&quot;GTM-ABCD123&quot;].macro(15) And this is when you were expecting it to show the actual, resolved value! It doesn\u2019t help that every now and then the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=93467\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-17T11:04:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=93467#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=93467\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags\",\"datePublished\":\"2025-02-17T11:04:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=93467\"},\"wordCount\":1213,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=93467#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg\",\"keywords\":[\"Call\",\"Custom\",\"GTMTips\",\"HTML\",\"Macro\",\"mysterious\",\"TAGS\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=93467#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=93467\",\"url\":\"https:\/\/fivemor.com\/?p=93467\",\"name\":\"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=93467#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=93467#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg\",\"datePublished\":\"2025-02-17T11:04:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=93467#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=93467\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=93467#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=93467#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags\"}]},{\"@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: The Mysterious .macro() Call In Custom HTML Tags - 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=93467","og_locale":"en_US","og_type":"article","og_title":"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags - Som2ny Network","og_description":"When previewing Custom HTML tags in Google Tag Manager you\u2019ve almost certainly run into a situation where the GTM variable shows up as a weird JavaScript method resembling something like this: google_tag_manager[\"GTM-ABCD123\"].macro(15) And this is when you were expecting it to show the actual, resolved value! It doesn\u2019t help that every now and then the [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=93467","og_site_name":"Som2ny Network","article_published_time":"2025-02-17T11:04:03+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=93467#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=93467"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags","datePublished":"2025-02-17T11:04:03+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=93467"},"wordCount":1213,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=93467#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg","keywords":["Call","Custom","GTMTips","HTML","Macro","mysterious","TAGS"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=93467#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=93467","url":"https:\/\/fivemor.com\/?p=93467","name":"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=93467#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=93467#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg","datePublished":"2025-02-17T11:04:03+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=93467#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=93467"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=93467#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/macro-call-custom-html-tag.jpg","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=93467#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"#GTMTips: The Mysterious .macro() Call In Custom HTML Tags"}]},{"@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\/93467","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=93467"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/93467\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/93468"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93467"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=93467"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=93467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}