Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Google Analytics code in body
 
prompos123
Jr. Member
 
Total Posts:  5
Joined:  2012-05-23
 

I would like to know why Magento is putting the Google Analytics code in the body area of my pages and not at the end of the head section. Please help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

Because the google analytics code has to be placed at the end of the body section?

 
Magento Community Magento Community
Magento Community
Magento Community
 
prompos123
Jr. Member
 
Total Posts:  5
Joined:  2012-05-23
 
Siggi_Schmitz - 17 August 2012 01:35 AM

Because the google analytics code has to be placed at the end of the body section?

The code is currently positioned at the start of the body section.

The code should be before the end of the head section, just like the instructions at https://support.google.com/analytics/bin/answer.py?hl=en&utm;_id=ad&answer;=1008080

 
Magento Community Magento Community
Magento Community
Magento Community
 
maartenvr
Jr. Member
 
Total Posts:  18
Joined:  2011-11-01
 

This is a simple fix:

Go to app > Design > fronted > base > default > layout > googleanalytics.xml

Find

<reference name="after_body_start">

And change to

<reference name="before_body_end">
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top