PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

[SOLVED] Google Analytics code should be in the <head> section!

10 replies to this topic
#1
Housy

    PrestaShop Apprentice

  • Members
  • PipPip
  • 157 posts
Hello,

I'm using Prestashop 1.3.5 and i noticed that if i add google analytics code through built-in module, it doesn't work properly, becuase module adds code into body section (into footer, if i'm being more precise), instead of the head section.

How to fix it? If i add this manually it doesn't work.

Cheers

#2
Housy

    PrestaShop Apprentice

  • Members
  • PipPip
  • 157 posts
If i add Google analytics code just before </head> tag, i get server error (500).

Why is that?

Even if i transplant Google Analytics module into Header, it doesn't work, nothing happens, the code is missing when i look for the source code in the browser.

I just hope, this guy in THIS THREAD will fix the problem, cause i'm not that smart =/

Thanks

#3
abilas

    PrestaShop Apprentice

  • Members
  • PipPip
  • 26 posts
Google Analytics doesn't go in the header, it must go before the closing </BODY> tag. The reason is that google analytics watches every page that is created and provides stats on every page that is being accessed.

I suggest you take a look at setting up goals within your shop so that you can track each customer that comes to your site.

Cheers
T :)

#4
Housy

    PrestaShop Apprentice

  • Members
  • PipPip
  • 157 posts

From 1295279178:

Google Analytics doesn't go in the header, it must go before the closing </BODY> tag. The reason is that google analytics watches every page that is created and provides stats on every page that is being accessed.

I suggest you take a look at setting up goals within your shop so that you can track each customer that comes to your site.

Cheers
T :)


Well, I didn't use goals, i just pasted the analytics code right before </body> and now i get good results =)

I'll also read more about goals =)

Thanks ;)

#5
abilas

    PrestaShop Apprentice

  • Members
  • PipPip
  • 26 posts
[SOLVED] Glad this information helped, google analytics is a powerful tool to help filter down what is being looked at.

Good luck with your shop.

#6
abilas

    PrestaShop Apprentice

  • Members
  • PipPip
  • 26 posts
Will you also change the subject line to read [SOLVED] etc... so users are informed that this has been resolved.

Thanks

#7
Housy

    PrestaShop Apprentice

  • Members
  • PipPip
  • 157 posts
I did =)

Thanks again ;)

#8
easyweb

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts
Sorry for the noob question...but how do I add the google analytics code to my website?
In which file is the body tag located?

#9
mayid

    PrestaShop Apprentice

  • Members
  • PipPip
  • 39 posts
I think Google changed it's mind, and now it wants to add the code in the header. By other side, the code changed. So, module should be updated.

Now i'm facing the same problem than Housy: i cannot position the module in the Head of Pages. It just wont show up.

#10
inveostore.com

    PrestaShop Apprentice

  • Banned
  • PipPip
  • 176 posts
Moving GA code to the head section can make your site slow when Google servers are busy. This is the reason why it is recommended (and PS does do) to place GA code to footer.

#11
aliaspt

    PrestaShop Apprentice

  • Members
  • PipPip
  • 153 posts
Where can I find detailed instruction on how to insert the new Google Analytics code? What file does it go to and do I need to uninstall the old Google Analytics Module 1.2? I am using PS 1.3. The old code is causing error messages during checkout.
Thank you.