Stape
Search
Try for free

How to easily maintain Facebook Test ID in your Google Tag Manager Server container

Ira Holubovska

Ira Holubovska

Author
Updated
Apr 16, 2025
Published
Nov 27, 2021

We've all faced the inconvenience of managing Facebook Test ID: you do need it for debugging and testing your setup, but it's ought to be removed from the tags once you deploy your container. So how do we address this? The answer is - lookup table.

Step 1 - go to the Variables menu in your Google Tag Manager Container and make sure 'Debug Mode' is enabled in Built-in Variables. If it's not - press 'Configure' and click the checkbox right next to 'Debug Mode'. Now your GTM can reference this variable.

create facebook test ID variable in the server GTM
create facebook test ID variable in the server GTM
enable debug mode variable in the server Google Tag Manager container 
enable debug mode variable in the server Google Tag Manager container 

Step 2  - create a Lookup Table variable. Select {{Debug Mode}} as input. Now put true for the input and your Test ID as an output. Name your variable (we suggest a simple Facebook Test ID) and hit Save.

create lookup table variable sGTM
create lookup table variable sGTM

Step 3 - Now add your new variable to a tag and it will only use Test ID if GTM is in Debug Mode, otherwise, the variable will be empty and will not cause conflicts in production.

add facebook test ID to facebook conversion API tag
add facebook test ID to facebook conversion API tag

Step 4 - enjoy not having to add/remove Test ID infinite amount of times per day.

Want to learn more tricks on how to work with Facebook? Check out this article on CAPI errors.

Happy Tagging!

author

Ira Holubovska

Author

Ira has 10+ years of digital marketing experience, with the last 5 focused on server-side tracking. She understands how and when it works across various digital marketing scenarios.

author

Comments

Try Stape for all things server-sideright now!