1. The Redirect Problem: PayPal & Stripe self-referrals
When a customer checkouts using PayPal or a third-party gateway, they are redirected away from your Shopify store. Once the payment is processed, they are redirected back to your checkout confirmation screen. If your GA4 tracking is not set up to ignore these gateways, GA4 treats the return visit as a new session, attributing the sale to paypal.com instead of Google Ads or Organic Search.
How to fix:
- Go to your GA4 Admin panel, select Data Streams, and click your web stream.
- Click Configure tag settings > Show all > List unwanted referrals.
- Add domain entries for:
paypal.com, stripe.com, and your payment gateways.
- Add
checkout.shopify.com to ensure your checkout subdomains are excluded.
Tired of trying to debug GTM container scripts?
I deploy clean, code-validated conversion data layers and secure SHA-256 Enhanced Conversions on a flat-rate project basis.
Fix My Tracking Setup
2. Stop Double-Firing on page refreshes
Shopify's order status page is visited multiple times. If a customer bookmarks the page, refreshes it to check shipping status, or clicks their email confirmation link, the checkout script triggers again, reporting a duplicate purchase event.
Prevent duplicates using LocalStorage:
Write a script that stores the Order ID in the visitor's browser storage. If the script runs again and detects that the Order ID has already been tracked, it blocks GTM from firing the conversion tag again. Here is the JavaScript setup:
// Client-side purchase de-duplication script
const orderId = "{{Order ID}}"; // GTM Order ID variable
if (orderId) {
const trackedOrders = JSON.parse(localStorage.getItem('tracked_orders') || '[]');
if (trackedOrders.includes(orderId)) {
// Already tracked, trigger blocker variable
window.dataLayer.push({'event': 'duplicate_purchase'});
} else {
trackedOrders.push(orderId);
localStorage.setItem('tracked_orders', JSON.stringify(trackedOrders));
window.dataLayer.push({'event': 'valid_purchase'});
}
}
3. Transitioning to Shopify Web Pixels
Shopify has phased out checkout injection scripts in favor of Web Pixels API. Custom GTM script blocks added to the checkout page will no longer fire. To run GTM on Shopify checkout pages, you must integrate GTM through a Custom Pixel script inside your Shopify Admin settings under Customer Privacy > Custom Pixels. This sandbox isolation requires specific message handler syntax to extract checkout events and push them to GTM.
Need Help Fixing This?
I am a freelance technical tracking implementation specialist based in Hyderabad, India. I audit and repair broken Google Ads pixel fires, GA4 custom events, and sitemap/robots.txt indexing bugs.