Stape
Search
Try for free

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

Updated
Feb 5, 2022
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
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

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

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!

Tagged with:Facebook

Host your GTM server at Staperight now!