Tutorial: how to deal with GTM New Preview and Debug Modes

Data Architecture 21 October 2020

As some of you may have noticed, Google recently released a new way to debug Google Tag Manager (GTM) workspaces extending Google Tag Assistant footprint.

This method has many advantages but makes it tricky to run certain tests. One of the issues we have encountered is regularly logging out of the tool. But fear not, there is an alternative solution.

You can activate GTM Preview mode without using the new Google Tag Assistant. Here’s how you can do it:


Make sure the Requestly extension is added to your browser. Otherwise, you can install it by clicking on the following URL: https://www.requestly.in/

The Redirect Request method

Open Requestly and click on New Rule, then select Redirect Request

The next page asks you to enter one request URL (1) and one destination URL (2).

The request URL is the URL of your GTM container. You can find it in the Network tab of your browser, by filtering by gtm.js and clicking on Copy link address.

It should look like that : https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXXX

The GTM-XXXXXXX parameter is basically the identifier of the GTM container that you want to debug.

The destination URL will substitute for the requested URL for your container. Here is an example: https://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX&gtm_debug=&gtm_auth=XXXXXXXXXXXXXXXX&gtm_preview=env-XXX

It’s critical to format the URL in the same way as the example above. It should contain all the expected parameters.

In this URL, you will find 3 parameters:

  • id : GTM container’s ID
  • gtm_auth : unique authentication identifier
  • gtm_preview : preview environment value

To get them, you should access the GTM workspace you want to test and click on Preview.

A new Tag Assistant window pops up. The URL of this page contains the 3 aforementioned  parameters.

This is the expected type of output : https://tagassistant.google.com/?cb=5138356542953603&waffles#!#source=TAG_MANAGER&id=GTM-XXXX&gtm_auth=xxxxx_xxxxxxxxxxxxxxx&gtm_preview=env-XXX

Replace the values in the URL you just prepared for Requestly with those present in the Tag Assistant window. In the end, your Rule should look like this: 

You can now check and test your configuration!

Test your configuration

Reload your page and check that your script is active in Requestly.

You can monitor the smooth running of your set-up by checking 3 things:

  1. The Requestly extension icon is green, which means the extension is on. 
  2. Requestly Dev Tools tab shows your script as triggered3. In the Sources tab, your GTM script displays QUICK_PREVIEW

You can now enjoy a debugging session that feels just like the good old times.

Would you like another cup of tea?