webspinning Posted January 3, 2021 Share Posted January 3, 2021 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 More sharing options...
bsmither Posted January 3, 2021 Share Posted January 3, 2021 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 More sharing options...
webspinning Posted January 4, 2021 Author Share Posted January 4, 2021 I am not sure it should be one block of code either. Feels like the first bit should be at the top of the file and the last bit in its own <literal> and <script> tags at the end Any other suggestions please? Link to comment Share on other sites More sharing options...
bsmither Posted January 4, 2021 Share Posted January 4, 2021 Will this plugin be of any help? https://www.cubecart.com/extensions/plugins/google-adwords-tracker Link to comment Share on other sites More sharing options...
webspinning Posted January 5, 2021 Author Share Posted January 5, 2021 I do have this installed, was very straightforward and I added the Ad words ID and Event send to ID as required but nothing happens. I get the feeling that Ad words have changed something that effects this plugin again. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.