Jump to content

Google ad words conversion tracking


webspinning

Recommended Posts

The experts at Google have advised I should add ther following code at the end of content.receipt.php to track successful orders generated by ad words.

I would appreciate a view from anyone that has done this previously - it just does not look right.

 

{literal}
 
<!-- Global site tag (gtag.js) - Google Ads: 106nnnnnnn -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-106nnnnnnn"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
 
gtag('config', 'AW-106nnnnnnn');
</script>
 
 
gtag('event', 'conversion', {
'send_to': 'AW-106nnnnnnn/K_-QCMrvlt4BEJSnsfsD',
'value': '{/literal}{$GA_SUM.total}{literal}',
'currency': 'GBP',
'transaction_id': '{/literal}{$GA_SUM.cart_order_id}{literal}' // order ID - required
});
{/literal}
Link to comment
Share on other sites

I cannot vouch for the AdWords code itself, but the placement of {literal} and {/literal} is correct.

I do see that the gtag('event' code block is not surrounded by <script> tags. That will cause something to not be reported correctly.

I hope a better answer comes along shortly.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...