[null,null,["最后更新时间 (UTC):2024-05-01。"],[[["\u003cp\u003eServer-side tagging enhances website performance and security by processing data on a server instead of a user's browser.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Tag Manager facilitates server-side tagging setup with automated provisioning on Google Cloud Platform or manual setup on other platforms.\u003c/p\u003e\n"],["\u003cp\u003eCustom domains can be configured for better cookie privacy and server requests can be sent after setup is complete.\u003c/p\u003e\n"],["\u003cp\u003eThe default Google Cloud Platform deployment offers a free tier but may incur costs depending on usage and linked projects.\u003c/p\u003e\n"],["\u003cp\u003eFor high-traffic websites, upgrading the Cloud Run environment with additional instances ensures redundancy and prevents data loss.\u003c/p\u003e\n"]]],["Server-side tagging moves measurement tag processing to a server, enhancing performance and security. To start, create a Tag Manager server container, choosing \"Server\" as the target platform. Next, deploy a tagging server via automatic provisioning on Google Cloud Platform or manual provisioning on other infrastructure. Configure a subdomain of your website to point to the server for better cookie privacy. The default GCP setup uses Cloud Run and is typically free but may incur costs with high traffic or linked accounts. Adding more than 1 instance is recomended.\n"],null,["# Server-side tagging allows you to move measurement tag instrumentation from your\nwebsite or app to a server-side processing container on Google Cloud Platform\n(GCP), or [any other platform](/tag-platform/tag-manager/server-side/manual-setup-guide) of your choosing. Server-side\ntagging offers a few advantages over client-side tags:\n\n- **Improved performance:** Fewer measurement tags in your website or app means less code to run on the client side.\n- **Better security:** Visitor data is better protected and more secure when collected and distributed in a customer-managed server-side environment. Data is sent to a cloud instance where it is then processed and routed by other tags.\n\n| **Note:** Server containers run on [Cloud Run](https://cloud.google.com/run). Cloud Run downtime doesn't affect the performance of your website.\n\nTo get started with server-side tagging:\n\n1. [Create a Tag Manager server container](#create_a_tag_manager_server_container).\n2. [Set up a GCP tagging server](#set_up_a_gcp_tagging_server).\n\n| For a high-level overview, read [An\n| introduction to server- side tagging](/tag-platform/tag-manager/server-side/intro)\n\nCreate a Tag Manager server container\n-------------------------------------\n\nTo use server-side tagging, create a new Tag Manager server container:\n\n1. From your Tag Manager account, [create a new container](https://support.google.com/tagmanager/answer/6103696#existing).\n 1. Click **Accounts \\\u003e** next to the relevant account name.\n 2. Choose **Create Container**.\n2. Under **Target platform** , choose **Server**.\n3. Click **Create**.\n\nA dialog to set up your tagging server appears. This process is detailed in the\nnext section.\n\nSet up a tagging server\n-----------------------\n\nAfter you have created the server container, you need to deploy a tagging\nserver. Note: To return to this point later on, click your container ID in the\ntop bar or navigate to the **Admin** tab \\\u003e **Container Settings** \\\u003e **Set up\nyour tagging server**.\n\nYou can choose one of the following deployment options:\n\n- **Automatic provisioning (recommended)** : If you choose to **Automatically\n provision tagging server** , Google Tag Manager sets up a new GCP project and a Cloud Run tagging server for you. If you want to use an existing GCP project, follow the [Cloud Run setup guide](/tag-platform/tag-manager/server-side/cloud-run-setup-guide).\n\n\u003c!-- --\u003e\n\n- **Manual provisioning on non-Google infrastructure** : If you want to use your own server solution, follow the steps in the [manual setup guide](/tag-platform/tag-manager/server-side/manual-setup-guide).\n\nConfigure the server domain\n---------------------------\n\nThe new tagging server has a default URL on `uc.a.run.app`. To improve cookie privacy and durability,\npoint a subdomain of your website to the tagging server.\nThat way, the tagging server can read and write cookies that are not visible to\nscripts in the page (`HttpOnly` cookies).\nLearn how to [set up a custom domain](/tag-platform/tag-manager/server-side/custom-domain) to map to your\ntagging server.\n\nUnderstand the default GCP deployment\n-------------------------------------\n\nWhen you create a tagging server using the automatic provisioning flow, the\nserver has the default configuration.\n\n**What GCP resources are allocated when I automatically provision my tagging\nserver?**\n\nWhen you automatically provision your tagging server, a GCP project is created\nwith the server-side container deployed on [Cloud Run](https://cloud.google.com/run). The deployment\nrestricts the amount of resources available and is recommended for testing\nlimited traffic volumes only.\n\nWhen your server-side container begins to receive live traffic,\nallocate additional instances to your [service](/tag-platform/tag-manager/server-side/cloud-run-setup-guide) to ensure redundancy\nand avoid data loss in case of outages or capacity limitations. We recommend a\nminimum of 3 instances per container for redundancy. Learn how to\n[upgrade your deployment](/tag-platform/tag-manager/server-side/cloud-run-setup-guide).\n\n### What is the domain of my tagging server?\n\nThe default deployment uses a Cloud Run subdomain. We strongly recommend that\nyou point a subdomain of your website to the tagging server. Follow\n[these instructions](/tag-platform/tag-manager/server-side/custom-domain) to map your website subdomain to your\ntagging server.\n\n### How much does the default deployment cost?\n\nThe default deployment of a GCP project with a single server is free in most\ncases. However a few factors can cause you to incur costs with a single-server\ndeployment:\n\n1. The billing account used for the GCP deployment is linked to other projects that push the server out of the [GCP Free Tier](https://cloud.google.com/free/docs/gcp-free-tier#free-tier).\n2. The amount of traffic sent from the server exceeds the free-tier limits.\n\nOnce you upgrade your Cloud Run environment, you can expect to spend\n$30-$50 per server per month. Large amounts of network traffic may increase this\ncost.\n\n### How do I add additional instances to my deployment?\n\nTo learn how to add additional instances to your deployment, read the\n[Cloud Run documentation](/tag-platform/tag-manager/server-side/cloud-run-setup-guide).\n\nSend your first request\n-----------------------\n\nTo learn how to send your first request,\n[read the guide on how to send data to server-side Tag Manager](/tag-platform/tag-manager/server-side/send-data)."]]