Shopify7 min read3 views

Shopify Google Ads remarketing with a custom pixel

Use Shopify page_viewed events to trigger Google Ads remarketing in GTM. Check the sandbox, conversion ID and page-view test results.

Watch on YouTube

The short answer

Use Shopify page views to trigger a Google Ads remarketing tag inside the same custom pixel as your GTM loader. Shopifyshopify.dev exposes page_viewed on storefront and checkout pages, among other supported surfaces. This guide is for store owners and implementers maintaining a custom pixel.

  • Listen for page_viewedshopify.dev in Customer events.
  • The snippet pushes page_view to GTM.
  • Remarketing labels are optionalsupport.google.com; leave the label empty for this example.
  • If an existing integration already covers this event, inspect it before adding another sender.
  • Steps and settings checked against Shopify and Google 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

Should a page visit be remarketing or a conversion?

Choose ordinary remarketing for this walkthrough; use a conversion action only when your measurement plan deliberately treats that visit as a conversion. Keep conversion-action labels out of the remarketing tag because Google says they inflate conversion countssupport.google.com.

The video shows the older version of this setup; follow the current written steps for the corrected snippet, remarketing settings and testing method.

How do I add the custom pixel in Shopify?

Prepare this walkthrough in a development store with a test GTM container. Shopify suggests testing pixels in a dev storehelp.shopify.com before adding them to a live store.

1. Open Customer events and check the loader

  1. In the test store, open Settings > Customer events > Add custom pixel.
  2. Name the pixel.
  3. Review its Customer privacy settings using Shopify's pixel instructionshelp.shopify.com, and use settings that match your consent plan.

Shopify's GTM tutorialhelp.shopify.com uses the container loader as JavaScript without script tags. The snippet below includes a loader.

  1. Replace the snippet's GTM placeholder with the ID of a test container that only your development store loads.
  2. If this pixel already loads GTM, keep that loader once and append only the event subscription and its helper.

Done when the editor is open, the privacy settings are recorded and the pixel contains one loader for the intended test container.

What code tracks Shopify page views?

Subscribe to page_viewed and push the mapped values into the data layerdevelopers.google.com, the object GTM reads for events. The Shopify event referenceshopify.dev documents the fields used below.

2. Add the event subscription

event.context.document supplies location.href, title and referrer; event.id identifies the event, as listed in Shopify's payload referenceshopify.dev. The callback is the function that runs when Shopify delivers this event.

  1. Add the snippet below to the pixel's code.
  2. Save and connect the pixel in the test store following Shopify's connection stepshelp.shopify.com.
page_view.js50 lines
// Initialize the dataLayerwindow.dataLayer = window.dataLayer || [];(function (w, d, s, l, i) {  w[l] = w[l] || [];  w[l].push({ "gtm.start": new Date().getTime(), event: "gtm.js" });  var f = d.getElementsByTagName(s)[0],    j = d.createElement(s),    dl = l != "dataLayer" ? "&l=" + l : "";  j.async = true;

41 more lines of JavaScript

  • 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.

Done when Customer events shows Connected and the saved code contains the page_viewed subscription once.

This revision keeps page details in page_data without changing browser history. history.pushState requires a same-origin URLdeveloper.mozilla.org; the event push no longer depends on that extra operation succeeding.

Use Google Ads Remarketing for this event. Google's tag instructionssupport.google.com describe the ID and label fields.

3. Create the variables and event trigger

A Data Layer Variable reads a named value for a tag, and a trigger tells GTM when to run a tag.

  1. Create each Data Layer Variable in the table below, using Version 2, which reads dots as nested fieldssupport.google.com.
  2. Create a Custom Event triggersupport.google.com with event name page_view.
  3. Turn regular-expression matching off on that trigger.

DLV - Page URL

Data layer variable name
page_data.url
Purpose
Original page context for inspection

DLV - Event ID

Data layer variable name
event_data.id
Purpose
Match the test event
These paths match this snippet. Creating a variable does not send it to Google Ads.

Done when the saved variable names and paths match the table and the trigger's saved event name is page_view.

