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

Move Analytics Code to After the Start of Body Tag
 
a1anm
Guru
 
Total Posts:  318
Joined:  2009-10-08
 

I want to move my google analytics code so that it appears after the opening <body> tag and not before the closing </body> tag.

I changed (in googleanalytics.xml):
<reference name="before_body_end">

To:
<reference name="after_body_start">

But then the code didn’t show up at all. 

I’m using 1.4.0.1

 
Magento Community Magento Community
Magento Community
Magento Community
 
apexj
Jr. Member
 
Total Posts:  12
Joined:  2009-07-05
 

I’ve got same issue. Any suggestions? Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Willbe
Jr. Member
 
Total Posts:  3
Joined:  2009-12-04
 

Check your design templates in /template/page, all files where <body> tag is. Be sure that getChildHtml(’after_body_start’) is called:

<body <?php echo $this->getBodyClass()?'class="'.$this->getBodyClass().'"':'' ?>>
    
<?php echo $this->getChildHtml('after_body_start'?>
And in file: /layout/page.xml check there is a line
<block type="core/text_list" name="after_body_start" as="after_body_start"/>
before the line
<block type="page/html_notices"....
 
Magento Community Magento Community
Magento Community
Magento Community
 
apexj
Jr. Member
 
Total Posts:  12
Joined:  2009-07-05
 

Thanks, though both of those were changed previously and still no movement.

I’m assuming is there an insert tag that also needs to be placed below the <body> on the layout pages to recognize this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
xpertdev
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2010-10-02
 

Hi
Thanks for the solution.

Thank a lot..

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top