Jump to content

Google ad words conversion tracking


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.


<!-- Global site tag (gtag.js) - Google Ads: 106nnnnnnn -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-106nnnnnnn"></script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-106nnnnnnn');
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
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...