AdWords conversion tracking

Highlighted
New Member
1 0 0

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 

0 Likes
Shopify Partner
6 0 4

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>

 

0 Likes