Track Shopify remove from cart in Google Ads
Capture Shopify cart removals with Customer events and GTM. Trigger standard Google Ads remarketing without reporting removals as purchases.
Shahzada Ali Hassan, founder of Crisperchecked against 15 sources
Tools
The short answer
Capture Shopify cart removals in a custom pixel, then use the remove_from_cart trigger for standard Google Ads remarketing. Shopifyshopify.dev supplies product_removed_from_cart on the online store with a cart-line payload. This guide is for store owners and implementers maintaining a custom pixel.
- Listen for
product_removed_from_cartshopify.dev in Customer events. - The snippet pushes
remove_from_cartto 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.
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 7 sections
- Why keep cart removals separate from additions and purchases?
- How do I add the custom pixel in Shopify?
- What code tracks Shopify cart removals?
- How do I set up the Google Ads tag in GTM?
- How do I test cart removals on Shopify?
- When is this the wrong setup, and what can go wrong?
- What changed in this guide
01Why keep cart removals separate from additions and purchases?
A cart removalshopify.dev records an item leaving the cart, so labelling it add_to_cart or Purchase would describe the wrong action. Give the removal its own trigger and verify it separately from the addition and completed-order tests.
02How 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
- In the test store, open Settings > Customer events > Add custom pixel.
- Name the pixel.
- 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.
- Replace the snippet's GTM placeholder with the ID of a test container that only your development store loads.
- 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.
03What code tracks Shopify cart removals?
Subscribe to product_removed_from_cart 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.data.cartLine supplies merchandise, quantity and cost.totalAmount, as listed in Shopify's payload referenceshopify.dev. The callback is the function that runs when Shopify delivers this event.
- Add the snippet below to the pixel's code.
- Save and connect the pixel in the test store following Shopify's connection stepshelp.shopify.com.
// 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;
85 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.
Done when Customer events shows Connected and the saved code contains the product_removed_from_cart subscription once.
Shopify's event referenceshopify.dev allows product and variant IDs to be null. The filter keeps only rows whose product and variant IDs are strings with non-empty trim() results before mapping items. It preserves each retained ID unchanged. When cartLine is present, the event and its value stay intact even when no valid item remains.
Read the supplied cart-line amount as event context. Do not convert it into negative purchase revenue or assume it describes the remaining whole cart.
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.
04How do I set up the Google Ads tag in GTM?
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.
- Create each Data Layer Variable in the table below, using Version 2, which reads dots as nested fieldssupport.google.com.
- Create a Custom Event triggersupport.google.com with event name
remove_from_cart. - 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
Done when the saved variable names and paths match the table and the trigger's saved event name is remove_from_cart.
4. Map the tag fields
- Enter the audience-source Conversion ID.
- Leave Conversion Label empty. Google makes the label optional for remarketing and warns that conversion-action labels inflate conversion countssupport.google.com.
- Set the remaining fields and trigger as shown in the table below.
- In Custom Parameters > Manually Specify, the control shown in Google's GTM examplesupport.google.com, add
shopify_eventwith valueremove_from_cart. - 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. - 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
- remove_from_cart
Done when the saved tag contains the exact shopify_event key and value remove_from_cart, and its fields, destination and trigger match your test plan.
remove_from_cart is not in Google's recommended dynamic remarketing event listsupport.google.com. Keep this setup as standard remarketing; do not relabel the action as add_to_cart or purchase.
Google supports custom parameters for audience rulessupport.google.com. This parameter name is this guide's choice, not a Google standard.
05How do I test cart removals 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.
- Open the test container that only your development store loads.
- Select Submit.
- Choose Publish and Create Version.
- 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
- Open the connected custom pixel and choose Test using Shopify's testing stepshelp.shopify.com.
- Exercise the consent choice for your test, and check that Pixel Helper's consent status matches that choice.
- Remove a known product variant from a test cart.
- In Pixel Helper, check that
product_removed_from_cartis listed, and inspect the removal event and the cart line Shopify supplied for that action. - Inspect the pixel's console entry and data-layer push for
remove_from_cart: the event name should match your saved GTM trigger and the expected fields should contain the test values. - 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=remove_from_cart, and appear for the action you tested. - Record the test time, event ID, container version and observed request fields.
- Run the subscription locally with null, empty, whitespace-only and non-string values for each ID field.
- Test a valid item separately, then combine the retained arrays from valid and invalid cases for a mixed-list formatter check.
- Repeat with amounts of 0 and a nonzero amount, passing retained items through any downstream formatter. The event, currency and value should stay intact, genuine IDs should remain unchanged, and no mapped ID should be blank or replaced by a product name.
- Run a separate synthetic case with
event.data.cartLine: null. The callback should reportremove_from_cart needs Shopify cartLine dataand add no data-layer entry.
Done when every check above matches and your notes identify what passed and any missing or repeated request that still needs investigation.
The guard stops before the ecommerce reset or event push, so it invents no amount or ID.
06When 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.
- Treating a removal as negative purchase revenue: this event is not a refund. Keep it out of the Purchase conversion action.
- Adding a second sender without checking the first: Shopify warns overlapping pixel installations can count events twicehelp.shopify.com. Inventory the existing event sender before adding this one.
- Saving a tag without checking the actual request: a filled-out tag is only a configuration. Match the request fields to your recorded test action.
If you also need storefront coverage, the Shopify Google Ads page-view guide walks through the separate page-view trigger.
07What 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. Added the isolated test-container publication procedure and published-version check. Filtered items missing either product or variant IDs and added null-item checks without changing event values. Replaced the repeated introduction with the next event-specific check. Rejected whitespace-only and non-string item IDs while preserving genuine IDs, and added formatter checks for mixed and invalid items. Added a null-payload check for the explicit error and absence of a data-layer push.
Sources
15 sources
- 1product_removed_from_cartshopify.dev↩
- 2Remarketing labels are optionalsupport.google.com↩
- 3Shopify suggests testing pixels in a dev storehelp.shopify.com↩
- 4Shopify's pixel instructionshelp.shopify.com↩
- 5Shopify runs custom pixels in a sandboxhelp.shopify.com↩
- 6Shopify's GTM tutorialhelp.shopify.com↩
- 7data layerdevelopers.google.com↩
- 8history.pushState requires a same-origin URLdeveloper.mozilla.org↩
- 9Version 2, which reads dots as nested fieldssupport.google.com↩
- 10Custom Event triggersupport.google.com↩
- 11Google's GTM examplesupport.google.com↩
- 12Google tag IDsupport.google.com↩
- 13Google's recommended dynamic remarketing event listsupport.google.com↩
- 14Google supports custom parameters for audience rulessupport.google.com↩
- 15Google sayssupport.google.com↩

