{"id":91556,"date":"2025-02-16T11:29:44","date_gmt":"2025-02-16T11:29:44","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/the-custom-html-tag-guide-for-google-tag-manager\/"},"modified":"2025-02-16T11:29:44","modified_gmt":"2025-02-16T11:29:44","slug":"the-custom-html-tag-guide-for-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=91556","title":{"rendered":"The Custom HTML Tag Guide For Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div> and passed for injection.<\/p>\n<li>Upon injection, each element is added as the last child of the <code>document.body<\/code> element.<\/li>\n<p>There are some nuances to this process, such as how Google Tag Manager handles the <code>onHtmlSuccess<\/code> and <code>onHtmlFailure<\/code> callbacks in <a href=\"https:\/\/www.simoahava.com\/analytics\/understanding-tag-sequencing-in-google-tag-manager\/\">tag sequencing<\/a>, and how <code><script\/><\/code> elements are stripped of all custom attributes before injection. But overall, this is the process.<\/p>\n<p>Now, what this essentially means is that anything you type into a Custom HTML tag is added to the end of <code>body<\/code>, whatever that is at the time of injection. Typically, this translates to: <strong>\u201cThe bottom of the page\u201d<\/strong>, but this is not a given with today\u2019s fluid layouts.<\/p>\n<div style=\"aspect-ratio: 720 \/ 302;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/injected-code.jpg\" title=\"Injected elements\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"302\" width=\"720\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/injected-code.jpg#ZgotmplZ\" alt=\"Injected elements\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>One <strong>extremely important<\/strong> thing to keep in mind is that when you add a new element to the page you force a <strong>reflow<\/strong> of the content. Basically, the browser has to calculate again dimensions, positioning, layouts, and attributes of elements preceding, surrounding, and nested within the injected element.<\/p>\n<p>This is not a painless operation. Each element you add compounds to the problem, and on <strong>single-page apps<\/strong> which might not reset the DOM between transitions, you could end up with hundreds of injected elements on the page, each hurting the performance in exponential increments.<\/p>\n<p>We\u2019ll get to this in the summary, but just to foreshadow the conclusion:<\/p>\n<p><strong>Avoid using Custom HTML tags unless it\u2019s absolutely necessary<\/strong>.<\/p>\n<p>Yes, I do recognize the irony of such a disclaimer on this particular article.<\/p>\n<p>Why use Custom HTML tags? Why use a tag management solution for element injection?<\/p>\n<p>Great question! And one I don\u2019t have a hard-and-fast answer for. I\u2019d say an abundance of Custom HTML tags in a container is symptomatic of one (or more) of the following things:<\/p>\n<ol>\n<li>You have use cases <strong>far too complicated<\/strong> for GTM\u2019s native tags or <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-templates-guide-for-google-tag-manager\/\">custom templates<\/a> to handle.<\/li>\n<li>You have <strong>too little knowledge<\/strong> about GTM (or JavaScript) to know that some of your custom HTML tags could be replaced with native tags or custom templates.<\/li>\n<li>You have an <strong>inflexible organization<\/strong>, where getting the web developers to add your customizations directly to the page templates (or other site code) is not an option.<\/li>\n<li>You\u2019ve found a <strong>cool thing<\/strong> online, and you want to quickly proof-of-concept it before passing it to the web developers for proper implementation.<\/li>\n<li>You are <strong>drunk with power<\/strong> over what you can do on your site with Google Tag Manager, and no bald dude from Finland is going to stop you from doing it.<\/li>\n<\/ol>\n<p>It\u2019s your container &#8211; you are of course free to use it however you wish. But if scenarios (2) and (3) ring a bell, I strongly urge you to seek change to the status quo. Being ignorant about the intricacies of GTM and JavaScript can be counter-productive to the beneficial effects that these technologies enable. Similarly, working against the constraints set by your organization will cause more friction in the long run, and can lead to inflamed communication structures, a crappy site, and unstable data collection.<\/p>\n<p>Having said all that, let\u2019s explore some of the scenarios where you might be tempted to use a Custom HTML tag!<\/p>\n<h3 id=\"adding-an-element-to-a-particular-position-on-the-page\">Adding an element to a particular position on the page<\/h3>\n<p>The downside of the Custom HTML tag is that it injects the element to the end of <code\/>. But what use is that? If the element is a visual component (something that should be shown on the screen), then most likely the end of <code\/> is <strong>not<\/strong> where you want it to end up in.<\/p>\n<p>To rectify this, you need to use <strong>JavaScript<\/strong> and its <a href=\"https:\/\/www.w3schools.com\/js\/js_htmldom_nodes.asp\">DOM manipulation methods<\/a>.<\/p>\n<p>The trick is to find some element that\u2019s <em>already<\/em> on the page, and then position the new element <em>relative<\/em> to that.<\/p>\n<p>For example, let\u2019s say I want to add a little <em>subtitle<\/em> to this current page, so that it ends up looking like this:<\/p>\n<div style=\"aspect-ratio: 931 \/ 219;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/subtitle.jpg\" title=\"Subtitle example\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"219\" width=\"931\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/subtitle.jpg#ZgotmplZ\" alt=\"Subtitle example\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now, if I created a Custom HTML tag with just 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\">h3&gt;It's really cool - I promise!<span style=\"color:#1e90ff;font-weight:bold\">h3<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>The element would be added to the end of <code\/> and wouldn\u2019t look very good.<\/p>\n<p>So, instead, I need to <strong>create a new element with JavaScript<\/strong>, and then <strong>position this new element relative to the title of the page<\/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-html\" data-lang=\"html\">script&gt;\n  (<span style=\"color:#00a\">function<\/span>() {\n    <span style=\"color:#aaa;font-style:italic\">\/\/ Create a new H3 element\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>    <span style=\"color:#00a\">var<\/span> h3 = <span style=\"color:#0aa\">document<\/span>.createElement(<span style=\"color:#a50\">'h3'<\/span>);\n    \n    <span style=\"color:#aaa;font-style:italic\">\/\/ Add the text content\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>    h3.innerText = <span style=\"color:#a50\">\"It's really cool - I promise!\"<\/span>;\n    \n    <span style=\"color:#aaa;font-style:italic\">\/\/ Get the reference to the current heading\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>    <span style=\"color:#00a\">var<\/span> title = <span style=\"color:#0aa\">document<\/span>.querySelector(<span style=\"color:#a50\">'h1'<\/span>);\n    \n    <span style=\"color:#aaa;font-style:italic\">\/\/ Inject the new element right after the H1\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>    <span style=\"color:#00a\">if<\/span> (title) {\n      title.parentElement.insertBefore(h3, title.nextSibling);\n    }\n  })();\n<span style=\"color:#1e90ff;font-weight:bold\">script<\/span>&gt;<\/code><\/pre>\n<\/div>\n<p>The end result? You can see it in the screenshot above.<\/p>\n<p>There\u2019s a subtle irony here &#8211; you are using Custom HTML tag to <strong>create an element<\/strong> (the <code><script\/><\/code>) that <strong>creates an element<\/strong> (the <code><\/p>\n<h3\/><\/code>). Yes, it would be cool if you could specify in a Custom HTML tag to where the element is inserted. Actually, it would be even cooler if there were a <strong>custom template<\/strong> that allows you to create elements with positioning options. That way you wouldn\u2019t need the invasive end-of-body script injection at all!<\/p>\n<p>But I digress.<\/p>\n<h3 id=\"adding-a-script-as-high-up-in-ltheadgt-as-possible\">Adding a script \u201cas high up\u201d in  as possible<\/h3>\n<p>This is somewhat related to the previous scenario, but it deserves its own treatment because of how often the scenario emerges.<\/p>\n<p>Sometimes, a vendor instructs you to <strong>\u201cPlace our script as HIGH UP in <code\/> as possible\u201d<\/strong>.<\/p>\n<p>This is instructed because the vendor wants their script to fire <strong>as soon as possible<\/strong> on the page. The higher an element in <code\/>, the sooner the browser parses it as part of the page render.<\/p>\n<div style=\"aspect-ratio: 756 \/ 440;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/script-in-head.jpg\" title=\"Fire script in head\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"440\" width=\"756\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/script-in-head.jpg#ZgotmplZ\" alt=\"Fire script in head\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>However, this benefit is largely <strong>lost<\/strong> when using Google Tag Manager. When the Google Tag Manager library has loaded, it\u2019s typical that the parsing of <code\/> has already finished, and the browser is well into rendering the <code\/>. Because of this, trying to inject a script as high up in <code\/> as possible doesn\u2019t make any sense, and is actually <strong>detrimental<\/strong> to the intended end result.<\/p>\n<p>Why? Because when you create a Custom HTML tag that then creates an element and injects it into <code\/>, the browser first needs to inject the Custom HTML tag (performance hit), and then it needs to create the new element (another performance hit), and finally it needs to inject the new element into <code\/> (performance hit).<\/p>\n<div style=\"aspect-ratio: 659 \/ 263;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/script-injection.jpg\" title=\"Proper script injection\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"263\" width=\"659\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/script-injection.jpg#ZgotmplZ\" alt=\"Proper script injection\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Instead &#8211; all you need to do is add the <code><script\/><\/code> directly to the Custom HTML tag. This way it will get inserted to the end of <code\/>, and the browser will execute it as soon as possible.<\/p>\n<h3 id=\"load-vendor-javascript\">Load vendor JavaScript<\/h3>\n<p>In fact, let\u2019s continue the thought experiment from the previous scenario. Let\u2019s say you <strong>do<\/strong> have a vendor whose JavaScript you want to load on the site, and you\u2019ve established that all you need to do is add the <code><script\/><\/code> element to the page with a Custom HTML tag.<\/p>\n<p>My friend. <strong>Do not use a Custom HTML tag at all<\/strong>.<\/p>\n<p>Instead, create a <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-templates-guide-for-google-tag-manager\/#tag-template-walkthrough\">custom tag template<\/a> that uses the <a href=\"https:\/\/developers.google.com\/tag-manager\/templates\/api#injectscript\"><code>injectScript<\/code> API<\/a> to load the library.<\/p>\n<p>Custom templates are optimized to inject and load the JavaScript, and they introduce a <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-templates-guide-for-google-tag-manager\/#permissions\">permissions<\/a> and <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-templates-guide-for-google-tag-manager\/#policies\">policies<\/a> model for safe(r) injection.<\/p>\n<div style=\"aspect-ratio: 806 \/ 246;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/custom-template-injection.jpg\" title=\"Custom Template injection\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"246\" width=\"806\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/custom-template-injection.jpg#ZgotmplZ\" alt=\"Custom Template injection\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Going forward, this will be the best way to proceed with <code><script\/><\/code> injection. It won\u2019t help you with some of the other scenarios, as the JavaScript sandbox of templates is extremely restricting. So if you want to add <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-event-listeners-gtm\/\">custom event listeners<\/a>, for example, you\u2019ll still need ye olde Custom HTML tag.<\/p>\n<h3 id=\"modify-user-experience\">Modify user experience<\/h3>\n<p>One of the things you might be tempted to do with Google Tag Manager\u2019s Custom HTML tags is <strong>modify the user experience<\/strong>. This could be adding something like a <strong>cookie banner<\/strong>, or maybe editing the <strong>styles<\/strong> on the page, or perhaps adding an <strong><code><iframe><\/iframe><\/code><\/strong> that loads some fancy widget to your ecommerce site.<\/p>\n<p>I\u2019d like to warn you of the perils of doing these things with Google Tag Manager.<\/p>\n<div style=\"aspect-ratio: 702 \/ 284;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/consent-popup-gtm.jpg\" title=\"Consent pop-up Google Tag Manager\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"284\" width=\"702\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/consent-popup-gtm.jpg#ZgotmplZ\" alt=\"Consent pop-up Google Tag Manager\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>First of all, <strong>Google Tag Manager<\/strong> can be blocked by browsers (e.g. <a href=\"https:\/\/www.brave.com\/\">Brave<\/a>) and by ad\/content blockers. This is a rising trend (with browsers\u2019 <a href=\"https:\/\/www.cookiestatus.com\">tracking protections<\/a> reducing the need for separate ad blockers).<\/p>\n<p>The second reason is that you are separating functionality and\/or experience from the site itself. You\u2019re most likely relying on the positioning and selection of specific HTML elements to anchor your custom code. However, Google Tag Manager is <em>decoupled<\/em> from your site builds, and it\u2019s extremely perilous to <em>assume<\/em> that the site will stay unchanged.<\/p>\n<p>Thus, if even a single selector in your <code>querySelector()<\/code> argument changes on the site, your custom-built code can stop working or, even worse, break something else on the site.<\/p>\n<p>On top of these are the reasons related to performance that I\u2019ve mentioned earlier in this article. Each dynamic element injection will exponentially degrade the page performance, leading to annoying things like your custom elements flickering in and out, to degraded data quality (when an iframe you dynamically modify has time to load before you make the changes), all the way to page-stuttering, user-experience-decimating slowness, especially on single-page apps.<\/p>\n<p>So, please, do consider <strong>not<\/strong> using Google Tag Manager as a content management system.<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>This was a brief foray into the magical world of Custom HTML tags.<\/p>\n<p>If I could talk to the 2012 me, I would tell him to start considering the downsides of Custom HTML tags sooner, and stop getting drunk on Google Tag Manager\u2019s infinite capability for script injection and rather think about the whole organization, the whole site, and the whole context of the environment where GTM runs, before making hazardous decisions <em>just because<\/em>.<\/p>\n<p>That being said, Custom HTML tags do have their use cases today. In fact, creating a click listener with a Custom HTML tag (<code>document.addEventListener()<\/code>) can actually be <strong>better<\/strong> than firing some custom code with Google Tag Manager\u2019s click triggers.<\/p>\n<div style=\"aspect-ratio: 756 \/ 161;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2020\/01\/click-listener.jpg\" title=\"Click listener\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"161\" width=\"756\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2020\/01\/click-listener.jpg#ZgotmplZ\" alt=\"Click listener\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>This is because a click trigger would fire the tag again and again (injecting it again and again) whenever the click trigger is a success. Whereas if you create your own little click listener in a Custom HTML tag and handle the repetitive task in the callback, you\u2019ll avoid the injection mayhem.<\/p>\n<p>I also strongly vouch for the usefulness of Custom HTML tags for building proof-of-concepts. You can quickly try out different experiences and designs, and you can publish the changes for a sample of your visitors. If you\u2019re happy with the results, you can then propose these changes to be added to the site code proper.<\/p>\n<p>Nevertheless, perhaps one day, I hope, <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-templates-guide-for-google-tag-manager\/\">custom templates<\/a> will make Custom HTML tags obsolete.<\/p>\n<p>As parting words, when using Custom HTML tags <em>especially<\/em> to inject code you\u2019ve found online, a famous Russian proverb is not out of place:<\/p>\n<p><strong>Trust, but verify<\/strong>.<\/p>\n<p>If you don\u2019t understand what the code does, consult your friendly local web developer and ask them.<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>and passed for injection. Upon injection, each element is added as the last child of the document.body element. There are some nuances to this process, such as how Google Tag Manager handles the onHtmlSuccess and onHtmlFailure callbacks in tag sequencing, and how elements are stripped of all custom attributes before injection. But overall, this is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":91557,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[834,1531,2059,13834,14495,1791],"dealstore":[],"offerexpiration":[],"class_list":["post-91556","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-custom","tag-google","tag-guide","tag-html","tag-manager","tag-tag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Custom HTML Tag Guide For 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=91556\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Custom HTML Tag Guide For Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"and passed for injection. Upon injection, each element is added as the last child of the document.body element. There are some nuances to this process, such as how Google Tag Manager handles the onHtmlSuccess and onHtmlFailure callbacks in tag sequencing, and how elements are stripped of all custom attributes before injection. But overall, this is [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=91556\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-16T11:29:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2132\" \/>\n\t<meta property=\"og:image:height\" content=\"894\" \/>\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=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=91556#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=91556\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"The Custom HTML Tag Guide For Google Tag Manager\",\"datePublished\":\"2025-02-16T11:29:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=91556\"},\"wordCount\":1381,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=91556#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg\",\"keywords\":[\"Custom\",\"Google\",\"Guide\",\"HTML\",\"Manager\",\"TAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=91556#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=91556\",\"url\":\"https:\/\/fivemor.com\/?p=91556\",\"name\":\"The Custom HTML Tag Guide For Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=91556#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=91556#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg\",\"datePublished\":\"2025-02-16T11:29:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=91556#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=91556\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=91556#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg\",\"width\":2132,\"height\":894},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=91556#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Custom HTML Tag Guide For 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":"The Custom HTML Tag Guide For 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=91556","og_locale":"en_US","og_type":"article","og_title":"The Custom HTML Tag Guide For Google Tag Manager - Som2ny Network","og_description":"and passed for injection. Upon injection, each element is added as the last child of the document.body element. There are some nuances to this process, such as how Google Tag Manager handles the onHtmlSuccess and onHtmlFailure callbacks in tag sequencing, and how elements are stripped of all custom attributes before injection. But overall, this is [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=91556","og_site_name":"Som2ny Network","article_published_time":"2025-02-16T11:29:44+00:00","og_image":[{"width":2132,"height":894,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=91556#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=91556"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"The Custom HTML Tag Guide For Google Tag Manager","datePublished":"2025-02-16T11:29:44+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=91556"},"wordCount":1381,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=91556#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg","keywords":["Custom","Google","Guide","HTML","Manager","TAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=91556#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=91556","url":"https:\/\/fivemor.com\/?p=91556","name":"The Custom HTML Tag Guide For Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=91556#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=91556#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg","datePublished":"2025-02-16T11:29:44+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=91556#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=91556"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=91556#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/custom-html-tag-guide.jpg","width":2132,"height":894},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=91556#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"The Custom HTML Tag Guide For 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\/91556","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=91556"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/91556\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/91557"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91556"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=91556"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=91556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}