Blog

Pre-launch checks before flipping the gtm.js loader

Six checks that catch the issues that always surface in production, run them in 15 minutes.

Pointing your gtm.js loader at your custom domain is a one-line change that affects every measurement signal on your site. Six checks before publishing the change catch the issues that otherwise surface during production traffic.

1. The custom domain returns gtm.js

curl -I https://data.example.com/gtm.js?id=GTM-XXXXXXX

Should return 200 with Content-Type application/javascript. If it returns 404, your Web Container client is not enabled or the GTM ID is wrong. Fix this before going further.

2. SSL is valid and trusted

curl -v https://data.example.com 2>&1 | grep -i 'subject\|issuer'

The certificate should be issued by Google Trust Services or Let's Encrypt depending on your provider. Self-signed certs will silently fail in some browsers. If the cert is missing, wait; SSL provisioning can take up to 30 minutes after DNS resolves.

3. CSP allows the new hostname

If your site has a Content Security Policy header (it should), add the new hostname to script-src, connect-src, and img-src. Forgetting CSP is the most common cause of post-launch breakage.

4. Preview mode works against the new domain

Open the GTM debug console for your server container. Navigate to your site in the same browser. Trigger a known event. The event should appear in the preview pane within a few seconds. If it does not, check the preview header propagation.

5. Production GA4 receives a test event

Switch off preview mode. Open GA4 Realtime view. Trigger a real event. It should appear in Realtime within 30-60 seconds. If preview worked but Realtime does not, the issue is in your GA4 measurement ID or the path the GA4 client listens on.

6. Existing reports do not show a sudden gap

After publishing the loader change, watch your hourly reports for the next two hours. A drop of more than 5 percent in event volume means something is being filtered or rejected. Roll back if needed; rolling back is one click and the cost of leaving a broken state running is much higher than the cost of a temporary revert.

When to schedule the change

Pick a low-traffic window. For consumer sites that usually means weekday morning EU time or weekday late-night US time. For B2B, pick weekend. The drop in traffic during the change is small, but if anything goes wrong you have less data to recover from.