{"id":48815,"date":"2025-01-26T14:56:15","date_gmt":"2025-01-26T14:56:15","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/cloud-run-with-server-side-tagging-in-google-tag-manager\/"},"modified":"2025-01-26T14:56:15","modified_gmt":"2025-01-26T14:56:15","slug":"cloud-run-with-server-side-tagging-in-google-tag-manager","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=48815","title":{"rendered":"Cloud Run With Server-side Tagging In Google Tag Manager"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p>In a recent update to <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/overview\">server-side tagging in Google Tag Manager<\/a>, Google switched the <strong>default<\/strong> deployment of a server-side tagging backend from <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/app-engine-setup\">Google App Engine<\/a> to <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/cloud-run-setup-guide\">Google Cloud Run<\/a>.<\/p>\n<p>Now, when you create a new container and choose the <strong>automatically provisioned tagging server<\/strong> option, this service will be created in Google Cloud Run instead of in Google App Engine.<\/p>\n<div style=\"aspect-ratio: 1468 \/ 712;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/cloud-run-auto-provision.jpg\" title=\"Cloud Run automatic provisioning\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"712\" width=\"1468\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/cloud-run-auto-provision.jpg#ZgotmplZ\" alt=\"Cloud Run automatic provisioning\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>While I\u2019ve written <a href=\"https:\/\/www.simoahava.com\/gtmtips\/setup-google-tag-manager-server-cloud-run\/\">about Cloud Run before<\/a>, this update gives me an opportunity to review what actually happens when you provision a Cloud Run environment, how you can upgrade it, and how you can add enhancements such as <strong>multi-region load balancing<\/strong> to it (with ease, I might add!).<\/p>\n<p><strong>If you\u2019re a student of Simmer\u2019s <a href=\"https:\/\/www.teamsimmer.com\/all-courses\/server-side-tagging-in-google-tag-manager\/\">Server-side Tagging In Google Tag Manager<\/a> online course<\/strong>, you\u2019ll be happy to know that the course content has a <em>lot<\/em> of updated content regarding the Cloud Run setup. I recommend enrolling in case you haven\u2019t yet \u2013 the course walks you through the nuts and bolts of server-side tagging in a way that a blog post could never replicate.<\/p>\n<p>For an overview of what\u2019s different between Cloud Run and App Engine, I recommend you read through my <a href=\"https:\/\/www.simoahava.com\/gtmtips\/setup-google-tag-manager-server-cloud-run\/\">original post on the topic<\/a>.<\/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=\"automatic-provisioning-of-the-tagging-server\">Automatic provisioning of the tagging server<\/h2>\n<p>When you follow the <strong>automatic provisioning steps<\/strong>, the process is very similar to what happened with App Engine.<\/p>\n<p>You\u2019ll first need to choose (or create) a <a href=\"https:\/\/cloud.google.com\/billing\/docs\/concepts\">Google Cloud Billing account<\/a>, after which Google Tag Manager will <em>automatically<\/em> run through all the build scripts in the background.<\/p>\n<div style=\"aspect-ratio: 1474 \/ 746;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/server-created.jpg\" title=\"server creation started\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"746\" width=\"1474\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/server-created.jpg#ZgotmplZ\" alt=\"server creation started\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>After a short(ish) wait, you\u2019ll be informed that a server environment has been created for you, and your server-side container has been updated with all the relevant information to immediately start working with server-side Google Tag Manager.<\/p>\n<div style=\"aspect-ratio: 1466 \/ 994;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/server-finally-created.jpg\" title=\"server creation ready\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"994\" width=\"1466\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/server-finally-created.jpg#ZgotmplZ\" alt=\"server creation ready\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>If you now follow the link to your cloud project and <a href=\"https:\/\/console.cloud.google.com\/run\">browse to the Cloud Run page<\/a>, this is what you\u2019ll see:<\/p>\n<div style=\"aspect-ratio: 2528 \/ 472;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/cloud-run-services.jpg\" title=\"Cloud Run services\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"472\" width=\"2528\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/cloud-run-services.jpg#ZgotmplZ\" alt=\"Cloud Run services\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p><strong>Two<\/strong> services have been created for you in the <strong>us-central1<\/strong> (that\u2019s in the United States) cloud region:<\/p>\n<ul>\n<li><code>server-side-tagging<\/code> \u2013 this is the <strong>tagging server<\/strong>, which collects all the traffic to your server-side endpoint.<\/li>\n<li><code>server-side-tagging-preview<\/code> \u2013 this is the <strong>preview server<\/strong> to which the tagging server forwards the requests that were collected while you were previewing the server container.<\/li>\n<\/ul>\n<p>Both of these services are running a minimal setup:<\/p>\n<ul>\n<li><strong>512 MiB<\/strong> memory<\/li>\n<li><strong>1 vCPU<\/strong> (virtual CPU)<\/li>\n<li><strong>0 minimum instances<\/strong><\/li>\n<li><strong>1 maximum instance<\/strong><\/li>\n<\/ul>\n<p>This is fine for the Preview server \u2013 you\u2019ll never need to upgrade it to something more powerful. But if you want to run the tagging server in a production-ready capacity, you\u2019ll want to edit it and <strong>deploy a new revision<\/strong> with more instances in use (more about this below).<\/p>\n<p>The <strong>memory<\/strong> and <strong>CPU<\/strong> should be fine with the default values \u2013\u00a0server-side GTM will never really require more power from the individual instances.<\/p>\n<p>Importantly, the services are set in <code>us-central1<\/code>, but unlike App Engine, you can simply <strong>copy and create new services<\/strong> in a different region, subsequently deleting these original services once the new ones are up and running (more on this below, too).<\/p>\n<p>This is one of the biggest benefits of Cloud Run vs. App Engine: you can add <em>as many tagging servers<\/em> as you like, all in different regions. You can then put all of them behind an <strong>external application load balancer<\/strong> to have the traffic automatically distributed to the tagging server closest to the visitor geographically. Yes, more on this below, too!<\/p>\n<blockquote>\n<p>My recommendation is thus to always run the automatic provisioning setup <em>even if you don\u2019t want to actually run the server in <code>us-central1<\/code><\/em>. The automatic setup generates a server template you can then copy when you want to create the server(s) with different settings. However, I\u2019ve also added instructions below on how to manually generate the servers if you don\u2019t want to or can\u2019t run through the automatic provisioning steps.<\/p>\n<\/blockquote>\n<h2 id=\"upgrade-the-tagging-server\">Upgrade the tagging server<\/h2>\n<p>Let\u2019s start with a simple step. How do you upgrade the tagging server to production-ready capacity?<\/p>\n<p>You need to click the tagging server in the list of services:<\/p>\n<div style=\"aspect-ratio: 1472 \/ 378;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/click-tagging-service.jpg\" title=\"Click tagging service\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"378\" width=\"1472\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/click-tagging-service.jpg#ZgotmplZ\" alt=\"Click tagging service\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, click <strong>Edit and deploy new revision<\/strong> to edit the service.<\/p>\n<div style=\"aspect-ratio: 1472 \/ 300;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/edit-redeploy-revision.jpg\" title=\"edit and redeploy\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"300\" width=\"1472\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/edit-redeploy-revision.jpg#ZgotmplZ\" alt=\"edit and redeploy\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now, scroll down to the <strong>Auto-scaling<\/strong> options. If you want to follow Google\u2019s recommendations, set the minimum instances to <strong>2<\/strong> and maximum to <strong>10<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1094 \/ 246;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/min-max.jpg\" title=\"auto-scaling options for cloud run instances\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"246\" width=\"1094\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/min-max.jpg#ZgotmplZ\" alt=\"auto-scaling options for cloud run instances\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<blockquote>\n<p>Having a minimum of 2 is just plain common sense to avoid things like <strong>resource exhaustion<\/strong> problems denying you of any active instances, or <strong>cold boot times<\/strong> increasing your latency unbearably. A maximum of 10 means that that\u2019s the <strong>upper limit<\/strong> of what your setup <strong>might<\/strong> scale to if <strong>enough<\/strong> traffic comes in. You\u2019ll only pay for the instances that are actually in use.<\/p>\n<\/blockquote>\n<p>Once ready, scroll all the way down and click the <strong>Deploy<\/strong> button to create a new revision and update the deployment.<\/p>\n<p>The deployment is done so that traffic is diverted to the new revision only after it\u2019s up and running. This means that there should be <strong>no downtime<\/strong> at all for your server endpoint.<\/p>\n<h3 id=\"update-the-tagging-server-version\">Update the tagging server version<\/h3>\n<p>If you ever see a notice in the Google Tag Manager user interface that there\u2019s a new version of the tagging server and you need to <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/cloud-run-setup-guide?provisioning=manual#update_the_tagging_server_version\">upgrade your deployment<\/a>, all you need to do is go through the steps above and click <strong>Deploy<\/strong> to deploy a new revision.<\/p>\n<div style=\"aspect-ratio: 1802 \/ 914;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/update-tagging-server.jpg\" title=\"Update the tagging server\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"914\" width=\"1802\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/update-tagging-server.jpg#ZgotmplZ\" alt=\"Update the tagging server\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>You don\u2019t have to make any changes, the redeployment will fetch the latest server container image version from Google\u2019s repository and update your servers with it. You need to do this for <strong>all<\/strong> the tagging servers in your setup (if you\u2019re running everything behind a load balancer).<\/p>\n<h2 id=\"copy-and-create-a-new-service\">Copy and create a new service<\/h2>\n<p>In case you want to quickly create a new <strong>tagging server<\/strong> or <strong>preview server<\/strong>, the absolutely easiest way to do so is to take an existing server (such as the one created by the automatic provisioning setup), <strong>copy<\/strong> it, and deploy it as a new service.<\/p>\n<p>To do this, select the server you want to copy from the list of Cloud Run services and hit the <strong>Copy<\/strong> button in the top bar.<\/p>\n<div style=\"aspect-ratio: 2736 \/ 624;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/copy-tagging-server.jpg\" title=\"Copy tagging server\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"624\" width=\"2736\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/copy-tagging-server.jpg#ZgotmplZ\" alt=\"Copy tagging server\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Here, make sure you update the following:<\/p>\n<ul>\n<li><strong>Service name<\/strong>: set this to a name that you haven\u2019t already used<\/li>\n<li><strong>Region<\/strong>: choose a cloud region for this server<\/li>\n<li><strong>Auto-scaling<\/strong>: choose the appropriate minimum and maximum instances for the server<\/li>\n<li><strong>Authentication<\/strong>: check <strong>Allow unauthenticated invocations<\/strong><\/li>\n<\/ul>\n<p>You can keep everything else with the default values. If you <em>do<\/em> want to make some changes, here are the ones you are probably most interested in:<\/p>\n<h3 id=\"update-the-container-configuration-string\">Update the container configuration string<\/h3>\n<p>Under <strong>Environment variables<\/strong>, you can change the value of <code>CONTAINER_CONFIG<\/code> to point to a different Server container. To find the container configuration string for any given Server container, you need to click the container ID in the top bar of the Server container.<\/p>\n<div style=\"aspect-ratio: 2172 \/ 746;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/container-configuraiton-string.jpg\" title=\"container configuration\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"746\" width=\"2172\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/container-configuraiton-string.jpg#ZgotmplZ\" alt=\"container configuration\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Set this as the value of the <code>CONTAINER_CONFIG<\/code> environment variable to have the Cloud Run server point to the correct Server container.<\/p>\n<h3 id=\"tagging-server-vs-preview-server\">Tagging server vs. Preview server<\/h3>\n<p>If you want to change a tagging server to a preview server or vice versa, you need to update the environment variables again.<\/p>\n<p>A <strong>Preview<\/strong> server needs the variable <code>RUN_AS_PREVIEW_SERVER<\/code> set to the value <code>true<\/code>. It should <em>not<\/em> have the <code>PREVIEW_SERVER_URL<\/code> variable set. This is what a Preview server configuration looks like:<\/p>\n<div style=\"aspect-ratio: 972 \/ 394;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-env.jpg\" title=\"Preview server env\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"394\" width=\"972\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-env.jpg#ZgotmplZ\" alt=\"Preview server env\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>A <strong>Tagging<\/strong> server needs the variable <code>PREVIEW_SERVER_URL<\/code> set to the Cloud Run URL of the preview server. You can find this URL by opening the Cloud Run service for the preview server, and the URL right at the top of the dashboard:<\/p>\n<div style=\"aspect-ratio: 2034 \/ 404;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-url.jpg\" title=\"Preview server URL\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"404\" width=\"2034\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-url.jpg#ZgotmplZ\" alt=\"Preview server URL\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Set this URL as the value of the environment variable, and make sure that <code>RUN_AS_PREVIEW_SERVER<\/code> is <em>not<\/em> set. This is what the environment variables for the tagging server should look like:<\/p>\n<div style=\"aspect-ratio: 982 \/ 396;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-server-env.jpg\" title=\"Tagging server env\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"396\" width=\"982\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-server-env.jpg#ZgotmplZ\" alt=\"Tagging server env\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h2 id=\"manually-create-the-servers\">Manually create the servers<\/h2>\n<p>If you didn\u2019t run through the automatic provisioning steps, you\u2019ll need to <strong>manually<\/strong> create the preview server and any tagging servers you want to associate with it.<\/p>\n<p>To do this, you need to start with the preview server.<\/p>\n<h3 id=\"create-the-preview-server\">Create the preview server<\/h3>\n<p>Go to <a href=\"https:\/\/console.cloud.google.com\/run\">Cloud Run<\/a> and click <strong>CREATE SERVICE<\/strong>.<\/p>\n<p>Set the <strong>Container image URL<\/strong> to <code>gcr.io\/cloud-tagging-10302018\/gtm-cloud-image:stable<\/code> and give the server a name. I recommend the following syntax:<\/p>\n<p><code>server-side-tagging-<geo>-preview<\/geo><\/code> where <code>geo<\/code> is the geographic region.<\/p>\n<p>On that note, choose the Cloud Region accordingly, too.<\/p>\n<blockquote>\n<p>This is just for the Preview server so not that significant. But choose whatever region makes most sense to you.<\/p>\n<\/blockquote>\n<div style=\"aspect-ratio: 1086 \/ 670;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/first-settings-preview.jpg\" title=\"First settings for preview server\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"670\" width=\"1086\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/first-settings-preview.jpg#ZgotmplZ\" alt=\"First settings for preview server\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Set CPU allocation to <strong>CPU is always allocated<\/strong>.<\/p>\n<p>Set Auto-scaling to <strong>0 minimum instances<\/strong> and <strong>1 maximum instances<\/strong>. Do <em>not<\/em> stray from these values for the Preview server or it might not work correctly!<\/p>\n<p>Keep Ingress control with <strong>All<\/strong>, and tick <strong>Allow unauthenticated invocations<\/strong> for Authentication.<\/p>\n<div style=\"aspect-ratio: 1080 \/ 1178;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/next-preview-settings.jpg\" title=\"Next preview settings\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1178\" width=\"1080\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/next-preview-settings.jpg#ZgotmplZ\" alt=\"Next preview settings\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Expand Container, Networking, Security, and set the Request timeout to <strong>60 seconds<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1104 \/ 624;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/request-timeout.jpg\" title=\"Request timeout\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"624\" width=\"1104\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/request-timeout.jpg#ZgotmplZ\" alt=\"Request timeout\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Under Environment variables, set these two variables:<\/p>\n<ol>\n<li><code>RUN_AS_PREVIEW_SERVER<\/code> set to the value <code>true<\/code><\/li>\n<li><code>CONTAINER_CONFIG<\/code> set to the value of the container configuration string from your Server container (see above)<\/li>\n<\/ol>\n<div style=\"aspect-ratio: 972 \/ 394;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-env.jpg\" title=\"Preview server env\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"394\" width=\"972\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-env.jpg#ZgotmplZ\" alt=\"Preview server env\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Under Health checks, click to <strong>Add health check<\/strong>, and set it with these settings:<\/p>\n<ol>\n<li><strong>Health check type<\/strong>: Start-up check<\/li>\n<li><strong>Probe type<\/strong>: TCP<\/li>\n<li><strong>Port<\/strong>: 8080<\/li>\n<li><strong>Initial delay<\/strong>: 0 seconds<\/li>\n<li><strong>Period<\/strong>: 240 seconds<\/li>\n<li><strong>Failure threshold<\/strong>: 1<\/li>\n<li><strong>Timeout<\/strong>: 240 seconds<\/li>\n<\/ol>\n<p>Click <strong>UPDATE<\/strong> to save the health check.<\/p>\n<div style=\"aspect-ratio: 746 \/ 350;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/health-check.jpg\" title=\"Health check\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"350\" width=\"746\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/health-check.jpg#ZgotmplZ\" alt=\"Health check\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Once done, click <strong>DEPLOY<\/strong> to deploy the service.<\/p>\n<h3 id=\"create-the-tagging-server\">Create the tagging server<\/h3>\n<p>To create the tagging server, it\u2019s really easy to do once you have the preview server in place.<\/p>\n<p>First, open the <strong>preview server<\/strong> and copy the preview server URL to someplace where you have it handy (or just have the preview server open in a different tab).<\/p>\n<div style=\"aspect-ratio: 2034 \/ 404;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-url.jpg\" title=\"Preview server URL\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"404\" width=\"2034\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/preview-server-url.jpg#ZgotmplZ\" alt=\"Preview server URL\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, choose the preview server from the list of services and click <strong>Copy<\/strong> in the Cloud Run top bar.<\/p>\n<div style=\"aspect-ratio: 1912 \/ 422;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/copy-preview-server.jpg\" title=\"Copy preview server\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"422\" width=\"1912\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/copy-preview-server.jpg#ZgotmplZ\" alt=\"Copy preview server\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Here, update the <strong>Service name<\/strong> \u2013 again, this is my recommendation:<\/p>\n<p><code>server-side-tagging-<geo\/><\/code>, where <code>geo<\/code> is the geographic region.<\/p>\n<p>Next, choose the cloud region for the server.<\/p>\n<div style=\"aspect-ratio: 1078 \/ 686;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-server-new.jpg\" title=\"Tagging server new\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"686\" width=\"1078\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-server-new.jpg#ZgotmplZ\" alt=\"Tagging server new\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Update <strong>Auto-scaling<\/strong> \u2013 if you want to just run a test deployment, keep minimum and maximum as <strong>0<\/strong> and <strong>1<\/strong> respectively, but if you want to move straight to a production-ready setup, switch to a minimum of <strong>2<\/strong> and a maximum of <strong>10<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1066 \/ 214;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/min2-max10.jpg\" title=\"minimum 2 maximum 10\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"214\" width=\"1066\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/min2-max10.jpg#ZgotmplZ\" alt=\"minimum 2 maximum 10\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Check <strong>Allow unauthenticated invocations<\/strong> and then expand <strong>Container, Networking, Security<\/strong>.<\/p>\n<p>Here, update the <strong>Environment variables<\/strong> to have the following (and nothing else):<\/p>\n<ul>\n<li><code>PREVIEW_SERVER_URL<\/code>: point this to the URL of the preview server<\/li>\n<li><code>CONTAINER_CONFIG<\/code>: point this to the Server container (it should already do so because you copied the preview server)<\/li>\n<\/ul>\n<div style=\"aspect-ratio: 982 \/ 396;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-server-env.jpg\" title=\"Tagging server env\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"396\" width=\"982\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-server-env.jpg#ZgotmplZ\" alt=\"Tagging server env\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Click <strong>CREATE<\/strong> to create the deployment.<\/p>\n<h2 id=\"map-a-custom-domain\">Map a custom domain<\/h2>\n<blockquote>\n<p><strong>IMPORTANT!<\/strong> Cloud Run Integrations have been <strong>deprecated<\/strong> and the instructions in this topic no longer apply. To map a custom domain, the best option is to use an <strong>external application load balancer<\/strong> by following <a href=\"https:\/\/cloud.google.com\/load-balancing\/docs\/https\/setup-global-ext-https-serverless\">this guide<\/a>. You can also enroll in the <a href=\"https:\/\/www.teamsimmer.com\/all-courses\/server-side-tagging-in-google-tag-manager\/\">Simmer Course<\/a>, where we cover this topic extensively.<\/p>\n<\/blockquote>\n<p>To map a custom domain <em>and<\/em> to make life easier when you want to start adding additional services behind a Load Balancer, you should use the new <strong>Custom Domains Integration<\/strong> available in Cloud Run.<\/p>\n<blockquote>\n<p>Note, at the time of writing the integration is still in \u201cPreview\u201d stage, which might mean that it can change a bit when it\u2019s released as a stable feature.<\/p>\n<\/blockquote>\n<p>You only need to create this integration <strong>once<\/strong> per service cluster you intend to use. So if you\u2019ve already created tagging servers for different geographic regions, choose just <strong>one<\/strong> of them to add this integration to.<\/p>\n<p>This integration automatically creates an <strong>external application load balancer<\/strong> for you, which you can then map your custom domain to using a single DNS A record. It\u2019s <em>much<\/em> simpler than the awkward TXT\/CNAME\/A setup you used to have to do with App Engine!<\/p>\n<p>To create the integration, open a <strong>tagging server<\/strong> of your choice and click the <strong>Integrations<\/strong> tab.<\/p>\n<div style=\"aspect-ratio: 1984 \/ 392;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/add-integration.jpg\" title=\"Add integration\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"392\" width=\"1984\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/add-integration.jpg#ZgotmplZ\" alt=\"Add integration\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Click <strong>Add integration<\/strong>, and then choose <strong>Custom domains &#8211; Google Cloud load balancing<\/strong>.<\/p>\n<div style=\"aspect-ratio: 1464 \/ 1412;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/new-custom-domain-integration.jpg\" title=\"new custom domain integration\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1412\" width=\"1464\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/new-custom-domain-integration.jpg#ZgotmplZ\" alt=\"new custom domain integration\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>If prompted to do so, make sure you <strong>enable<\/strong> any APIs that the integration requires you to enable.<\/p>\n<p>Here, you can now map <strong>one or more<\/strong> subdomains to your Cloud Run services. Choose subdomains that share the main domain name with the website(s) that will be sending traffic to the server.<\/p>\n<div style=\"aspect-ratio: 982 \/ 534;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-domain-list.jpg\" title=\"Custom domain list\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"534\" width=\"982\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-domain-list.jpg#ZgotmplZ\" alt=\"Custom domain list\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Once ready, click <strong>Submit<\/strong> to start the process. You can see the list of resources that will be automatically created for you when the process is completed.<\/p>\n<p>Shortly into the process, you should see a new box titled <strong>Connect to custom domain<\/strong> with one DNS record per domain you\u2019ve mapped to the endpoint.<\/p>\n<div style=\"aspect-ratio: 1064 \/ 514;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/dns-records.jpg\" title=\"DNS records\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"514\" width=\"1064\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/dns-records.jpg#ZgotmplZ\" alt=\"DNS records\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Add these domain records to your DNS registrar as soon as possible. The integration will attempt to provision an SSL certificate for your domains, and it won\u2019t be able to do so until the mappings are complete.<\/p>\n<p>Once you\u2019ve added the DNS records, you\u2019ll need to wait anywhere from minutes to hours to finally have the SSL certificate provisioned for your custom domain(s).<\/p>\n<p>When the DNS changes have propagated and the SSL certificate has been provisioned, you\u2019ll see this:<\/p>\n<div style=\"aspect-ratio: 1064 \/ 500;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-domains-integration-done.jpg\" title=\"Custom domains integration is complete\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"500\" width=\"1064\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-domains-integration-done.jpg#ZgotmplZ\" alt=\"Custom domains integration is complete\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Congratulations \u2013\u00a0you have now mapped your custom domains(s) to point to your tagging server. You can now update the server container URL in your Google Tag Manager Server container settings as well as in any tags and scripts that send data to your server-side endpoint.<\/p>\n<p>Next step is to expand the load balancer to include your other backends, too!<\/p>\n<h2 id=\"edit-the-load-balancer-to-include-more-tagging-servers\">Edit the load balancer to include more tagging servers<\/h2>\n<p>Once you have the load balancer in place for your custom domain, you can expand its purpose to be an <em>actual<\/em> load balancer for your tagging services.<\/p>\n<p>For example, here\u2019s an example setup of mine:<\/p>\n<div style=\"aspect-ratio: 1518 \/ 322;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-service-cluster.jpg\" title=\"Tagging service cluster\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"322\" width=\"1518\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/tagging-service-cluster.jpg#ZgotmplZ\" alt=\"Tagging service cluster\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>I have <strong>three<\/strong> tagging servers: one for the US (<code>server-side-tagging<\/code>), one for Asia (<code>server-side-tagging-as<\/code>), and one for Europe (<code>server-side-tagging-eu<\/code>).<\/p>\n<p>All three of these are mapped to a single preview server running in the US (<code>server-side-tagging-preview<\/code>).<\/p>\n<p>I\u2019ve created a <strong>custom domain integration<\/strong> for the <code>server-side-tagging<\/code> server, to which my custom domain of <strong>sgtm.teamsimmer.com<\/strong> is now pointing.<\/p>\n<div style=\"aspect-ratio: 1050 \/ 802;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-domain-integration.jpg\" title=\"Custom domain integration\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"802\" width=\"1050\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-domain-integration.jpg#ZgotmplZ\" alt=\"Custom domain integration\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>But because the load balancer is only added to the <code>server-side-tagging<\/code> service, it means that 100% of the traffic to <strong>sgtm.teamsimmer.com<\/strong> domain is routed to the <code>us-central1<\/code> server.<\/p>\n<p>I now want to include my Asia and Europe servers in the mix, too, so that visitors closer to those regions would have their traffic routed to the tagging servers geographically closer to them.<\/p>\n<p>To do that, go to <a href=\"https:\/\/console.cloud.google.com\/net-services\/loadbalancing\/list\/loadBalancers\">Load Balancing<\/a> in the Google Cloud console.<\/p>\n<div style=\"aspect-ratio: 1450 \/ 556;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/load-balancing-view.jpg\" title=\"Load balancing\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"556\" width=\"1450\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/load-balancing-view.jpg#ZgotmplZ\" alt=\"Load balancing\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<blockquote>\n<p>Your load balancer comprises a <strong>Frontend<\/strong> (the IP address your custom domain is pointing to) and a <strong>Backend<\/strong> that maps the services the load balancer should forward traffic to.<\/p>\n<\/blockquote>\n<p>Here, navigate to the <strong>Backends<\/strong> tab, because we\u2019ll need to update the existing <strong>Backend service<\/strong> to also include our two additional tagging servers.<\/p>\n<p>Click the backend service that was created by the custom domains integration.<\/p>\n<div style=\"aspect-ratio: 1184 \/ 408;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/click-backend-service.jpg\" title=\"click backend service\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"408\" width=\"1184\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/click-backend-service.jpg#ZgotmplZ\" alt=\"click backend service\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Next, click <strong>Edit<\/strong> in the top bar to edit the backend service.<\/p>\n<div style=\"aspect-ratio: 1088 \/ 420;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/backends-available.jpg\" title=\"Backends available\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"420\" width=\"1088\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/backends-available.jpg#ZgotmplZ\" alt=\"Backends available\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Here, you\u2019ll see a list of all the backends added to this service. There should be just one \u2013 a <strong>serverless network endpoint group<\/strong> pointing to the tagging server in Cloud Run where you added the custom domains integration.<\/p>\n<p>You need to add new backends \u2013 <strong>one per tagging server<\/strong> that you want to also include in the load balancer (you do <em>not<\/em> need to create a backend for the Preview server!).<\/p>\n<p>Click <strong>Add a backend<\/strong>, and in the list of <strong>Serverless network endpoint groups<\/strong> choose <strong>Create serverless network endpoint group<\/strong>.<\/p>\n<p>Give a name for the NEG, and set its <strong>Region<\/strong> to the <em>exact<\/em> same region as the Cloud Run tagging server you want to add to the balancer.<\/p>\n<div style=\"aspect-ratio: 1130 \/ 1270;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/add-neg.jpg\" title=\"Add a network endpoint group\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"1270\" width=\"1130\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/add-neg.jpg#ZgotmplZ\" alt=\"Add a network endpoint group\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Once you\u2019ve chosen the region, choose <strong>Cloud Run<\/strong> as the NEG type, and then select the tagging server from the list of available Cloud Run services. Click <strong>Create<\/strong> when ready.<\/p>\n<p>Do this for all the tagging servers you want to add to the load balancer. Once ready, you should see something like this:<\/p>\n<div style=\"aspect-ratio: 1070 \/ 578;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/all-backends-added.jpg\" title=\"All backends have been added\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"578\" width=\"1070\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/all-backends-added.jpg#ZgotmplZ\" alt=\"All backends have been added\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Now, scroll down and check <strong>Enable logging<\/strong>. It\u2019s a good idea to have the load balancer log requests. It\u2019s a useful feature, because it lets you monitor traffic through the backends.<\/p>\n<p>If you wish, you can also have the load balancer <strong>automatically geolocate<\/strong> the user and add this information as custom request headers to all HTTP requests that go through the load balancer. This would mimic <a href=\"https:\/\/www.simoahava.com\/gtm-tips\/utilize-app-engine-headers-server-side-tagging\/\">how App Engine automatically geolocates<\/a> the user, too.<\/p>\n<p>To do this, scroll down the <strong>backend service<\/strong> settings, expand <strong>Advanced configurations<\/strong>, and find <strong>Custom request headers<\/strong>. Add <em>at least<\/em> these two:<\/p>\n<p><code>X-Gclb-Country<\/code>: <code>{client_region}<\/code><br \/>\n<code>X-Gclb-Region<\/code>: <code>{client_region_subdivision}<\/code><\/p>\n<p>These headers are required if you want to support <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/enable-region-specific-settings\">region-specific behavior<\/a> in your Server container for Google tags.<\/p>\n<div style=\"aspect-ratio: 986 \/ 356;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-request-headers.jpg\" title=\"Custom request headers\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"356\" width=\"986\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/custom-request-headers.jpg#ZgotmplZ\" alt=\"Custom request headers\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>For additional request headers you might find useful, check out <a href=\"https:\/\/cloud.google.com\/load-balancing\/docs\/https\/custom-headers#variables\">this list<\/a>.<\/p>\n<p>Once you are ready, click <strong>Update<\/strong> to update the backend.<\/p>\n<p>If you now go back to the <strong>Load balancers<\/strong> tab, you should see your load balancer pointing to <strong>3 network endpoint groups<\/strong> (or however many tagging servers you added to the backend service).<\/p>\n<div style=\"aspect-ratio: 2430 \/ 294;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/network-endpoint-groups-added.jpg\" title=\"Network endpoint groups\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"294\" width=\"2430\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/network-endpoint-groups-added.jpg#ZgotmplZ\" alt=\"Network endpoint groups\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<h3 id=\"test-that-everything-works\">Test that everything works<\/h3>\n<p>If you now open the Server container Preview mode and check any incoming requests, you should see the custom request headers added automatically:<\/p>\n<div style=\"aspect-ratio: 1518 \/ 508;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/headers-in-gtm-preview.jpg\" title=\"Headers in GTM preview\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"508\" width=\"1518\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/headers-in-gtm-preview.jpg#ZgotmplZ\" alt=\"Headers in GTM preview\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>Furthermore, if you go to <a href=\"https:\/\/console.cloud.google.com\/logs\/\">Logs Explorer<\/a> in Google Cloud, you can expand an incoming HTTP request log to see which backend it was sent to:<\/p>\n<div style=\"aspect-ratio: 1654 \/ 700;\" class=\"figure nocaption\">\n<p>    <a href=\"https:\/\/www.simoahava.com\/images\/2023\/10\/cloud-run-balancer-logs.jpg\" title=\"Logs\"><\/p>\n<p>    <img decoding=\"async\" class=\"fig-img\" height=\"700\" width=\"1654\" loading=\"lazy\" src=\"https:\/\/www.simoahava.com\/images\/2023\/10\/cloud-run-balancer-logs.jpg#ZgotmplZ\" alt=\"Logs\"\/><\/p>\n<p>    <\/a><\/p>\n<\/div>\n<p>In the example above, I sent the request from Finland, so it was routed to the <code>server-side-tagging-eu<\/code> service to keep the geographical distance between myself and the server as short as possible.<\/p>\n<h2 id=\"migrate-from-app-engine\">Migrate from App Engine<\/h2>\n<p>Migrating from App Engine to Cloud Run is very easy.<\/p>\n<p>First, build your Cloud Run setup to completion following the steps in this article.<\/p>\n<p>Then, once you\u2019re ready, you can <a href=\"https:\/\/cloud.google.com\/appengine\/docs\/standard\/managing-projects-apps-billing#disabling_an_application\">disable the App Engine application<\/a>.<\/p>\n<p><strong>Note!<\/strong> If you want to migrate the subdomain from App Engine to your new Cloud Run load balancer, there <em>might<\/em> be downtime as the load balancer provisions the SSL certificate for your setup. So do this at your own risk. If you want everything to go smoothly, you can reserve a <strong>new<\/strong> domain name for the Cloud Run setup.<\/p>\n<p>Remember \u2013 do <strong>not<\/strong> disable the App Engine application until everything is working as intended in Cloud Run. Even after that, it\u2019s a good idea to have the App Engine application running for a day or two to catch any cached traffic that might still be flowing in.<\/p>\n<h2 id=\"summary\">Summary<\/h2>\n<p>This article has been a walkthrough of what to expect when moving to the new, <strong>recommended<\/strong> deployment of server-side tagging in Google Tag Manager, using Google Cloud Run as the new backend.<\/p>\n<p>I didn\u2019t discuss costs \u2013\u00a0you can check out <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/cloud-run-setup-guide?provisioning=manual#cloud_run_cost\">Google\u2019s own documentation<\/a> for that, but because Cloud Run is computation-as-needed, the costs might be more difficult to guesstimate in advance than it was with App Engine.<\/p>\n<p>So is there still a reason to use App Engine? Sure! If you want <strong>automatic compression<\/strong>, <strong>automatic geolocation<\/strong>, and in many ways a more hassle-free experience, you can stick with App Engine. It\u2019s not going away (hopefully anytime soon).<\/p>\n<p>But Cloud Run has lots of advantages:<\/p>\n<ul>\n<li>You can create multiple services, all in different regions.<\/li>\n<li>Mapping custom domains and creating load balancers is very easy with the new integration.<\/li>\n<li>You have more flexibility over instances, and you only pay for requests that are actually processed.<\/li>\n<li>It\u2019s \u201cthe future\u201d of Google Cloud\u2019s serverless application stack.<\/li>\n<\/ul>\n<p>I recommend creating a Cloud Run setup with the minimum loadout. That way you can test to see how complicated the process actually is, and you can scale up slowly and with control to not introduce any surprise costs.<\/p>\n<p>If you want a more guided walkthrough of how to work with Cloud Run, consider enrolling in Simmer\u2019s <a href=\"https:\/\/www.teamsimmer.com\/all-courses\/server-side-tagging-in-google-tag-manager\/\">Server-side Tagging In Google Tag Manager<\/a> online course.<\/p>\n<p>What are your thoughts on this, recommended deployment? Have you given Cloud Run a spin yet?<\/p>\n<\/p><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>In a recent update to server-side tagging in Google Tag Manager, Google switched the default deployment of a server-side tagging backend from Google App Engine to Google Cloud Run. Now, when you create a new container and choose the automatically provisioned tagging server option, this service will be created in Google Cloud Run instead of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":48816,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[12564,1531,14495,2753,18475,1791,29117],"dealstore":[],"offerexpiration":[],"class_list":["post-48815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-cloud","tag-google","tag-manager","tag-run","tag-serverside","tag-tag","tag-tagging"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Cloud Run With Server-side Tagging In 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=48815\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cloud Run With Server-side Tagging In Google Tag Manager - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"In a recent update to server-side tagging in Google Tag Manager, Google switched the default deployment of a server-side tagging backend from Google App Engine to Google Cloud Run. Now, when you create a new container and choose the automatically provisioned tagging server option, this service will be created in Google Cloud Run instead of [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=48815\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-26T14:56:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.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=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=48815#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=48815\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"Cloud Run With Server-side Tagging In Google Tag Manager\",\"datePublished\":\"2025-01-26T14:56:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=48815\"},\"wordCount\":3274,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=48815#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg\",\"keywords\":[\"Cloud\",\"Google\",\"Manager\",\"Run\",\"Serverside\",\"TAG\",\"Tagging\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=48815#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=48815\",\"url\":\"https:\/\/fivemor.com\/?p=48815\",\"name\":\"Cloud Run With Server-side Tagging In Google Tag Manager - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=48815#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=48815#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg\",\"datePublished\":\"2025-01-26T14:56:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=48815#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=48815\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=48815#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=48815#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cloud Run With Server-side Tagging In 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":"Cloud Run With Server-side Tagging In 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=48815","og_locale":"en_US","og_type":"article","og_title":"Cloud Run With Server-side Tagging In Google Tag Manager - Som2ny Network","og_description":"In a recent update to server-side tagging in Google Tag Manager, Google switched the default deployment of a server-side tagging backend from Google App Engine to Google Cloud Run. Now, when you create a new container and choose the automatically provisioned tagging server option, this service will be created in Google Cloud Run instead of [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=48815","og_site_name":"Som2ny Network","article_published_time":"2025-01-26T14:56:15+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg","type":"image\/jpeg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=48815#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=48815"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"Cloud Run With Server-side Tagging In Google Tag Manager","datePublished":"2025-01-26T14:56:15+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=48815"},"wordCount":3274,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=48815#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg","keywords":["Cloud","Google","Manager","Run","Serverside","TAG","Tagging"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=48815#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=48815","url":"https:\/\/fivemor.com\/?p=48815","name":"Cloud Run With Server-side Tagging In Google Tag Manager - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=48815#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=48815#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg","datePublished":"2025-01-26T14:56:15+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=48815#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=48815"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=48815#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/01\/cloud-run-server-side-tagging.jpg","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=48815#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"Cloud Run With Server-side Tagging In 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\/48815","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=48815"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/48815\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/48816"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48815"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=48815"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=48815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}