andyfick Posted February 9, 2021 Share Posted February 9, 2021 (edited) Hi All, I have a couple of issues with the Prestashop provided GA plugin on my 1.6.1.24 UK store using default bootstrap theme. Here's the first one: If an individual product in an order has a pre-tax price which is over 1000 pounds, then the Sales Performance report in Google Analytics does not properly record the product price. It looks like it's having problems with the comma in the price, as a product that is, say 1,085 pounds gets reported as 1.08 pounds. Other amounts work fine (like total order revenue, for example). If it is a number representation issue, I guess I either need to tell my smarty template to not represent the product price with a comma, or tweak the JS of the analytics call to ignore the comma. However, before I dive in I thought it might be sensible to see if anyone else has seen / fixed this issue previously. Thanks for any assistance! Andrew Edited February 11, 2021 by andyfick (see edit history) Link to comment Share on other sites More sharing options...
andyfick Posted February 11, 2021 Author Share Posted February 11, 2021 So, I guess that answered my question - no-one seems to have come across this before. However, if you come across this thread with the same problem, hopefully the following solution will help you. The issue described above is caused by line 539 in the file ganalytics.php which you'll find in the ganalytics module folder. As this module is no longer being updated, I chose to edit this file directly rather than add an override. So, in version 2.3.4 of the module, line 539 reads: 'price' => number_format($product['price'], '2') This is the wrong number format, as it retains the comma thousands separator (which breaks GA). Change this line to: 'price' => number_format($product['price'], 2, '.', '') Which removes the comma and means the correct price is sent to GA. Here's some things that helped me arrive at this solution: Chrome extension - Google Analytics Debugger Add this to Chrome, and you get a read-out in the developer console of all the info that is being sent to GA as you browse your website. Very handy indeed! Github repository for the ganalytics plugin Can be found here: https://github.com/PrestaShop/ganalytics There is a new version of the plugin (2.4.0) but it was never released. However, all the code is there for you to use, and one of the changes addressed was the above formatting issue. So, I hope that's useful for somebody else. Now onto my second GA issue, lack of 'Add to Basket' events ... Andrew Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now