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

Author
Stape
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!

Got confused?

We can help you! Click Get A Quote, fill up the form, and we will answer you right away.

Get a quote
Tagged with:Facebook

Relevant posts

Sep 7, 2021

Facebook conversion API errors and how to fix it

Setting up the Facebook conversion API may be confusing. But after you did the tremendous job of moving FB tracking to the server and think that job is done, you might log in to your events manager the next day and see red and yellow warnings. In this blog post, I will describe the most popular Facebook conversion API errors and warnings. Plus, share some tips on how to fix it.

Aug 16, 2021

Facebook Event Match Quality – What it is and how to increase it

Using Facebook conversion API, you can send events from your server to the Facebook server. Server-side tracking with configured custom subdomain helps to bypass ad blockers, ITPs, and iOS 14 restrictions.

Feb 11, 2021

How to Setup Facebook Conversion API + Events Deduplication & Hash User Data

Facebook Pixel allows you to track what users are doing on your site, collect remarketing audiences and create lookalikes. If the Facebook pixel is implemented correctly, it will feed relevant information to FB machine learning algorithms. FB ML will use pixel data to show your ads to people who are most likely to convert. For several years now, we could track events on the site via javascript code, Facebook SDK inside apps, or upload offline events. But how can you track users who installed Ad Blocker or track events outside the site? Or how can you extend a cookie lifetime? It can be done by implementing Facebook conversion API. This article will show you how to set up Facebook conversion API via Google Tag Manager Server Container.

Host your GTM server at Staperight now!