Jump to content
Himanshubishtt

Setup google analytics in Prestashop 1.7

Recommended Posts

Posted (edited)

Hi,

This is for all who likes to add google analytics on their shop.

If you are directly configuring 'Google analytics' by the module don't do it because it'll not work properly. You will get all the insights at first and after some time it'll stop giving insights at all. (Personal experience)

So What I did is add this code in my header.tpl file in template/_partials but don't forget to add {literal}{/literal} at the starting and closing of the tag else you'll get a blank white page.

{literal} <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-134165817-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-*********-*');
</script>  {/literal}

Hope it helps :)

 

Edited by Himanshubishtt
Update

Share this post


Link to post
Share on other sites

Hi,

Do you use google tag manager module at the same time ?

Share this post


Link to post
Share on other sites

Hi, I tried this, however it did not track any revenue in our campaigns (adwords / mailing list) or in the ecommerce section of analytics, did this work for you?

Share this post


Link to post
Share on other sites

I placed it in the header.tpl. I have also tried the Prestashop analytics plugin (did not track correctly) and the a paid for module - Google Analytics Pro - which showed all revenue as direct traffic and did not work with campaigns for adwords / mailing lists etc. I'll give it another go and see if it works and let you know.

Share this post


Link to post
Share on other sites
Posted (edited)

Send me your website URL.

And did you place the code at the top of the header.tpl?

 

Edited by Himanshubishtt

Share this post


Link to post
Share on other sites

Hello, i ve try it with code on top of the theme/partial/header.tpl, i v put between {literal} and {/literal} but that make a blank page.. Wher in the top of filethe code must be placed ?

Google say between <head> and </head>, but there is not in the header.tpl file...

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More