Custom domain configuration

The default server-side tagging deployment is hosted on an App Engine domain. We recommend that you modify the deployment to use a subdomain of your website instead.

Map a subdomain to your app

  1. In the Google Cloud Console, navigate to App Engine > Settings > Custom Domains. Make sure you're in the project that matches your container ID:
    screenshot of GCP project selector, showing a sample Tag Manager container ID.
  2. Click Add a custom domain.
  3. If your domain is already verified, you may select it from the Select the domain you want to use section. Otherwise, select Verify a new domain from the drop-down menu.

    If you haven’t verified your domain, do the following:

    1. Enter your subdomain (such as analytics.example.com) and click Verify.
    2. After you click verify, a new Webmaster Central window will appear. Follow the steps as prompted in Webmaster Central to verify your ownership of your subdomain. Learn more.
    3. After you complete the steps in Webmaster Central, close that window and return to the Add a new custom domain page in the Google Cloud Console. You may need to click Refresh domains to see your newly verified domain.
  4. In the Point your domain to [project-ID] section, remove the www. prefixed subdomain.
    When complete, click Save mappings.

Updating DNS records at your domain registrar

After you've mapped your service to a custom domain in App Engine, update the DNS records at your domain registrar. As a convenience, App Engine generates and displays the DNS records you need to enter.

  1. To retrieve the DNS record information for your domain mappings, in Google Cloud Console, go to the Custom Domains tab of the App Engine Settings page. This page lists DNS records for all of the domains you have mapped to your app.
  2. Log in to your account at your domain registrar and open the DNS configuration page.
  3. Locate the host records section of your domain's configuration page and add each of the DNS records that you retrieved when you mapped your domain to your app. Enter the following information in the record fields:
    • Record type: Enter the record type shown in the DNS record that Google created for you (A and AAAA).
    • Record name: For A and AAAA records, enter the subdomain you registered. For example, enter "analytics" to map analytics.example.com.
    • Data: Enter the record data (rrdata) that is shown in the DNS record Google created for you. For A or AAAA records, the record data is an IP address.
      Note: There are multiple IP addresses for the A or AAAA records. You should register multiple addresses to the same record, rather than creating separate records for each address.
  4. Save your changes in the DNS configuration page of your domain's account. In most cases, it takes only a few minutes for these changes to take effect, but in some cases it can take several hours. You can use dig to confirm the DNS records have been successfully updated.
  5. To test your subdomain, navigate to your server-side Tag Manager container under Admin > Container Settings. and paste that URL into the Tagging server URL. Click Save, navigate back to your workspace, then click Preview. You should see the Debug panel pop up. Note: It can take up to an hour for the automatic SSL certificate to be issued.