Stape
Search
Try for free

Google Merchant Center Lookup variable for Google Tag Manager server container

Ivanna Holubovska

Ivanna Holubovska

Author
Updated
Apr 18, 2025
Published
Sep 5, 2024

Google Merchant Center Lookup variable is used to retrieve and enrich product data by querying information from a Google Merchant Center account. This is particularly useful for enhancing the data associated with products in your Merchant Center, such as product categories or additional attributes, when passing data to other systems like Google Ads or Google Analytics via the server-side GTM container.

Use case

For example, you’re an e-commerce company that uses Google Merchant Center to manage your product catalog and Google Ads to run Shopping campaigns. You want to track conversions and product interactions more accurately by enriching product data in the server-side Google Tag Manager (GTM) container before sending it to Google Analytics or Google Ads for reporting and optimization.

When users interact with the website, product-related data (such as product categories, brands, and other custom attributes) may not always be fully captured client-side. Some attributes might be missing from the web data layer or poorly categorized due to inconsistencies in product tagging on the front end. This results in incomplete or inaccurate data being sent to Google Ads and Analytics, potentially affecting campaign performance and reporting.

By setting up Google Merchant Center Lookup variable in the GTM server container, you can enrich the data related to product interactions by pulling additional details directly from your Google Merchant Center feed. This ensures that the product information sent to Google Ads and Analytics is accurate and consistent across all platforms.

Benefits

  • Consistent Data Across Platforms: Merchant Center Lookup ensures that all platforms (Google Ads, Analytics, etc.) are working with the same, up-to-date product information.
  • Improved Campaign Performance: Google Ads and other platforms can optimize campaigns better when they receive complete and accurate data about the products being sold.
  • Automation and Efficiency: by automating the product data lookup via the server container, the company reduces manual work and the risk of inconsistencies due to human error.
  • Enhanced Reporting: the enriched data allows for better tracking of product interactions and conversions, leading to more detailed insights for optimization.

The initial development of this template was done by Lars Friis, and it is now maintained by Stape.

How it works

Google Merchant Center Lookup variable for Google Tag Manager server container
Google Merchant Center Lookup variable for Google Tag Manager server container
  • Items (input to be enriched)

This is where you specify the item or product data you want to enrich from your Google Merchant Center account. You would typically select an existing variable or data layer property here.

  • Merchant center ID

This is where you input your Google Merchant Center account ID, which the variable will use to look up product information.

  • Cache (hours)

Defines how long the data fetched from the Merchant Center is stored in the cache. For example, if set to 12 hours, the fetched data will be stored for 12 hours before it is updated with new information.

  • Feed language

The language of the product feed that the lookup will pull from. This field ensures that the data matches the correct language of the Merchant Center feed. 

Find parameter in Merchant Center URL: feedLabel=DK

  • Feed label

This allows you to specify which feed within your Merchant Center account to use, particularly if you have multiple feeds for different purposes.

Find parameter in Merchant Center URL: language=da

  • Map product_types into item_categories checkbox

If checked, this option maps the product_type in the Merchant Center to the item_category field in GTM. This can help categorize products in a more structured way for reporting or targeting.

  • Basic Mapping

This allows for simple mappings between Google Merchant Center Lookup variables and GTM variables. You can add rows here to map specific attributes from your Merchant Center to variables in GTM.

  • Custom Mapping

This is for more advanced or complex mappings where you want to manually map specific attributes or variables between the Merchant Center and GTM.

Before starting

Enable the Content API on the GCP project

Google Cloud Platform offers a Content API (Merchant API) for Google Merchant Center. The API allows apps or services to interact directly with a Google Merchant Center account. Enabling the Content API is useful for e-commerce businesses that want to manage products, inventory, and Merchant Center accounts.

To connect the Merchant API/Content API, go to GCP → select the relevant project → type in the search bar “Merchant API” and select it → on “Product details” click “Enable”.

Connect the Service Account from the GCP project to Stape

Google Service Account is used to make authorized API requests. By linking a Google Service Account to the server GTM container, you can enable integration between server-side Google Tag Manager and Merchant Center and/or other platforms like BigQuery and Firestore.

The integration allows you to perform different server-side tasks related to your Merchant Center data, including retrieving product information, managing feeds, and sending conversion data.

To connect the Service Account from the GCP project to Stape, create aervice Account in Google Cloud Platform (IAM & Admin → Service Accounts  → Click Create Service Account - If you are unsure what role to use, just pick Project > Viewer) or use an existing Service Account, then go to Stape admin to activate Google Service Account power-up.

For more details on the configuration process check our guide on how to connect Google Service Account to Stape.

Add the Service Account as an admin to the Merchant Center account

To do it, go to your Merchant Center account → click the Settings & tools icon in the top right corner → People and access → Click the + Add user button → in the email address field, add the Service account ID. That’s the email of your Service Account; you can find it in the Google Cloud Console. Grant it Admin Access.

How to set up Google Merchant Center Lookup variable

2. Download Google Merchant Center Lookup variable on GitHub or get it from the Template Gallery.

Google Merchant Center Lookup variable for Google Tag Manager server container
Google Merchant Center Lookup variable for Google Tag Manager server container

3. Import the variable to server Google Tag Manager container by clicking: Templates → New Variable Template. 

Click three dots in the top right corner → Click import → Add template that you’ve recently downloaded → Click Save.

Google Merchant Center Lookup variable for Google Tag Manager server container
Google Merchant Center Lookup variable for Google Tag Manager server container

4. Fill in the data in the fields of the variable. Click Save.

And you’re all done!

Conclusion

Google Merchant Center Lookup variable enriches product data in Google Tag Manager by pulling attributes from a Google Merchant Center feed, making it useful for server-side tracking, dynamic remarketing, or other applications where you need detailed product information.

We hope you find this guide helpful and if you have any questions, please feel free to leave a ticket or ask any questions in the comments section.

author

Ivanna Holubovska

Author

Ivanna is a Lead Content Manager at Stape, a professional writer focused on creating high-quality content about server-side tracking to help businesses optimize their strategies and analytics.

author

Comments

Try Stape for all things server-sideright now!