Google Ads Conversion Tracking - Subtask 2
Description
we will also be including a new parameter, transaction_id which will be the Order Number.
- Set
transaction_idparameter to Order Number.
Solution
Change:
'transaction_id': '{{ transaction_id }}'
To:
'transaction_id': '{{ order.order_number }}'
Explanation
We can see in the provided code snippet, the transaction_id parameter is actually already included and set to {{ order_number }}.
<!-- 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>
According to Shopify’s documentation, Order Number is an attribute of both the checkout and order objects. The available documentation doesn’t clarify which object {{ order_number }} references.
One important caveat with
checkout.order_number is depending on the payment provider, the order might not have been created yet on the checkout order status page.To ensure the Order Number actually exists, we’ll use order.order_number.