0:00 Requirements
0:45 Create an IP address
2:42 Update DNS Manager
3:46 Create SSL Certificate
5:34 Start Load Balancer settings
7:04 Setup LB Front End
8:27 Setup LB Back End
11:39 Setup Routing Rules
12:35 Review and Finalize
13:13 Test the custom domain
Requisites:
You have already created your GTM Server Side container in Google Cloud
Permissions
Google Cloud
Project Owner or Editor
If you can’t have these permissions: Computer Network Admin, Compute Instance Admin, Security Admin
DNS Manager
Google Tag Manager Access
Editor, Publisher, or owner
Google Cloud APIs are active
Compute Engine API
Certificate Manager API
Steps:
Create and Map a Custom Subdomain
Set a secure and certified static IP address (The IP address of the Load Balancer Frontend) - The Load Balancer collects traffic from all the domains
Go to the GC IP addresses section
Click on Reserve Static IP address
Name the IP address, e.g. ‘ssgtm-ip’
Go to the Network Service Tier and make sure ‘Premium’ is selected
IP version should be IPv4
Under Type settings, select ‘Global’ to make it available globally
Click Reserve
Copy your IP Address!
Map the IP Address in your DNS Manager
Go to your DNS Manager provider
Find your website and select Add a New Record
Choose ‘A’ as the Record Type
The name of the record will be the subdomain, e.g. sgtm, data, tracking, etc. I would recommend using a non-related data as some ad blocker could use popular keywords to block tracking
In the Value section, add the IP Address you copied
Save changes
Verify that the address has been created correctly
Create an SSL (Secure Sockets Layer) certificate
Go to the Certificate Manager
Activate the Certificate Manager API
Go to Create an SSL certificate
Name the certificate as ‘ssgtm-ssl-certificate’
In Create mode, select Create Google-managed certificate
Under domains, add the custom domain mapped in the DNS
Create a Load Balancer Steps
Configure the Load Balancer
The Load balancer handles the incoming traffic from your users' devices
Go to Load Balancing
Click on Create a load balancer
For Type of load balancer, select Application load balancer (HTTP/HTTPS)
For Public-facing or internal, select Public-facing (external)
For Global or single-region deployments, select Best for global workloads
In Load balancer generation select, Global external application load balancer
Click Configure to create, then
Name the load balancer, e.g., ssgtm_load-balancer
Configure the Load Balancer Front End
Go to Frontend configuration
Name the load balancer’s front end, for example, ssgtm-lb-front-end
Protocol must be HTTPS
Keep IPv4
From the drop-down, choose the IP address we created before
Keep Port 443
For the certificate, select the SSL certificate we created before, ‘ssgtm-ssl-certificate’
Keep the SSL policy to the GCP default
Keep the HTTP/3 (QUIC) negotiation to Automatic (default)
Enable HTTP to HTTPS redirect
Click Done
Configure the Load Balancer backend
Go to backend configuration: here is where you configure the GTM server-side
Click on the Backend services and backend buckets drop-down and select CREATE BACKEND SERVICE
Name the Backend, e.g., ssgtm-lb-back-end
In backend type, select Serverless network endpoint group
Under New backend, select CREATE SERVERLESS NETWORK ENDPOINT GROUP
Then, in Create Serverless network endpoint group, name the setting adding in the label, the region where you set the Cloud Run or App Engine instance, e.g. if the zone is USC-1, then name it, ssgtm-network-endpoint-usc1,
Next, select in Region, the region accordingly
In the Serverless network endpoint group type select Cloud Run
Then, in Services, select the Cloud Run or App Engine GTM Server-Side instance that you created
Do not touch the other options
Then click Create
Next, continue the configuration menu, and disable Cloud CDN for now
You can enable Logging for the Load Balancer backend, but it will create more cost, i recommend leaving it for the moment,
Under Security, set to set the drop down to none and revolve Cloud Armor as well
Click create
Then you will see an overview of the backend, click ok
Next go to Routing Rules,
Routing rules config
In Routing rules, select the Mode: Simple host and path rule
Click on ADD HOST AND PATH RULE
On Host add your mapped subdomain, on this tutorial was xxx.domain.com
In path select /*
In backend, select the backend we set
Then go to Review and finalise
Review the changes and then cleate the Load Balaner
Test the setup
Confirm the Load Balancer was set correctly
Check the load balancer
Check the Front end
Check the backend
Confirm the domain settings
Check the Classic Certificate in Certificate Manager
Verify the subdomain was mapped correctly
Add the Custom Subdomain into GTM Server Side settings
Test the subdomain in tag assistant and page path /healthy
Test the Load Balancer Monitoring feature to see the flow of traffic