Google Ads7 min read2 views

Shopify Google Ads view_item tracking with GTM

Set up Shopify Google Ads product-view remarketing in GTM with feed-matched IDs, presentment currency and Preview checks.

Watch on YouTube

The short answer

Track Shopify product views for Google Ads remarketing by pushing the viewed variant into GTM and firing a view_item tag. Google requires retail item IDs to match the Merchant Center feedsupport.google.com. This guide is for store owners and implementers maintaining a theme-based product-page data layer.

  • If a working integration already sends product views, inspect it before adding another sender.
  • Use custom_view_item for the trigger and view_item for the Ads event.
  • Check price and currency together in GTM Preview.
  • Steps and settings checked against Google and Shopify documentation on 25 October 2026.

Ask an assistant

ChatGPTClaudePerplexity

FREE AUDIT

NO LOGIN

Check what Meta and Google can count on your site

  1. Your site
  2. Crisper
  3. Meta and Google count it

Enter your website to see how good its tracking is, and whether Meta is likely restricting it.

Run a free audit

How do I track Shopify product views for Google Ads?

Check that the container loads in the theme alongside these data-layer pushes; Shopify isolates custom pixels in a sandboxhelp.shopify.com. The snippet below captures the initially selected variant at page load, so test that variant first; later variant selections need a separate listener.

Where do I install GTM for Shopify product pages?

Install the web container in the development store's theme for this method. A container loaded inside a custom pixel has a different data layer and will not read these theme pushes.

1. Check the theme container

  1. Use your development store and a test GTM web container.
  2. Keep the head and body installation snippets in their corresponding theme locations.
  3. Open Preview, following Google's Preview instructionssupport.google.com.
  4. Connect the storefront URL.
  5. Inspect the container on a product page.

Done when Tag Assistant shows the intended container on a product page.

How do I add the Shopify view_item data layer?

Create the two Liquid snippets below and render them from the theme. The product snippet captures the selected variant at page load; it does not listen for later variant changes.

2. Create head-datalayer.liquid

  1. Open the development theme's snippets folder.
  2. Save the first block below as head-datalayer.liquid.
liquid
<script>
  window.dataLayer = window.dataLayer || [];
</script>
 
{%- if template contains 'product' -%}
  {%- render 'datalayer-product', product: product -%}
{%- endif -%}

Done when its product-page condition renders datalayer-product.

3. Create datalayer-product.liquid

  1. In the same snippets folder, save the second block below as datalayer-product.liquid.
