It’s no secret that tracking purchase information is the most valuable metric related to store success measurement.
But that isn’t all you need to track, and I recommend including visitor information like page views or unique users. You should also take into account their location when they visit your store as well as what kind of behavior he/she has while browsing.
A lot of website owners are using Google Analytics for tracking user-related information. Does PrestaShop work with Google Analytics? PrestaShop has its statistic gathering engine, but store owners could use Google Analytics too. There are multiple ways to add Google Analytics tracking code: modifying the template file and using addon or theme settings.
Let’s explore how to add google analytics code and how to fix some common issues related to tracking visitors.
- Add Google Analytics Code Using PrestaShop Addon
- PrestaShop User ID Tracking in Google Analytics
- Anonymize IP in Google Analytics Tracking Code for PrestaShop
- Disable Google Analytics in PrestaShop Back Office
- How to Test Google Analytics Code in PrestaShop
- Add Google Analytics to Header.tpl PrestaShop Theme File
- PrestaShop Stats vs. Google Analytics
- How to Disable PrestaShop Stats
- How to Add Google Tag Manager to PrestaShop
- Conclusion
Add Google Analytics Code Using PrestaShop Addon
The correct and official way to install the Google Analytics tracking code is to use the free Google Analytics module for PrestaShop.
Go to your store back office, click Modules, then the Module Catalog sidebar menu. In the search bar, type google analytics
. This will bring lots of addons, so be sure to find the Google Analytics addon made by PrestaShop.

Click the large Install
button on the bottom.
After installation, you can click configure button at the bottom. Or if you already closed the page, navigate to Modules, click on Module Manager, and in the search bar, type Google Analytics
again – this will bring addons that you have already installed.
Enter the Google Analytics Tracking ID
you received for your Google Analytics property in the Settings form.
This form holds a few other options that are worth using.
PrestaShop User ID Tracking in Google Analytics
If you enable this option, PrestaShop will send a User ID to your Analytics report for every tracked record.
It is a valuable option to enable because then you can track purchase funnels. But that deserves another topic.
Anonymize IP in Google Analytics Tracking Code for PrestaShop
If your store is located in the US, but your users visit the store from Europe – you have to comply with GDPR law. That law has strict rules about users tracking. One of these rules includes users’ IP tracking – you are not allowed to keep user IP records.
So the best would be to enable the Anonymize IP
option in the Google Analytics PrestaShop addon settings page. This will not send IP addresses, but that won’t hurt any geolocation or any other metric in your Analytics reports.
Google Analytics is smart enough to hash IP addresses and not store them anywhere, making your tracking compliant with GDPR.
Disable Google Analytics in PrestaShop Back Office
Do not track your staff members with Google Analytics.
Tracking staff members will add additional metrics to your geolocation and will lower down your conversion metrics.
Google Analytics on the back office will slow down work for your staff a bit because of tracking.
Your pages reports might include URLs from the back office that you are not interested in at all.
So never enable this option.
How to Test Google Analytics Code in PrestaShop
If you have enabled tracking code, you might want to test if tracking works properly. First, go to Google Analytics and click Real Time. Then refresh your storefront office (landing page/homepage), and you should see stats increase right in your Google Analytics:

If you don’t – maybe you have an adblocker running? If so – disable it and try again. Or try again with a different browser if you have (Firefox, Chrome, Edge, Safari).
If nothing shows in the Real Time view after all these steps, you will need to clean up store cache (navigate to the back office, click on Advanced Parameters, Performance page, and there you will find few buttons to cleanup cache). Then repeat test actions.
Add Google Analytics to Header.tpl PrestaShop Theme File
Five or more years ago, it was trendy to insert Google Analytics tracking code directly into the PrestaShop theme files (header.tpl
). Of course, you can still do that, but there is no real reason to go this way when we have an official addon for that.
If you still want that, navigate to the header.tpl
file in your PrestaShop file system and add entire analytics code between {literal}
and {/literal}
tags like so:
{literal} window.dataLayer = window.dataLayer || []; function gaInit() { dataLayer.push(arguments); } gaInit(\'js\', new Date()); gaInit(\'config\', \'CODE\', { \'anonymize_ip\': true });
function gtag() { dataLayer.push(arguments); } </script> {/literal}
Be sure to recompile templates or cleanup cache in PrestaShop store back office, Advanced Parameters, Performance page.
PrestaShop Stats vs. Google Analytics
Both a great statistic tools to use. But in PrestaShop Stats, you will see a bit bigger numbers than are in Google Analytics. That is because PrestaShop tracks everything in the backend (server) while Google Analytics does tracking by using JavaScript external code. And adblockers block external codes, so not all users are tracked.
That does not mean that Google Analytics is worse. On the contrary, most marketing and sales companies trust this data much more than actual (accurate) data because Google Analytics is an industry-standard.

And Google Analytics gives lots of options to customize, filter, and analyze reporting. It supports creating different views for different areas of expertise. Marketing teams can have information about users, geolocation, traffic sources, and channels. Sales teams can be only interested in revenue tracking and related metrics.
PrestaShop stats only have metrics filtering, and that makes this tool a bit useless. Furthermore, it does not offer exporting ability (Google Analytics does), making metrics useless if you want to share them outside the PrestaShop store back office.
How to Disable PrestaShop Stats
If you are using Google Analytics for user tracking, it would be the best to disable PrestaShop Stats.
This will speed up your store a bit.
There is no one option to disable PrestaShop stats. Everything in PrestaShop is an addon, so there are addons for stats too.
Navigate to the back office, click Modules, and in Module Manager, enter stats dashboard
. Then, disable all addons that have these words in the description of the enabled module.

How to Add Google Tag Manager to PrestaShop
Google Tag Manager is a “next level” Google Analytics tracking code. While Google Analytics alone can track your customers’ behavior, Google Tag Manager allows controlling the entire marketing suite for your ecommerce.
With Google Tag Manager, you can add various other tracking codes, like Facebook Pixel. You can also setup Google Analytics Goals and Events.
There is an official and free PrestaShop Addon for Google Analytics tracking code, but no official Google Tag Manager addon exists.
How do I add Google Tag Manager to PrestaShop? The only option right now is to locate header.tpl
file in themes
folder and add there Google Tag Manager code there.
Conclusion
Google Analytics integration can add some great benefits to your store success tracking. Especially when you have an Ecommerce tracking option enabled in the Google Analytics property settings page.
Ecommerce tracking adds revenue tracking information: conversations and purchase amounts. That is excellent info right on your Analytics report page!