{"id":63728,"date":"2025-02-02T06:11:56","date_gmt":"2025-02-02T06:11:56","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/asynchronous-variables-in-server-side-google-tag-manager\/"},"modified":"2025-02-02T06:11:56","modified_gmt":"2025-02-02T06:11:56","slug":"asynchronous-variables-in-server-side-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=63728","title":{"rendered":"Asynchronous Variables In Server-side Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>OK, that\u2019s one unappealing title for a blog post, but rest assured that the content more than makes up for this obscurity.<\/p>\n<p>Recently, my favorite toy in the world, <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\">Google Tag Manager\u2019s server container<\/a>, introduced the capability to handle <strong>asynchronous operations<\/strong> in variables.<\/p>\n<p>This is done through a JavaScript interface known as <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Promise\">Promise<\/a>. A <strong>Promise<\/strong> is a way to run code in JavaScript without knowing what its eventual value will be. The \u201cpromise\u201d part of this concept means that the code <em>promises<\/em> that it will reach a value eventually, so other code that relies on this value can execute accordingly.<\/p>\n<p>In this recent update, <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/api\">server-side tagging APIs<\/a> have been updated to handle Promises.<\/p>\n<p>What this means <strong>in practice<\/strong>, is that you can attach a variable to a tag, have that variable return a Promise of <strong>completing an asynchronous operation<\/strong>, and the tag will <strong>automatically wait<\/strong> for the Promise to resolve before completing its work.<\/p>\n<div style=\"aspect-ratio: 4790 \/ 2252;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2022\/02\/asynchronous-variables-server-side-gtm.jpg\" title=\"Asynchronous variables in server-side Google Tag Manager\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"2252\" width=\"4790\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2022\/02\/asynchronous-variables-server-side-gtm.jpg#ZgotmplZ\" alt=\"Asynchronous variables in server-side Google Tag Manager\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>And so what, I hear you ask? You can finally <strong>enrich data streams that pass through a Server container<\/strong> without having to create custom Clients and Tags for it!<\/p>\n<blockquote>\n<p>Just note that everything we go through in this article implicitly requires you to utilize or build <a href=\"https:\/\/www.simoahava.com\/analytics\/custom-templates-guide-for-google-tag-manager\/\">custom templates<\/a>, as server-side Google Tag Manager doesn\u2019t have a \u201cCustom JavaScript variable\u201d option to run ad hoc code with.<\/p>\n<\/blockquote>\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=\"whats-changed\">What\u2019s changed<\/h2>\n<p>Previously, variables in Google Tag Manager were processed <strong>synchronously<\/strong>.<\/p>\n<p>This meant that when the GTM runtime started parsing a variable, it executed it row by row until it reached a <code>return<\/code> statement in the execution context. That value was then returned to whatever source invoked the variable in the first place.<\/p>\n<p>If the variable tried to run an <strong>asynchronous<\/strong> operation, meaning it did something that would <em>eventually<\/em> return a value but not when the variable was synchronously executed, the variable would just return an <code>undefined<\/code> value because GTM wouldn\u2019t wait around for the variable to complete.<\/p>\n<div style=\"aspect-ratio: 1752 \/ 772;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2022\/02\/ga4-async-tag.jpg\" title=\"Asynchronous tag\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"772\" width=\"1752\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2022\/02\/ga4-async-tag.jpg#ZgotmplZ\" alt=\"Asynchronous tag\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>With this change, variables can now return a <strong>Promise<\/strong>, which the runtime code then waits to resolve before proceeding. In other words, the variable doesn\u2019t have to resolve to a value immediately \u2013 it can return a solemn promise that it will eventually reach a value (of course within a given <strong>timeout<\/strong>).<\/p>\n<p>And why is this a big deal? Because until now, if you wanted to have your <strong>tags<\/strong> and <strong>Clients<\/strong> wait for some asynchronous operation, you had to embed these asynchronous calls into the tag \/ Client code itself.<\/p>\n<p>Now all you have to do is make sure the variable returns a Promise, and whatever called the variable will dutifully wait for that Promise to be either resolved or rejected.<\/p>\n<h2 id=\"how-to-work-with-promises\">How to work with Promises<\/h2>\n<p>Luckily, you don\u2019t have to worry about the Promise interface itself.<\/p>\n<p>Although you <em>can<\/em> use the new <code>Promise<\/code> API to create custom Promises, and the more hard-core programmers out there can certainly make use of <code>Promise.all<\/code> to chain together multiple Promises, many built-in server-side tagging APIs have been automatically updated to utilize the Promise interface.<\/p>\n<p>Here\u2019s an example of using <code>Promise.all<\/code> in a variable template:<\/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:#aaa;font-style:italic\">\/\/ Run multiple API calls and return a single Promise that's resolved when all the API calls have resolved\n<\/span><span style=\"color:#aaa;font-style:italic\"\/><span style=\"color:#00a\">const<\/span> <span style=\"color:#0aa\">Promise<\/span> = require(<span style=\"color:#a50\">'Promise'<\/span>);\n<span style=\"color:#00a\">const<\/span> sendHttpRequest = require(<span style=\"color:#a50\">'sendHttpRequest'<\/span>);\n\n<span style=\"color:#00a\">return<\/span> <span style=\"color:#0aa\">Promise<\/span>.all([\n  sendHttpRequest(FIRST_API_URL, FIRST_API_OPTIONS), \n  sendHttpRequest(SECOND_API_URL, SECOND_API_OPTIONS)\n]).then(results =&gt; {\n  <span style=\"color:#aaa;font-style:italic\">\/\/ results will equal [{statusCode: 200, headers: {}, body: ...}, {statusCode: 200, headers: {}, body: ...}];\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">if<\/span> (results.filter(result =&gt; result.statusCode === <span style=\"color:#099\">200<\/span>).length === <span style=\"color:#099\">2<\/span>) {\n    <span style=\"color:#00a\">return<\/span> <span style=\"color:#a50\">\"Both API calls executed successfully!\"<\/span>;\n  } <span style=\"color:#00a\">else<\/span> {\n    <span style=\"color:#00a\">return<\/span> <span style=\"color:#a50\">\"Oops, something went wrong!\"<\/span>;\n  }\n});\n<\/code><\/pre>\n<\/div>\n<h2 id=\"how-existing-apis-have-changed\">How existing APIs have changed<\/h2>\n<p>The <code>BigQuery<\/code>, <code>sendHttpGet<\/code>, and <code>sendHttpRequest<\/code> APIs (<em>and the new <a href=\"https:\/\/www.simoahava.com\/analytics\/enrich-server-side-data-with-cloud-firestore\/\">Firestore API<\/a>!<\/em>) are likely to be the ones you\u2019ll be using most in this new context. They let you run asynchronous HTTP requests to endpoints (such as your enrichment API), and the response can be then used to enrich your tags\u2019 and Clients\u2019 data streams.<\/p>\n<p>To work with them, you just need to utilize the new Promise-friendly syntax. If you\u2019re running this in a variable, remember that the variable needs to <strong>return the Promise<\/strong>. The actual return value will be set to what the <strong>Promise instance methods ultimately return<\/strong>.<\/p>\n<blockquote>\n<p><strong>Promises timeout after 5 seconds<\/strong> if neither resolved nor rejected. If the API has its own timeout set (such as the <code>sendHttpRequest<\/code>), then that will be honored instead.<\/p>\n<\/blockquote>\n<p>Here\u2019s an example of how you would approach a simple GET request. This API polls the <a href=\"https:\/\/api.circle.so\/#intro\">Circle.so public API<\/a> and returns the number of members in the community the authentication token is created for.<\/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\">const<\/span> sendHttpRequest = require(<span style=\"color:#a50\">'sendHttpRequest'<\/span>);\n<span style=\"color:#00a\">const<\/span> JSON = require(<span style=\"color:#a50\">'JSON'<\/span>);\n\n<span style=\"color:#00a\">const<\/span> AUTH_TOKEN = <span style=\"color:#a50\">'XXXXXXXXXXXXX'<\/span>;\n<span style=\"color:#00a\">const<\/span> API_URL = <span style=\"color:#a50\">'https:\/\/app.circle.so\/api\/v1\/community_members'<\/span>;\n<span style=\"color:#00a\">const<\/span> OPTIONS = {\n  headers: {Authorization: <span style=\"color:#a50\">'Token '<\/span> + AUTH_TOKEN},\n  method: <span style=\"color:#a50\">'GET'<\/span>,\n  timeout: <span style=\"color:#099\">2000<\/span>\n};\n\n<span style=\"color:#aaa;font-style:italic\">\/\/ Return the Promise\n<\/span><span style=\"color:#aaa;font-style:italic\"\/><span style=\"color:#00a\">return<\/span> sendHttpRequest(API_URL, OPTIONS).then(success_result =&gt; {\n  <span style=\"color:#00a\">const<\/span> members = JSON.parse(success_result.body);\n  \n  <span style=\"color:#aaa;font-style:italic\">\/\/ When the Promise resolves (successfully), the length of the array in the response body is returned\n<\/span><span style=\"color:#aaa;font-style:italic\"\/>  <span style=\"color:#00a\">return<\/span> members.length;\n});\n<\/code><\/pre>\n<\/div>\n<p>Promises have <strong>three<\/strong> methods:<\/p>\n<ul>\n<li><code>.then()<\/code> takes two functions as parameters (above I only use the first one, though). The first is for what happens when the Promise is resolved successfully, and the second is for what happens when the Promise is rejected.<\/li>\n<li><code>.catch()<\/code> takes a single function as a parameter, and it\u2019s executed if the Promise is rejected. This is a handy way to isolate code only for error resolution.<\/li>\n<li><code>.finally()<\/code> takes a single function as a parameter, and it\u2019s <strong>always<\/strong> executed whether the Promise was resolved or rejected.<\/li>\n<\/ul>\n<p>So in the example above, I\u2019m only focused on <strong>successful resolution<\/strong>, but I could just as well add a <code>.catch()<\/code> step there to handle issues. However, as this is a simple GET request, I don\u2019t see any reason to specifically treat error cases, so I\u2019m OK with the variable returning <code>undefined<\/code> in case it runs into an error.<\/p>\n<h2 id=\"caching\">Caching<\/h2>\n<p>To prevent the same API call from being made over and over again, there\u2019s a <strong>caching<\/strong> mechanism in place. The cache is scoped to the incoming request, so once a new request comes in to the Server container, the cache is reset.<\/p>\n<p>The cache only works if the response is <strong>cacheable<\/strong>. In other words, the cache isn\u2019t <em>forced<\/em> on resources that should not be cached.<\/p>\n<p>If you want to add additional caching with more control, you can utilize the <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/api#templatedatastorage\"><code>templateDataStorage<\/code> API<\/a> for this.<\/p>\n<p>Remember that all outgoing requests are considered <strong>network egress<\/strong> traffic by the cloud service, and you will need to pay for that network usage. Thus caching is a very important thing to have in place \u2013\u00a0one way or another.<\/p>\n<p>One thing that I\u2019d <em>love<\/em> to see is the option to override the Event Data object produced by the Client with these asynchronous variables. That way you could add the enrichment variables to the Event Data object itself, and they would be available to all the tags, triggers, and variables that utilize this object.<\/p>\n<blockquote>\n<p>This would sort out the caching problem completely, too, because the variable would run just once: when resolved in the Event Data object.<\/p>\n<\/blockquote>\n<h2 id=\"summary\">Summary<\/h2>\n<p>Although this has been a very technical overview, I hope you see the promise (pun intended) of this update to server-side Google Tag Manager.<\/p>\n<p><strong>Data stream enrichment<\/strong> has been one of the things I\u2019ve been harping about as a unique selling point of a server-side tag management solution, so I\u2019m really glad we <em>finally<\/em> have a handy way of doing so. It\u2019s been <strong>two years<\/strong> since server-side tagging in GTM was publicly announced, after all!<\/p>\n<p>Now, the ball is in the community\u2019s court.<\/p>\n<p><strong>Get creative with those variable templates!<\/strong><\/p>\n<p>I want to see the <a href=\"https:\/\/tagmanager.google.com\/gallery\/\">Community Gallery<\/a> <em>stuffed<\/em> with utility variables for polling different APIs, handling HTTP communications, and running asynchronous operations to enrich those Clients and tags that might benefit from them.<\/p>\n<p>What do you think about this release? Can you think of use cases where these new Promises could be particularly helpful?<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>OK, that\u2019s one unappealing title for a blog post, but rest assured that the content more than makes up for this obscurity. Recently, my favorite toy in the world, Google Tag Manager\u2019s server container, introduced the capability to handle asynchronous operations in variables. This is done through a JavaScript interface known as Promise. A Promise [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":63729,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[34758,1531,14495,18475,1791,30217],"dealstore":[],"offerexpiration":[],"class_list":["post-63728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-asynchronous","tag-google","tag-manager","tag-serverside","tag-tag","tag-variables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Asynchronous Variables In Server-side 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=63728\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Asynchronous Variables In Server-side Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"OK, that\u2019s one unappealing title for a blog post, but rest assured that the content more than makes up for this obscurity. Recently, my favorite toy in the world, Google Tag Manager\u2019s server container, introduced the capability to handle asynchronous operations in variables. This is done through a JavaScript interface known as Promise. A Promise [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=63728\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-02T06:11:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1441\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=63728#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=63728\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Asynchronous Variables In Server-side Google Tag Manager\",\"datePublished\":\"2025-02-02T06:11:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=63728\"},\"wordCount\":1203,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=63728#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg\",\"keywords\":[\"Asynchronous\",\"Google\",\"Manager\",\"Serverside\",\"TAG\",\"Variables\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=63728#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=63728\",\"url\":\"https:\/\/fivemor.com\/?p=63728\",\"name\":\"Asynchronous Variables In Server-side Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=63728#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=63728#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg\",\"datePublished\":\"2025-02-02T06:11:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=63728#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=63728\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=63728#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg\",\"width\":2560,\"height\":1441},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=63728#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Asynchronous Variables In Server-side 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":"Asynchronous Variables In Server-side 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=63728","og_locale":"en_US","og_type":"article","og_title":"Asynchronous Variables In Server-side Google Tag Manager - Som2ny Network","og_description":"OK, that\u2019s one unappealing title for a blog post, but rest assured that the content more than makes up for this obscurity. Recently, my favorite toy in the world, Google Tag Manager\u2019s server container, introduced the capability to handle asynchronous operations in variables. This is done through a JavaScript interface known as Promise. A Promise [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=63728","og_site_name":"Som2ny Network","article_published_time":"2025-02-02T06:11:56+00:00","og_image":[{"width":2560,"height":1441,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=63728#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=63728"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Asynchronous Variables In Server-side Google Tag Manager","datePublished":"2025-02-02T06:11:56+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=63728"},"wordCount":1203,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=63728#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg","keywords":["Asynchronous","Google","Manager","Serverside","TAG","Variables"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=63728#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=63728","url":"https:\/\/fivemor.com\/?p=63728","name":"Asynchronous Variables In Server-side Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=63728#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=63728#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg","datePublished":"2025-02-02T06:11:56+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=63728#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=63728"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=63728#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/02\/asynchronous-variables-in-server-side-google-tag-manager-scaled.jpg","width":2560,"height":1441},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=63728#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Asynchronous Variables In Server-side 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\/63728","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=63728"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/63728\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/63729"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=63728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=63728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=63728"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=63728"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=63728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}