Jump to content

Setup google analytics in Prestashop 1.7


Himanshubishtt

Recommended Posts

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.

Link to comment
Share on other sites

  • 4 months later...
  • 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
Link to comment
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}...

Link to comment
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)
Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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.

Link to comment
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 🙂

Link to comment
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.

Link to comment
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?

Link to comment
Share on other sites

  • 2 months later...
  • 7 months later...

Not working for me.

We still can't connect the service, we didn't find any configuration error in GA, this is the Prestashop backoffice message:

"It seems you have a problem with your Google Analytics account. (Code:) Find more information in our Frequently Asked Questions.

Using Prestashop 1.7.8.0

Link to comment
Share on other sites

  • 3 months later...
  • 10 months later...
  • 2 weeks later...
  • 1 month later...

Hi all, I am using prestashop and I need to insert a google tag only in one page of my theme. The page in question is the purchase summary page. 
From the back office I don't have the possibility to edit the page nor to insert the google html tag. The theme I use is Alysum. Prestashop 1.7.8.2. 
I have tried in the past to insert the tag in the entire header of the site but it does not calculate conversions well. 
Can anyone help me?

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