liquid29 lines
{%- liquid assign current_variant = product.selected_or_first_available_variant -%} <script>console.log("datalayer-product snippet is loaded")var itemObject = {    item_id: {{ current_variant.id | json }},    id: {{ current_variant.id | json }},    item_name: {{ product.title | json }},    currency: {{ cart.currency.iso_code | json }},

20 more lines of Liquid

  • Copy and download
  • Emailed to you

Unlock this snippet

Three details, and the full code is yours

No account needed. Unlock once and every snippet on the blog opens.

We email you a copy. We may follow up on WhatsApp.

Shopify renders variant.priceshopify.dev in the customer's presentment currency, while shop.currencyshopify.dev describes the store currency. The code now uses cart.currencyshopify.dev and its iso_codeshopify.dev to label that price. Only the currency mapping changed in these Liquid snippets.

Done when a product-page load pushes custom_view_item with the selected variant and its price, and a second presentment-currency test shows the displayed price and data-layer currency agree.

4. Render the snippets from theme.liquid

  1. Check that the two snippets exist.
  2. Place the render line below once in the development theme's <head>.
liquid
{% render 'head-datalayer' %}

Do not paste Liquid into a GTM Custom HTML tag.

Done when the page source includes the rendered product object and one custom_view_item push occurs per page load.

Do product-view remarketing tags need a conversion action?

No conversion action is needed for this remarketing-only setup.

A remarketing tag sends audience datasupport.google.com; a conversion tag records a separately configured conversion actionsupport.google.com. Google makes the remarketing label optionalsupport.google.com and warns that a conversion-action label in that field inflates conversion counts.

Use the intended account's Conversion ID from its Google Ads tag setupsupport.google.com. Add or reuse the associated Google tag, following Google's setup instructionssupport.google.com:

  1. Select Tags > New > Google tag.
  2. Enter its Tag ID.
  3. Choose Initialization - All Pages.

Google says a separate Conversion Linker is unnecessarysupport.google.com when that destination's Google tag loads on every page.

Done when the saved Google tag has the intended Tag ID and trigger, with your consent defaults and updates configured.

How do I configure the view_item remarketing tag?

Map the theme's event to the Google Ads event and pass only identified retail items.

Create the variables and item filter

A Data Layer Variable reads a named value from the data layer, the event data your site gives GTM.

  1. For each variable in the table below, open Variables > New and select Data Layer Variable, following Google's variable referencesupport.google.com.
  2. Enter its data layer variable name from the table, using Version 2 for nested paths, and save.
  3. Create a Custom JavaScript variable named CJS - Remarketing items with the first function below.
  4. Create another Custom JavaScript variable named CJS - Has remarketing items with the second function below.

DLV - Value

Data layer variable name
ecommerce.value
Use
Remarketing Event Value

DLV - Items

Data layer variable name
ecommerce.items
Use
Source items for the filter below

DLV - Currency

Data layer variable name
ecommerce.currency
Use
Compare with the displayed amount
Read values from the event that will fire the tag.

The CJS - Remarketing items function keeps existing retail IDs and drops blank ones; it does not guess a feed ID.

javascript11 lines
function() {  var items = {{DLV - Items}};  if (!Array.isArray(items)) return [];  return items.filter(function(item) {    return item && item.id != null &&      String(item.id).trim() !== "" &&      item.google_business_vertical === "retail";  }).map(function(item) {    return { id: String(item.id), google_business_vertical: "retail" };

2 more lines of JavaScript

  • Copy and download
  • Emailed to you

Unlock this snippet

One form opens every snippet on the blog

The second function is CJS - Has remarketing items.

javascript
function() {
  return {{CJS - Remarketing items}}.length > 0;
}

Done when the saved paths match the table, the saved CJS - Remarketing items code references DLV - Items, and CJS - Has remarketing items returns false for an empty item list and true for a list with a valid retail ID.

Save the trigger and remarketing tag

A trigger tells GTM when to run a tag.

  1. Create a Custom Event trigger named for custom_view_item.
  2. Enter custom_view_item as its event name.
  3. Leave regular-expression matching off.
  4. Select Some Custom Events.
  5. Require CJS - Has remarketing items equals true and save.
  6. Create a Google Ads Remarketing tag and enter the intended Conversion ID.
  7. Leave Conversion Label blank.
  8. Enable Send dynamic remarketing event data.
  9. Set Event Name to view_item.
  10. Set Event Items to CJS - Remarketing items.
  11. Set Event Value to DLV - Value.
  12. Attach the trigger above and save the tag.

These are the fields in Google's GTM configuration examplesupport.google.com.

Done when the saved trigger has both the exact event name and item condition, and reopening the tag shows these settings.

Keep ecommerce.currency available for the amount check. Google's dynamic-tag examplesupport.google.com maps Event Name, Event Value and Event Items; it does not map currency. The separate conversion tag has a Currency Code fieldsupport.google.com. Do not assume that a currency stored in the data layer was sent by a tag.

How do I test Shopify product-view remarketing?

Use GTM Previewsupport.google.com on the development storefront; it lets you test the workspace without publishing.

5. Check the product, currency and request

  1. Open two different product URLs in Preview.
  2. On each custom_view_item, compare DLV - Value, DLV - Currency and CJS - Remarketing items with the product and its Merchant Center entry.
  3. Test a second presentment currency.
  4. Save these observations for the normal release review.

Done when the tag fires on the intended event, the request uses the correct Ads ID, and the product IDs and amounts agree.

Why is my Shopify product-view tag wrong?

Check the event, feed ID and scope of the theme snippet before adding another tag.

  • A raw Shopify variant ID is unsuitable if the feed uses another identifier. Supply a verified feed mapping before using dynamic remarketing; never invent an ID prefix.
  • This snippet does not capture later variant-selector changes. Have an implementer add an event-time mapping if those changes matter, then test the new variant's ID and price.
  • An existing app and this tag may send overlapping product-view data. Inspect the senders and retain one deliberate implementation.

What should I check after the product-view tag?

Check add-to-cart next, then checkout remarketing. Passing the local tests confirms the mapping you inspected, not campaign delivery or audience eligibility.

What changed in this guide

  • 25 October 2026: Corrected Liquid presentment-currency labels, added the missing remarketing fields and item filter, separated conversion actions from remarketing, and replaced live-container publishing with Preview checks. Replaced the repeated opening with theme-container scope and the initially selected variant check.

Sources

13 sources
  1. 1Google requires retail item IDs to match the Merchant Center feed↩
  2. 2Shopify isolates custom pixels in a sandbox↩
  3. 3Google's Preview instructions↩
  4. 4variant.price↩
  5. 5shop.currency↩
  6. 6cart.currency↩
  7. 7iso_code↩
  8. 8remarketing tag sends audience data↩
  9. 9conversion tag records a separately configured conversion action↩
  10. 10Google's setup instructions↩
  11. 11Google says a separate Conversion Linker is unnecessary↩
  12. 12Google's variable reference↩
  13. 13Google's GTM configuration example↩