Jump to content

Setup google analytics in Prestashop 1.7


Recommended Posts

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 (see edit history)
  • Like 5
  • Thanks 8

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
  • 4 months later...

Hey, I was about to launch my own website and was struggling like you with setting up google analytics, then found this www.nerdpilots.com/store and got done all that was left. Hope it helps.

Share this post


Link to post
Share on other sites
  • 1 month later...
On 5/12/2019 at 8:47 AM, Himanshubishtt said:

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 :)

 

This solution works 100% for PS version 1.7.5.2

Thanks.

  • Like 1

Share this post


Link to post
Share on other sites
  • 4 months later...
  • 2 months later...
On 5/12/2019 at 5:47 PM, Himanshubishtt said:

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 :)

 

Works like a charm (with V1.7.6.5)

To clarify: you have to edit the file header.tpl under your active theme. I put it right at the begin of the file (before {block name...}) just don't forget the {literal} and {/literal}...

Share this post


Link to post
Share on other sites

Hi All!

I configured my shops vapura.cl, sebotanicals.com and gopure.shop first with the GA Module by Prestashop.
The tracking was not enabled on all sites for some reasons, so I ended up adding the tracking code manually as instructed here too.

I have now started to try to build analytics and metrics for growth hacking and have now understood the Prestashop module actually does all kinds of other things as well in addition to adding the tracking code to header. Is this correct??? 

I don't seem to get any enhanced ecommerce tracking. conversions etc in GA at all. Is the Prestashop GA module needed for this or are there other modules to enable full ecommerce tracking features or does it need to be built from scratch? 

Edited by Surffari (see edit history)

Share this post


Link to post
Share on other sites
hace 1 hora, Surffari dijo:

Hi All!

I configured my shops vapura.cl, sebotanicals.com and gopure.shop first with the GA Module by Prestashop.
The tracking was not enabled on all sites for some reasons, so I ended up adding the tracking code manually as instructed here too.

I have now started to try to build analytics and metrics for growth hacking and have now understood the Prestashop module actually does all kinds of other things as well in addition to adding the tracking code to header. Is this correct??? 

I don't seem to get any enhanced ecommerce tracking. conversions etc in GA at all. Is the Prestashop GA module needed for this or are there other modules to enable full ecommerce tracking features or does it need to be built from scratch? 

You need a module to use enhanced ecommerce tracking
The prestashop officer can serve you, although it has limitations
You must buy a module so that the enhanced ecommerce tracking data is more accurate

Share this post


Link to post
Share on other sites
hace 57 minutos, Surffari dijo:

Thanks @gusman126

Can anyone recommend a good module (which you use, not trying to sell)?

Or does anyone have any experience on building the funnel/roi etc tracking themselves?

I have tried several, but in the end I have developed one with the necessary functions.
Others, you can search in addons and ask in the forum, make a new topic

Share this post


Link to post
Share on other sites
  • 2 weeks later...
5 hours ago, jpas81 said:

How I know if it works?

Thanks

Go to your Google analytics account, watch the Real-time traffic. When you browse your web site you should see a change in the pageviews, it will also tell you what page is active.

Share this post


Link to post
Share on other sites

Hello I am on Prestashop 1.7.6.5, I tried to make as told on /themes/sp_shop4u/templates/_partials/header.tpl, with {literal}and {/literal}....but it doesn't stay in the source code of my index page....
I tried also in head.tpl...same thing....

Somebody has any idea about the problem ?
Thanks

Share this post


Link to post
Share on other sites
  • 4 weeks later...
On 5/12/2019 at 12:47 AM, Himanshubishtt said:

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 :)

 

Muchas gracias, funciona muy bien, a mi también me dió error el módulo ya que oslo existe para prestashop 1.6 y no existe módulo ofoicial para prestashop 1.7, con el código manualmente funciona perfectamente.Thanks.

Share this post


Link to post
Share on other sites
  • 1 month later...
On 5/12/2019 at 7:47 AM, Himanshubishtt said:

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 :)

 

Thank You. Nice 🙂

Share this post


Link to post
Share on other sites
  • 2 months later...
On 5/12/2019 at 8:47 AM, Himanshubishtt said:

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 :)

 

Hello, the GA instructions say that this JS code must be placed within the <head></head> tags of the site, while this method places it bellow the </head> tag. Could this cause some issues? Thanks.

Share this post


Link to post
Share on other sites

You must give consent, in the EU it is not useful to add the code, all the pages that have the code added are outside the new regulations and law
you have to use modules and blocking cookies

  • Thanks 1

Share this post


Link to post
Share on other sites

Hello, i have an E-Commerce where Google Analytics don't go, so i have make a new installation of prestashop on another subdomain and instal the Google Analytics official module of Prestashop, insert the ID of google analytics but nothing happen!

I think this must be a simple step, not a so and so complicated things to do, if the Prestashop official module don't go on a new installation, I think that there is a problem of code or java script that stop the flow of the information...

What do you think's about it?

Share this post


Link to post
Share on other sites
  • 2 months later...

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
×
×
  • Create New...

Important Information

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