Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
My Adwords account has provided me with this tag for conversion tracking:
<!-- Event snippet for Purchase conversion page
In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};
gtag('event', 'conversion', {
'send_to': 'AW-977070838/U961CLSanHkQ9tXz0QM',
'value': 1.0,
'currency': 'USD',
'transaction_id': '',
'event_callback': callback
});
return false;
}
</script>
I have added this to the Checkout > Additional Scripts section of my Shopify site, but no conversions are tracking. I've been through an end to end process to test this and still no conversions tracked.
What am I missing?
- Does the above contain placeholder values that I need to update? I'm thinking maybe if (typeof(url) != 'undefined') needs updating with a URL of my website?
- Is the Checkout > Additional Scripts section of Shopify the best section to install this tag? Google's own instructions say to copy their code between the Head tags on each page where a conversion can take place after all.
Thanks
Tom
Some of the variables should be populated as follows:
<!-- Event snippet for Purchase conversion page
In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->
<script>
function gtag_report_conversion(url) {
var callback = function () {
if (typeof(url) != 'undefined') {
window.location = url;
}
};
gtag('event', 'conversion', {
'send_to': 'AW-977070838/U961CLSanHkQ9tXz0QM',
'value': {{ subtotal_price | money_without_currency | remove:',' }},
'currency': '{{ shop.currency }}',
'transaction_id': '{{ order.order_number }}',
'event_callback': callback
});
return false;
}
</script>
User | RANK |
---|---|
9 | |
5 | |
4 | |
4 | |
3 |