Skip to content

Setting up a Site ID variable

We recommend creating a Site ID variable that automatically sends traffic to your sandbox dashboard when using GTM’s preview mode. This helps keep your production dashboard free of testing data.


All you need to proceed is knowledge of:

  1. Your Site ID(s)
  2. Your Sandbox Site ID
    • Usually in the form of sandbox.sld.tld e.g.,
    • If you have multiple production Site IDs, your sandbox may take the form sandbox.publisher-name e.g., sandbox.acme-inc


  1. Click the Configure button in the Built-In Variables sections on the Variables tab and select the checkbox beside Debug Mode.
  2. Create a Lookup Table variable with {{Debug Mode}} as the input variable. Add one line specifying when the Input is true the output is your sandbox site ID.
  3. Set the Default Value to your production Site ID.
  4. Use this variable in the Site ID field in the tracker tag.
Google Tag Manager, variable configuration screen showing an example Site ID variable.

Next Step

With your variable set up, you may now add it to your tracker for your web or AMP container.

Last updated: June 03, 2024