Debugging in Web and Server GTM: A Complete Guide

This guide provides a step-by-step approach to debugging Google Tag Manager (GTM) for both Web (Client-Side) and Server (Server-Side) tracking. Learn how to use GTM Preview Mode, Developer Tools, Google Tag Assistant, and GA4 DebugView to troubleshoot common issues and ensure accurate tracking. Whether you're fixing tag misfires, server-side data issues, or analytics discrepancies, this guide will help you quickly identify and resolve problems.

3/11/20254 min read

GTM Analytics
GTM Analytics

Debugging in Web and Server GTM: A Complete Guide

Introduction

If you use Google Tag Manager (GTM) to track your website’s visitors, clicks, and conversions, you know how important it is to make sure your tags work correctly.

Sometimes, tracking may fail because of browser issues, server errors, or misconfigurations. This is why debugging GTM is an essential skill.

In this guide, we will explain how to debug Web GTM (Client-Side) and Server GTM (Server-Side) in simple terms, like explaining to a 10-year-old.

What is Debugging in GTM?

Debugging means finding and fixing errors in your tracking setup.

Example: Debugging is Like Fixing a Broken Toy

Imagine you have a remote-controlled car, but it is not moving. To debug the problem, you check:

  1. Are the batteries working? (Is GTM installed correctly?)

  2. Is the remote connected to the car? (Are tags firing properly?)

  3. Is there something blocking the car? (Are ad blockers or privacy settings stopping the tags?)

Debugging GTM works the same way. You check if tags are installed correctly, if they fire when they should, and if something is blocking them.

Debugging Web GTM (Client-Side)

Web GTM runs directly in the user’s browser. If a tag is not working, the problem is usually on the website itself.

Step 1: Use GTM Preview Mode

Google Tag Manager has a built-in Preview Mode that helps you see if tags are firing correctly.

How to Use Preview Mode

  1. Go to Google Tag Manager and open your Web GTM container.

  2. Click "Preview" in the top-right corner.

  3. Enter your website’s URL and click "Connect".

  4. Your website will open in a new tab with the GTM Debug Panel at the bottom.

This panel shows:

  • Which tags fired successfully

  • Which triggers activated the tags

  • If there were any errors

Example: Checking If a Tag Fires

Imagine you have a button click tracking tag in GTM, but it's not working.

  • Open your website in Preview Mode.

  • Click the button.

  • Check the Debug Panel to see if the tag fired.

If the tag did not fire, the trigger might be set up incorrectly.

Step 2: Check the Browser Console

If your tags are not firing, your browser's Developer Tools can help.

How to Open Developer Tools

  1. Right-click on your webpage and select "Inspect".

  2. Click on the Console tab.

If there are JavaScript errors in red, GTM might not be working because of a coding issue.

Example: Checking for Errors

If you see an error saying "Failed to load resource", the tracking script may be blocked by an ad blocker.

Step 3: Check Google Tag Assistant

Google Tag Assistant is a free Chrome extension that checks if GTM is working correctly.

How to Use Google Tag Assistant

  1. Install the Google Tag Assistant extension in Chrome.

  2. Open your website and click on the Tag Assistant icon.

  3. It will show a report on your GTM setup.

A green checkmark means everything is working, while a red warning means there is a problem.

Debugging Server GTM (Server-Side)

Server GTM runs on a cloud server instead of the user’s browser. Debugging it is different from Web GTM.

Step 1: Check GTM Preview Mode for Server-Side

Just like Web GTM, Server GTM has a Preview Mode.

How to Use Server-Side Preview Mode

  1. Open Google Tag Manager and select your Server GTM container.

  2. Click "Preview" and open your website.

  3. In the Debug Panel, check:

    • Which events were received by the server

    • Which tags fired

    • Any errors that occurred

Example: Checking if Server GTM is Receiving Data

Imagine you have a purchase tracking tag that is not working.

  • Open your website in Preview Mode.

  • Make a test purchase.

  • Check the Debug Panel to see if the event was received by the server.

If the event did not appear, there might be an issue with your website sending data to the server.

Step 2: Check Server Logs in Google Cloud

Since Server GTM runs on a Google Cloud server, you can check logs to see if the server is receiving data.

How to Check Server Logs

  1. Go to Google Cloud Console.

  2. Open Cloud Run (where your Server GTM is hosted).

  3. Click "Logs" to see if requests are being received.

If there are no logs, your website may not be sending data correctly.

Step 3: Test with Google Analytics DebugView

If your Google Analytics 4 (GA4) tags are not working in Server GTM, use GA4 DebugView.

How to Use DebugView

  1. Open Google Analytics and go to Admin > DebugView.

  2. Open your website in Preview Mode.

  3. Perform the action you are tracking (e.g., purchase or form submission).

If the event does not appear, the tag might not be firing properly.

Common Debugging Issues and Fixes

Issue 1: Tags Are Not Firing in Web GTM

Possible Reasons:

  • The trigger is incorrect (e.g., wrong button selector for click tracking).

  • Ad blockers are blocking GTM.

  • The GTM container code is missing from the website.

Fix:

  • Check Preview Mode to see if the tag fires.

  • Disable ad blockers and test again.

  • Make sure GTM is installed correctly in the website’s code.

Issue 2: No Data in Server GTM

Possible Reasons:

  • The website is not sending data to the server.

  • The server is not processing requests properly.

Fix:

  • Check the GTM Preview Mode to see if data is reaching the server.

  • Look at Google Cloud logs to see if the server is receiving events.

Issue 3: Google Analytics Data is Missing

Possible Reasons:

  • The GA4 tag is misconfigured.

  • Data is being blocked by browser privacy settings.

Fix:

  • Use GA4 DebugView to check if events are recorded.

  • Make sure GA4 is configured to receive server-side data.

Final Thoughts

Debugging GTM is essential to ensure that your tracking is accurate.

  • Web GTM debugging focuses on fixing issues in the browser using Preview Mode, Google Tag Assistant, and Developer Tools.

  • Server GTM debugging requires checking the server logs, Google Cloud, and GA4 DebugView.

By following this guide, you can identify and fix GTM issues quickly, ensuring that your tracking works perfectly.

Would you like help setting up server-side tracking?

Get in touch with us:

Email: connect@ecommidea.com

WhatsApp: wa.me/919839618999