Sometimes, you find a client-side GTM (cGTM) container with multiple conversion tags with similar configurations, like three purchase Google Ads tags for three distinct countries. While this setup might work, it’s far from optimal – especially when you use a server-side GTM (sGTM).
Transferring marketing tags to sGTM provides the perfect opportunity to clean up and simplify your client-side container. One powerful tool to achieve this is the lookup table.
What Is a Lookup Table?
A lookup table in GTM is a simple variable that allows mapping input values (e.g., event names, countries, or parameters) to corresponding output values.
Here’s how it works in a nutshell:
- You define a table with input values (e.g., specific event names).
- You specify corresponding outputs (e.g., “true” or an ID).
- GTM uses the lookup table to dynamically match inputs to outputs, eliminating the need for multiple triggers or tags.
This method reduces redundancy and improves scalability, making your GTM container more efficient and easier to maintain.
Practical example
Imagine you have Google Ads conversion tags: sign_up, generate_lead, add_to_cart, and purchase, each configured separately for three countries: Germany, Netherlands, and Slovakia. Every country has its own Google Ads account. It’s a total of 12 tags and 4 triggers.
With a Lookup Table, you can streamline this into just 3 tags using a single trigger. Here’s how:
- Create constant variables for GAds id’s and lookup table variables for GAds labels and conversion events
Lookup table – conversion labels.
For a lookup table – conversion events, use output value e.g. true. You will use it as a part of a trigger.
In the end, it would look like this. - Create trigger. As a condition use conversion events lookup table.
- Create tags.
In the end, it would look like this.
Benefits of Using Lookup Tables
- Simplification: Replace multiple triggers or tags with a single, streamlined solution.
- Scalability: Easily add or update mappings in the lookup table without modifying multiple triggers.
- Improved Maintenance: A clean and organized GTM container is easier to debug and adapt to changing requirements.
- Consistency: Standardized tagging ensures consistent behavior across events and platforms.
If you’re looking for a complete solution, here is a GitHub repository with a server-side GTM template. Import the container, choose merge, and overwrite. After importing you can abandon GA4 client changes in the PLACEHOLDERS folder.