webspinning 0 Posted January 3 Share Posted January 3 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} Quote Link to post Share on other sites
bsmither 1,463 Posted January 3 Share Posted January 3 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. Quote Link to post Share on other sites
webspinning 0 Posted January 4 Author Share Posted January 4 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? Quote Link to post Share on other sites
bsmither 1,463 Posted January 4 Share Posted January 4 Will this plugin be of any help? https://www.cubecart.com/extensions/plugins/google-adwords-tracker Quote Link to post Share on other sites
webspinning 0 Posted January 5 Author Share Posted January 5 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.