- Home
- Blog
- Google Ads
- Shopify Google Ads view_item tracking with GTM
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.
Shahzada Ali Hassan, founder of Crisperchecked against 13 sources
Tools
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_itemfor the trigger andview_itemfor the Ads event. - Check price and currency together in GTM Preview.
- Steps and settings checked against Google and Shopify documentation on 25 October 2026.
FREE AUDIT
NO LOGINCheck what Meta and Google can count on your site
- Your site
Crisper- Meta and Google count it
Enter your website to see how good its tracking is, and whether Meta is likely restricting it.
On this page 9 sections
- How do I track Shopify product views for Google Ads?
- Where do I install GTM for Shopify product pages?
- How do I add the Shopify view_item data layer?
- Do product-view remarketing tags need a conversion action?
- How do I configure the view_item remarketing tag?
- How do I test Shopify product-view remarketing?
- Why is my Shopify product-view tag wrong?
- What should I check after the product-view tag?
- What changed in this guide
01How 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.
02Where 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
- Use your development store and a test GTM web container.
- Keep the head and body installation snippets in their corresponding theme locations.
- Open Preview, following Google's Preview instructionssupport.google.com.
- Connect the storefront URL.
- Inspect the container on a product page.
Done when Tag Assistant shows the intended container on a product page.
03How 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
- Open the development theme's snippets folder.
- Save the first block below as
head-datalayer.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
- In the same snippets folder, save the second block below as
datalayer-product.liquid.
{%- 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.
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
- Check that the two snippets exist.
- Place the render line below once in the development theme's
<head>.
{% 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.
04Do 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:
- Select Tags > New > Google tag.
- Enter its Tag ID.
- 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.
05How 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.
- For each variable in the table below, open Variables > New and select Data Layer Variable, following Google's variable referencesupport.google.com.
- Enter its data layer variable name from the table, using Version 2 for nested paths, and save.
- Create a Custom JavaScript variable named
CJS - Remarketing itemswith the first function below. - Create another Custom JavaScript variable named
CJS - Has remarketing itemswith 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
The CJS - Remarketing items function keeps existing retail IDs and drops blank ones; it does not guess a feed ID.
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.
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.
- Create a Custom Event trigger named for
custom_view_item. - Enter
custom_view_itemas its event name. - Leave regular-expression matching off.
- Select Some Custom Events.
- Require
CJS - Has remarketing itemsequalstrueand save. - Create a Google Ads Remarketing tag and enter the intended Conversion ID.
- Leave Conversion Label blank.
- Enable Send dynamic remarketing event data.
- Set Event Name to
view_item. - Set Event Items to
CJS - Remarketing items. - Set Event Value to
DLV - Value. - 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.
06How 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
- Open two different product URLs in Preview.
- On each
custom_view_item, compareDLV - Value,DLV - CurrencyandCJS - Remarketing itemswith the product and its Merchant Center entry. - Test a second presentment currency.
- 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.
07Why 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.
08What 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.
09What 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
- 1Google requires retail item IDs to match the Merchant Center feedsupport.google.com↩
- 2Shopify isolates custom pixels in a sandboxhelp.shopify.com↩
- 3Google's Preview instructionssupport.google.com↩
- 4variant.priceshopify.dev↩
- 5shop.currencyshopify.dev↩
- 6cart.currencyshopify.dev↩
- 7iso_codeshopify.dev↩
- 8remarketing tag sends audience datasupport.google.com↩
- 9conversion tag records a separately configured conversion actionsupport.google.com↩
- 10Google's setup instructionssupport.google.com↩
- 11Google says a separate Conversion Linker is unnecessarysupport.google.com↩
- 12Google's variable referencesupport.google.com↩
- 13Google's GTM configuration examplesupport.google.com↩


