Using the GTM Preview Mode
How to use the Google Tag Manager preview mode in the web and server container to debug and test
Google Tag Manager's Preview Mode is a valuable tool that helps you test tags and triggers before you publish your changes. But it is also needed to debug your trackings setup. Let's take a look at when and how to use it.
What is GTM's preview mode?
Preview mode (also called preview and debug mode) in Google Tag Manager is a built-in feature that lets you test tags, triggers and variables in real time on your website or in your server container. You use this mode before you publish your changes, but also to debug in a test environment, so real visitors don't notice anything.
In a server-side tagging setup you work with two containers in Google Tag Manager: a web container and a server container. Both containers have their own preview mode, and each one works slightly differently. In this article we explain when and how to use the preview mode of the GTM web container, and when and how to use the preview mode of the GTM server container.
Let's start with the web container.
Web container preview mode
There are three key moments where you use preview mode in the Google Tag Manager web container:
After setting up new tags and triggers.
To check whether your existing tags and triggers still fire correctly.
After making changes to your website.
1. Creating new tags and triggers
After setting up new tags and triggers, it's essential to use preview mode before you publish your container. To test them, click 'Preview' in the top right of the container you're working in. In the popup of the preview window, enter the URL of the website that is connected to this container. Your site now opens in a new tab in a test environment.
Say you've set up a tag and trigger for a specific button on a certain page of your site. In the test environment, navigate to that page and perform the action, for example clicking the button. In the preview tab you can then see which tags fired and which didn't. You can also review this per page and per site-interaction in the vertical menu on the left.

2. Check whether your existing tags and triggers still fire
If you notice that certain events aren't coming in, or aren't coming in correctly, in platforms such as Meta Ads or Google Analytics, the first thing to check is whether the tags and triggers in Google Tag Manager still fire correctly.
Start by performing the action that should make the tag fire. Select that session event in the vertical menu on the left. In the list of tags that didn't fire (Tags not fired), select the tag that should have fired. Under Firing Triggers you'll then see an overview explaining why that tag didn't fire.

3. Changes made to your site
When you make changes to your site, such as changing URLs, updating button and link texts, or adjusting the checkout flow, it's important to make sure those changes don't break your measurement. If you open your site in the preview mode, you can walk through all of your changes and perform the relevant events. Preview mode lets you keep track of which tags do and don't fire.
Troubleshooting tags that didn't fire
If tags didn't fire that should have, click the event where you expected the tag to fire in the vertical menu on the left. Select the event, then click the tag that didn't fire to see what's wrong with the trigger. Inside that tag you can find out why the trigger didn't work in the Firing Triggers section, and make changes based on that information.

Server container preview mode
There are two key moments where you use preview mode in the Google Tag Manager server container:
When you create new server-side tags and triggers.
When you make changes to your server-side tagging setup, or when the incoming requests from your web container change.
1. Testing new tags and triggers
Preview mode in the server container works differently from the web container, because it waits for incoming events from your website instead of you clicking through your site directly. When you open preview mode, your website doesn't open automatically. You'll only see an overview of incoming requests in the preview mode interface once you start sending events to the server container URL when you have opened the website within the same browser.
So a requirement for using the GTM server container preview mode is that you've made the necessary Google tag configuration settings in your GTM web container.
In the overview on the left you'll see the incoming requests in chronological order, where the GA4 client turns them into a readable event. In the overview on the right you can see the tags that are triggered when the event arrives.

2. Testing changes to your web container
When you make changes in the GTM web container and want to know whether this affects your GTM server container tags, you can check this in preview mode as well. When an event comes in, you expect specific tags to be triggered or you want specific parameters to be sent towards your marketing platforms. If that doesn't happen, you know something is wrongly set up in the GTM web container or in the server container.
If you make changes to the parameters of an event tag, you can easily review them in the Event Data tab of the incoming request. The Event Data tab shows you which client processed the incoming request and which event data you can work with in your server tags, triggers and variables.

No requests coming into your GTM server container preview mode?
If you are testing your server-side tagging setup and no event requests show up in the server container preview mode? Don't worry. We'll explain the most common causes step by step so you can get back to testing quickly.
Check the basics
Before you dig deeper, confirm that your server container is live and responding.
Health check: open a new tab, go to your server container URL and add
/healthyto it. You should seeok.

Test endpoint: open a new tab, go to your server container URL and add
/test. A400error is expected and fine. What matters is that you see this request arrive in your preview mode. If it does, your container and preview session are working.

Verify the server container URL
Using the wrong server container URL in your Google tag is one of the most common causes. Make sure the server container URL in your Google tag configuration (in your GTM web container) matches exactly the URL where you are running the sGTM preview. Double-check for typos, a missing subdomain, or http instead of https.
Check whether your Google tag configuration is being overwritten
Another frequent cause is a second source on the website overwriting your Google tag configuration, usually a hardcoded gtag.js script.
How to check:
Open the Network tab in your browser developer tools.

Enable Preserve log so events are kept when the page changes.

Filter on your GA4 measurement ID.

Look at where the requests are going. If they go to
googletagmanager.comorregion1.google-analytics.cominstead of your server container URL, your Google tag configuration in the GTM web container is being overwritten by a gtag.js script on the website.

Possible causes:
A gtag.js script in the website source.
Multiple Google tags using the same measurement ID.
The standard Google Tag Manager script running alongside the tagging pixel script.
Still nothing?
A few less obvious things worth checking:
Same browser, same session. Preview mode only captures traffic from the browser session that was started from the preview window. Opening the site in another browser, another profile, or in incognito breaks that link. Use the preview window itself, or the "Send requests to..." tab it opens.
Ad blockers and privacy extensions. These can block requests before they ever leave the browser. Test with extensions disabled or in a clean profile.
Consent state. With Consent Mode active, tags may be waiting for consent and simply never fire. Accept consent on the page and check again.
Web container preview. Check whether the tag fires at all in the web container preview. If the tag doesn't fire there, the problem is in the web container, not on the server side.
Last updated
Was this helpful?

