Understanding Lookup Table Variables

Understanding Lookup Table Variables

What's a Lookup Table Variable?

A lookup table variable in Google Tag Manager (GTM) is a configuration that allows us to map one set of values with another. It is often used to transform or replace values in your tags or triggers.

Use cases of Lookup Table Variable

  • Development Environments

Lookup variables enable you to separate and manage data between your live website (the one your customers see) and a staging environment (a clone of your website used for testing and development purposes). This allows for independent analysis and testing of data for quality control and development, all without impacting the other environment.

  • For instance, imagine you’re in charge of a popular e-commerce website in Delhi, India. Your website has lots of customers making purchases every day, and it’s crucial to keep it running smoothly.
  • Now, when you want to make changes or updates to your website, it’s like making changes to a moving car. It’s risky because if something goes wrong, it can affect your customers’ experience.
  • To avoid this, you create a test area called a staging site. Think of it as a playground where you can safely try out new things without affecting the real website.
  • Now, you use a tool called Google Tag Manager (GTM) to manage things like tracking user activity on your site. You want to use the same GTM setup for both the real website and the staging site because it’s efficient and saves time.
  • However, you also use Google Analytics 4 (GA4) to understand what’s happening on your website. To keep things organized, you want to collect data from the real website in one place and data from the staging site in another.
  • This is where the “Lookup variable” comes in. It’s like a smart messenger that helps you send the data from the staging site to the right place in GA4 without mixing it up with data from the real site.
  • So, instead of all the data going to one big bucket, you use the Lookup variable to make sure data from the staging site goes to its own special bucket in GA4.

This way, you can analyze and understand what’s happening on your test site separately from your real site.

  • Multiple Top-Level Domains Tracking

When dealing with multiple domains or subdomains, we can use lookup variables to ensure consistent tracking and data organization. Imagine you work for a large e-commerce company based in Delhi, India. Your company has the following online properties:

  • Main E-commerce Website: www.examplestore.com (.com domain)
  • Blog: blog.examplestore.net (.net domain)
  • International Store: intl.examplestore.eu (.eu domain)

In this scenario, you want to use lookup variables to ensure consistent tracking and data organization across these top-level domains:

Challenge:

  • You need to collect data for each of these top-level domains separately to meet legal and reporting requirements.
  • Tracking user interactions and events (e.g., purchases, sign-ups) differs slightly in each domain.
  • Cross-domain tracking is crucial to understand how users navigate between these domains.

Solution with Lookup Variables:

GA4 Property Lookup Variable: Create a lookup variable in Google Tag Manager (GTM) to determine which GA4 property should receive data based on the top-level domain. For example:

  1. For www.examplestore.com (a .com domain), send data to “GA4 – Main Website Property.”
  2. For blog.examplestore.net (a .net domain), send data to “GA4 – Blog Property.”
  3. For intl.examplestore.eu (a .eu domain), send data to “GA4 – International Store Property.”

By utilizing these lookup variables, you maintain consistent tracking and data organization across different top-level domains, allowing for precise analysis of user behavior and engagement. This approach facilitates compliance and provides clean, organized data for your reporting and decision-making processes.

  • Affiliate Commissions

Setting up a purchase event with a Lookup variable to include the transaction commission as a custom event parameter in Google Analytics 4 (GA4) is a smart way to track affiliate commissions accurately. Here’s how it works:

Scenario:

You run an e-commerce website in Delhi, India, and you have an affiliate marketing program where partners earn commissions for driving sales to your website.

Solution with Lookup Variable:

  • Purchase Event Trigger: In Google Tag Manager (GTM), you create a trigger for the purchase event. This trigger fires when a user completes a purchase on your website.
  • Lookup Variable: Now, you set up a Lookup variable within GTM. This variable identifies if the purchase was made through an affiliate link and retrieves the commission value associated with that specific affiliate.
  • Custom Event Parameter: Next, you create a custom event parameter in GA4, let’s call it “Affiliate Commission.” This parameter will hold the commission value.
  • Data Push: When a user makes a purchase through an affiliate link, you use the Lookup variable to fetch the commission amount associated with that affiliate. Then, you push this commission amount as the “Affiliate Commission” custom event parameter to GA4.

