Troubleshooting Server-Side Google Tag Manager: GA4 Hit Routing

Subscribe to our monthly newsletter to get the latest updates in your inbox

If you’re in the process of implementing server-side Google Tag Manager (sGTM), you may come across an issue or two that you’re questioning. One common case that we’ve run into is improper hit routing—some requests are sent to google-analytics.com and some requests are sent to your GTM Server. 

This can happen if the Google Analytics 4 (GA4) configuration tag, which determines where to route hits, isn’t triggered before the GA4 event tags. If you have properly configured the GA4 config tag during implementation, you should see a 1 to 1 match between client-side hits and server-side hits in the GTM Web Container Debug Mode and GTM Server Container Preview Mode. Here’s how to check.

Troubleshooting 

In your GTM Web Container (Debug Mode)

First, begin by looking at your hits in the GTM web container using Debug Mode. Click on the GA4 property. The “gtag hit” means it’s routing to GTM Server (subdomain.domain.com), while a “Google Analytics Hit” means it’s routing to google-analytics.com (Google Analytics Servers)

  • In the figure below, you'll notice that the "View Item" event was sent to Google Analytics directly instead of the GTM Server. The reason for this was because the View Item Event was triggered before the GA4 Config tag was triggered. 
Example of GTM Web container debug mode screen

In your GTM Server Container

  • You’ll only see incoming hits that were shown as gtag hits in your GTM web container using Debug Mode.
    Google Tag Manager

What’s Next

If you’re expecting to send GA4 hits to your GTM Server, you need to ensure your GA4 config tag is triggered before any GA4 Event Tag.

Here’s how to make sure that happens:

  • Double-check the GA4 Config tag has the “Send to Server Container” enabled with the correct server container URL.
  • Ensure the spelling of your server container URL is correct
  • Ensure the GA4 config tag fires on All pages Trigger
  • Ensure the GA4 config tag fires first before any other GA4 event tag (with the same measurement id).
  • Ensure that the data layer push order is correct: 
    • First, fire a core data layer that contains all necessary user parameters that will be needed for subsequent hits 
    • Next, the page views must fire, which is especially important if you are using virtual page views. 
    • Then, the rest of your event data layer pushes can fire 

This order allows for the configuration tag to be the first tag that fires, allows all parameters necessary to be utilized by the required tags on that page and allows for the 1st party cookie to be set on the page view before the conversion occurs.

Screenshot of how to troubleshoot GA4 configuration for proper hit routing in server-side Google Tag Manager (sGTM).
Have questions or need more sGTM help? We’re here and ready to help you. Contact us, and let’s talk!