Google Ads Conversion Tracking - Subtask 4
Description
orders are being duplicated.
- Prevent collection of duplicate orders.
Solution
- Encapsulate the event snippet with the following Liquid tags:
{% if first_time_accessed %}and{% endif %}:
{% if first_time_accessed %}
<!-- Event snippet for Test conversion page -->
<script>
gtag('event', 'conversion', {
'send_to': 'AW-123456789/AbC-D_efG-h12_34-567',
'value': {{ subtotal_price | money_without_currency }},
'currency': '{{ currency }}',
'transaction_id': '{{ transaction_id }}'
});
</script>
{% endif %}
- Ensure the
transaction_idparameter includes a unique value like Order Number:'transaction_id': '{{ order.order_number }}'
Explanation
- Surrounding the conversion event code snippet with
{% if first_time_accessed %}and{% endif %}ensures duplicate conversions won’t be submitted on page reloads. From the Shopify Documentation:
It is common to include scripts that track sales conversions on the order status page because it is the final page of checkout. However, customers who return to check their order status might count as a second sale in your analytics.
To prevent your analytics from counting customers more than once, you can add the first_time_accessed property around some or all of your additional scripts.
- We avoid capturing duplicate conversions by ensuring the
transaction_idparameter is set to a unique value. Thanks to Subtask 2, we’ve already accomplished this with'transaction_id': '{{ order.order_number }}'. According to the Google Ads Documentation:
If there are 2 conversions for the same conversion action with the same transaction ID, Google Ads will know the second conversion is a duplicate, you will see an error message, and the duplicate conversion won’t be counted.