4. Map the tag fields

  1. Enter the audience-source Conversion ID.
  2. Leave Conversion Label empty. Google makes the label optional for remarketing and warns that conversion-action labels inflate conversion countssupport.google.com.
  3. Set the remaining fields and trigger as shown in the table below.
  4. In Custom Parameters > Manually Specify, the control shown in Google's GTM examplesupport.google.com, add shopify_event with value page_view.
  5. Check the associated Google tag is present in the test container; Google's remarketing instructions require it for optimal browser compatibilitysupport.google.com. The Google tag IDsupport.google.com is distinct from your GTM- container ID.
  6. Save the event tag.

Conversion ID

Setting
Your Google Ads audience-source Conversion ID

Conversion Label

Setting
Leave empty

Send dynamic remarketing event data

Setting
Off for this standard remarketing example

Trigger

Setting
page_view
This tag runs on the selected event; it does not send a purchase conversion.

Done when the saved tag contains the exact shopify_event key and value page_view, and its fields, destination and trigger match your test plan.

Google supports custom parameters for audience rulessupport.google.com. This parameter name is this guide's choice, not a Google standard.

How do I test page views on Shopify?

Use Customer events > Test to inspect the event with Shopify Pixel Helperhelp.shopify.com, then inspect the Google request separately. Start with the test store and test container prepared above.

5. Publish the version in the test container

Changes saved in a workspace do not run yet. Google sayssupport.google.com you need to publish workspace changes to make them operational.

  1. Open the test container that only your development store loads.
  2. Select Submit.
  3. Choose Publish and Create Version.
  4. Name the version and publish.

Do not publish to a container your live store loads; move the tested setup there through your normal release process.

Done when the test container's Versions list shows your version as published and the pixel code loads that container's ID.

6. Follow one test action through the setup

  1. Open the connected custom pixel and choose Test using Shopify's testing stepshelp.shopify.com.
  2. Exercise the consent choice for your test, and check that Pixel Helper's consent status matches that choice.
  3. Visit a storefront page.
  4. Navigate to another page in the test store.
  5. In Pixel Helper, check that page_viewed is listed and that its page URL matches each page you visited.
  6. Inspect the pixel's console entry and data-layer push for page_view: the event name should match your saved GTM trigger and the expected fields should contain the test values.
  7. In browser developer tools, inspect the outgoing Google Ads remarketing request: it should use the intended account ID without a purchase conversion label, include shopify_event=page_view, and appear for the action you tested.
  8. Record the test time, event ID, container version and observed request fields.

Done when every check above matches and your notes identify what passed and any missing or repeated request that still needs investigation.

When is this the wrong setup, and what can go wrong?

Use this guide when you need to maintain this custom event mapping. Shopify advises reviewing available apps before creating a custom pixelhelp.shopify.com; if an app already handles the job, inspect that integration first.

Why are customer account page views missing?

Shopify only logs page_viewed on customer account pages when a vanity domain is set upshopify.dev. Check that prerequisite before adding another page-view subscription.

For the completed-order payload used by another destination, the Shopify Purchase guide explains the checkout event and its limits.

What changed in this guide

  • 25 October 2026: Added the Shopify event explanation, Google Ads tag mappings and test checks; preserved existing event names and corrected payload handling. Added a named custom parameter for the remarketing action. Removed the history update before the event push. The video still shows the older setup. Added the isolated test-container publication procedure and published-version check. Replaced the repeated introduction with the next event-specific check.

Sources

14 sources
  1. 1page_viewed↩
  2. 2Remarketing labels are optional↩
  3. 3Shopify suggests testing pixels in a dev store↩
  4. 4Shopify's pixel instructions↩
  5. 5Shopify runs custom pixels in a sandbox↩
  6. 6Shopify's GTM tutorial↩
  7. 7data layer↩
  8. 8history.pushState requires a same-origin URL↩
  9. 9Version 2, which reads dots as nested fields↩
  10. 10Custom Event trigger↩
  11. 11Google's GTM example↩
  12. 12Google tag ID↩
  13. 13Google supports custom parameters for audience rules↩
  14. 14Google says↩