{"id":599,"date":"2015-07-02T12:18:06","date_gmt":"2015-07-02T00:18:06","guid":{"rendered":"http:\/\/geektactics.geektamin.com\/?p=599"},"modified":"2024-06-14T09:53:08","modified_gmt":"2024-06-13T21:53:08","slug":"troubleshooting-universal-analytics-ecommerce-tracking-in-wordpress-when-using-yoast","status":"publish","type":"post","link":"https:\/\/geektactics.co.nz\/blog\/troubleshooting-universal-analytics-ecommerce-tracking-in-wordpress-when-using-yoast\/","title":{"rendered":"Troubleshooting Universal Analytics Ecommerce Tracking in WordPress when using Yoast"},"content":{"rendered":"
If you’re using WordPress, Universal Analytics and the Yoast Analytics plugin, and want to set up Google Analytics ecommerce tracking manually, you’re probably running into some problems.<\/p>\n
I had this exact scenario with a client’s website. \u00a0We upgraded from Classic Analytics to Universal Analytics and immediately all ecommerce data stopped being recorded. Even though I have edited the ecommerce tracking code to\u00a0the Universal Analytics required code.<\/p>\n
Analytics said no transactions, no sales, no quantity, no revenue .. the graph had flatlined. \u00a0Sales were still coming in of course, but our Analytics data was not working.<\/p>\n
The site was running in WordPress but wasn’t using\u00a0WooCommerce or any other full shopping cart, so we couldn’t use the Yoast Ecommerce plugin (which works great!) \u00a0The website just used simple Buy Now buttons and sent visitors to a thank you page where I had the ecommerce tracking code embedded.<\/p>\n
After days of troubleshooting I finally found the problem, and it is specifically because of the Yoast plugin.<\/p>\n
Universal Analytics documentation for Ecommerce Tracking<\/a> shows the required code as<\/p>\n If you’ve been troubleshooting, like I was, you have gone over this code multiple times making sure it works.<\/p>\n However when using the Yoast Analytics plugin with Universal Analytics ticked, every Like this:<\/p>\n As soon as this change was made, the ecommerce tr4ansactions were once again being\u00a0successfully recorded in Google Analytics.<\/p>\n (As a side note – I use the awesome little plugin Global Content Blocks<\/a> to embed my\u00a0ecommerce tracking code on the page without the\u00a0Wordpress editor messing it up).<\/p>\n <\/p>\nga('require', 'ecommerce');\r\nga('ecommerce:addTransaction', { ...\r\n\r\nga('ecommerce:addItem', { ...\r\n\r\nga('ecommerce:send');\r\n<\/code><\/pre>\n
ga<\/strong><\/code> needs to be changed to
__gaTracker<\/strong><\/code>.<\/p>\n
__gaTracker('require', 'ecommerce');\r\n__gaTracker('ecommerce:addTransaction', { ...\r\n\r\n__gaTracker('ecommerce:addItem', { ...\r\n\r\n__gaTracker('ecommerce:send');\r\n<\/code><\/pre>\n
Troubleshooting – How to See What Data is Being Sent to Google Analytics<\/h2>\n