The Google Merchant Center Lookup variable retrieves and enhances product data by querying a Google Merchant Center account.
It’s especially useful for adding product details like categories or attributes when sending data to other systems, such as Google Ads or Google Analytics, through a server-side GTM container.
Merchant API setup
Configuration Steps
⬇️ Click to expand ⬇️
Run the following commands from a terminal or Cloud Shell on your GCP Project to enable the Merchant API in the GCP Project and register your GCP Project with the Merchant Center account.
Registration is required by the Merchant API and must be done once per Merchant Center account.
Learn more.
Important: Perform this registration on your primary Merchant Center account only, not on its sub-accounts. A GCP Project can only be linked to one Merchant Center account, but a Merchant Center account can have multiple GCP Projects registered.
-
Open terminal or Cloud Shell on your GCP Project.
-
Copy the following script into a text editor and replace the
GCP_PROJECT_ID,MERCHANT_CENTER_ACCOUNT_ID, andSERVICE_ACCOUNT_EMAILvariables with your actual values.
The SERVICE_ACCOUNT_EMAILmust belong to a Service Account that has Admin access to the Merchant Center account. You can reuse the existing one (recommended) or create a new Service Account, but ensure it has the necessary permissions.# Replace these with your actual values GCP_PROJECT_ID="your-gcp-project-id" # https://support.google.com/googleapi/answer/7014113?hl=en MERCHANT_CENTER_ACCOUNT_ID="your-merchant-center-account-id" # https://support.google.com/paymentscenter/answer/7163092?hl=en SERVICE_ACCOUNT_EMAIL="your-service-account@your-project.iam.gserviceaccount.com" # Do not change anything in the lines below! # Set your active gcloud project context gcloud config set project ${GCP_PROJECT_ID} # Enable the Merchant API and the IAM Service Account Credentials API # (can also be done via the GCP Console UI) gcloud services enable merchantapi.googleapis.com iamcredentials.googleapis.com # Generate an access token by impersonating the Service Account with the Merchant Center scope. # If this command throws a permission error, ensure your personal user account # has the "Service Account Token Creator" IAM role on the project. ACCESS_TOKEN=$(gcloud auth application-default print-access-token \ --impersonate-service-account="${SERVICE_ACCOUNT_EMAIL}" \ --scopes="https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/content") # Register the GCP Project with the Merchant Center account curl -X POST \ "https://merchantapi.googleapis.com/accounts/v1/accounts/${MERCHANT_CENTER_ACCOUNT_ID}/developerRegistration:registerGcp" \ -H "Authorization: Bearer ${ACCESS_TOKEN}" \ -H "Content-Type: application/json" \ -d "{}" -
After replacing the values, copy the modified version, paste it into the GCP Project Terminal or Cloud Shell, and run it.
-
If everything was successful, a message like this one should be displayed.
{ "name": "accounts/YOUR_MERCHANT_CENTER_ACCOUNT_ID/developerRegistration", "gcpIds": [ "YOUR_GCP_PROJECT_NUMBER" ] } -
Update the variable template in sGTM and test it
-
Publish the changes
Migrating from Content API for Shopping to Merchant API
The template uses the Merchant API starting from June, 2026.
If you were previously using a version of this template that used the Content API for Shopping (scheduled to be deprecated in August 18, 2026) or if you are configuring the integration from scratch, follow these steps to configure the Merchant API.
Useful resources
Open Source
Initial development was done by Lars Friis.
The Google Merchant Center Lookup variable for GTM Server is developed and maintained by the Stape Team under the Apache 2.0 license.