Setting up a new server container

To use server-side tagging, you need a server to run your container on. This chapter walks you through the automatic deployment option in Tag Manager which sets up an App Engine server for you. You can also deploy a tagging server in Cloud Run manually, which is covered in Planning infrastructure requirements and costs.

Before you begin

Before you get started with the course, you need:

  • A credit card so that the provisioning process can create a Google Cloud Platform billing account for you. You will not be billed for the course, as the actual load should stay well below the free tier of the relevant Google Cloud Platform services.
  • A Tag Manager account with rights to create a new server container.
  • A Tag Manager web container or a Google tag as the data source for sending requests to a server container.
  • A Google Analytics 4 property, as this will serve as our example data stream.
  • Optional but recommended: A subdomain of your website for your server environment to establish a first-party context.

Tagging server deployment options

The easiest way to deploy a server container is by using the automatic provisioning setup that you can initiate from the Tag Manager user interface. A Google Cloud Platform project is automatically created for your environment, and the server is deployed as a Google App Engine application.
This chapter uses the automatic provisioning option.

Other deployment options

If you want more control over the deployment, you have the following options:

  • Scripted deployment: You run a shell script in the Google Cloud Platform that lets you configure the deployment parameters for Google App Engine.
  • Manual deployment: Deploy the Docker image in the server environment of your choice.

The table outlines the available options.

Deployment option Ease of use Features
Automatic (Google App Engine) Easy
  • Creates an App Engine Standard instance and a testing environment
  • Deploys a server container in Google Cloud Platform
  • Google Cloud region fixed to us-central1
  • Practically cost-free as long as you are testing
  • Should only be used for testing, as it doesn't support a production workload. You can upgrade to a production setup later.
Scripted (Google App Engine) Moderate
  • Requires running a shell script in the Google Cloud Platform
  • Use it to deploy a server container in Google App Engine with the server structure of your choice
  • More control over the geographical region and auto-scaling number of virtual machines.
  • A production-ready setup will incur costs from the virtual machines, network egress, and storage (e.g. logging)
Manual (Docker) Difficult
  • Lets you deploy a server container in any Docker environment that allows public HTTP access
  • You have full control over service infrastructure
  • Setup can get very involved, especially if deploying outside the Google Cloud Platform and you still want to use GCP services such as the BigQuery and Firestore APIs
  • Will incur costs depending on the service infrastructure you choose

Create a new server container and provision the GCP resources

The first thing you need to do is create a new server container in Tag Manager and start the automatic provisioning process.

  1. Open Google Tag Manager
  2. In your account's overflow menu , click Create Container.
  3. In Container Settings, name your new container and select Server. Click Create. Once the container was created, you will see a setup screen.
  4. Click Automatically provision tagging server.
  5. Choose or create a billing account for your container and create the server.
    Result: Google Tag Manager deploys a tagging server onto App Engine with a testing configuration and adds the App Engine domain as the tagging server URL.

    Screenshot of the overlay with the server configuration information
    The Default Url is automatically generated and assigned by Google App Engine. It consists of https://[GOOGLE_CLOUD_PLATFORM_PROJECT_ID].[GOOGLE_CLOUD_REGION_ID].r.appspot.com. With the automatic provisioning setup, the Google Cloud region is always us-central1, and the region ID is thus uc.

Test your setup

Before you start the next chapter, take a look at your App Engine server to check if your server works:

  1. Copy the Default Url from the configuration overlay.
  2. Open a new browser tab.
  3. Paste the Default Url and append /healthy to the path. For example, the full URL for the container above would be https://gtm-XXXXXX-XXXXXX.uc.r.appspot.com/healthy

Summary

To review, you've created a server container in Tag Manager. Then, you've set up an actual server running on App Engine.

Next, you will learn how to configure the data flow between the web browser and the tagging server by setting up Google Analytics 4.