By implementing this setup, you achieve two critical objectives:

  1. Accurate Commission Tracking: You ensure that affiliate commissions are accurately recorded in GA4 for each transaction, so you can attribute the commissions to the right affiliates.
  2. Data Organization: The use of custom event parameters keeps your data organized within GA4, making it easy to analyze affiliate performance and the impact of commissions on your business.

This approach allows you to measure the effectiveness of your affiliate marketing program, optimize partnerships, and ensure that affiliates are rewarded correctly for their contributions to your e-commerce website.

  • Content Grouping

You use content grouping in Google Analytics, where “Blog Posts” and “Advertisement Pages” are distinct content groups. It aligns content categorization between both platforms, simplifying content analysis and reporting consistency.

You’re a marketer responsible for analyzing website data for an E-Magazine Business. You want to understand how different types of content on the website, such as blog posts and advertisement pages, are performing. However, you’re finding it challenging to group and analyze this content effectively.

Solution with Lookup Table Variables:

With content grouping, you can easily see how blog posts and advertisement pages are performing separately. This helps you measure the success of your content marketing efforts and ads-related conversions more accurately.

Now, here’s where lookup table variables come in. We can set up a lookup table variable in Google Tag Manager. This variable acts like a smart organizer, determining the type of content a user is interacting with.

  • Categorizing Content: The lookup table variable identifies whether a user is viewing a “Blog Post” or a “Advertisement Page” based on their interactions. It then assigns a specific value or label, such as “Content-Type,” to that interaction.
  • Sending Data to Analytics: When this data is sent to your analytics tool (e.g., Google Analytics 4), it includes the “Content-Type” parameter determined by the lookup table variable.
  • Enhancing Product Names

If your e-commerce website uses product IDs, you can use lookup variables to replace those IDs with actual product names before sending data to Google Analytics. Using lookup variables to enhance product names in your e-commerce website’s data before sending it to Google Analytics is a smart strategy for better analysis and reporting. Here’s how it works:

Imagine you manage an e-commerce website that uses product IDs (unique identifiers) to track products in your database. However, for meaningful analysis and reporting in Google Analytics, you want to replace these IDs with actual product names.

Solution with Lookup Variables:

  • Product ID Lookup Variable: In Google Tag Manager, you create a lookup variable. This variable’s job is to recognize the product IDs associated with user interactions, such as viewing a product or making a purchase.
  • Product Name Mapping: You create a mapping within the lookup variable. This mapping associates each product ID with its corresponding product name in your database. For example:

Product ID: 12345 maps to Product Name: “Smartphone X”

Product ID: 67890 maps to Product Name: “Laptop Y”

Replacement with Product Name: Instead of sending the product ID to Google Analytics, the lookup variable replaces it with the actual product name based on the mapping you’ve defined.

How to Set-up Looker Table Variable in GTM?

Here’s how you can do it:

Step 1: Log into Google Tag Manager

Step 2: Create a New Variable

variables

Step 3: Create a new variable

Create a new variable

Step 4: Select the ‘Lookup Table’ as the variable type

Select the 'Lookup Table' as the variable type

Step 5: Configure Your Lookup Table Variable

  1. Give a name to the variable
  2. Select the ‘Page Hostname’ as the Input Variable
  3. Add the required number of rows
Configure Your Lookup Table Variable
Step 6: Give values to the table
  1. Enter the hostname for the live and staging site into the Input column
  2. Enter the measurement ID for the respective hostname into the Output Column
  3. Select the Set Default value checkbox and use the staging website’s measurement ID. (Optional)
Give values to the table

Step 7: Click on ‘Save’

save

And that’s done! Lookup Table Variable is now set up in Google Tag Manager to separate data for your live and staging websites in GA4. This helps you keep your analytics clean and precise.

Lookup Table Variable is now set

Leave a Comment

Your email address will not be published. Required fields are marked *