Post-Purchase Google Ads Conversion Tracking and Re-marketing tag NOT being tracked

I’ve run out of ideas and could use any insights. I’m trying to figure out how to make Google Ads Conversion Tracking and Remarketing tags be tracked on the post-purchase page.

  1. I am familiar with and well versed in the Post-Purchase tracking and Shopify provided documentation and examples: https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/pixel-tracking-post-purchase-page#example-script

  2. It looks like there is something that prevents this conversion event from being tracked in an iframe. It works fine on the order status page but not on the post-purchase page. I believe it may be possible the functionality of the post-purchase script doesn’t support this type of event.

  3. Scripts for comparison

Order status page script:

{% if first_time_accessed %}
<!-- Global site tag (gtag.js) - Google Ads: 12345678test-->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-12345678test"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'AW-12345678test');
</script>

<!-- Event snippet for Sales conversion page -->
<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-12345678test/xR07CNvSy6gBELid49UC',
      'value': {{ checkout.total_price | money_without_currency }},
      'currency': '{{ shop.currency }}',
      'transaction_id': '{{ order_number }}'
  });
</script>
{% endif %}

Post Purchase script:

<script async src="https://www.googletagmanager.com/gtag/js?id=AW-12345678test"></script>
<script>
!function () {
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }

    const order = window.Shopify.order;
    const conversionId = 'AW-12345678test';
    const conversionLabel = 'xR07CNvSy6gBELid49UC';
    const options = {
        send_to: conversionId + '/' + conversionLabel,
        value: order.totalPrice,
        currency: order.currency,
        transaction_id: order.id
    };

    gtag('js', new Date());
    gtag('config', conversionId);

    if (!Shopify.wasPostPurchasePageSeen) {
        gtag('event', 'conversion', options);
    }

    Shopify.on('CheckoutAmended', function (newOrder, previousOrder) {
        const oldItems = previousOrder.lineItems.map(function (line) {
            return line.id;
        });
        const newItem = newOrder.lineItems.find(function (line) {
            return oldItems.indexOf(line.id) < 0;
        });
        if (!newItem) return;
        options.value = newOrder.totalPrice;
        gtag('event', 'conversion', options);
    });
}();
</script>
  1. When used there is a record of the google tag script being loaded, but no records with a tracked conversion. Image: https://www.screencast.com/t/QCN5xcpEKa

I believe Google does not accept duplicate conversions for the same transaction_id. I see two calls, one in order_status and the other in the post_purchase for the same order Id.

Reference: https://support.google.com/google-ads/answer/6386790

1 Like