Forum Moderators: DixonJones

Message Too Old, No Replies

Google Analytics Code Placement

Where is it really supposed to go?

         

Frequent

4:20 pm on Dec 20, 2005 (gmt 0)

10+ Year Member



When I initially set up my Analytics account I placed the code in the header just before the close tag. This first profile worked fine and stats have been tracking.

When I went to add a couple more site profiles for tracking I noticed that the instructions now said to place the code just before the body close tag. I did this on the new profiles and moved the code on the original profile.

These new profiles have been "gathering data" for a few days now with no reports. The original profile is still working fine.

Now, my guess is that it really doesn't matter where the code goes. They ammended the instructions to get it out of the header so pages would load faster.

Am I wrong or is there is some other problem causing the new profiles not to create reports?

Has anyone recently added new profiles and are they actually working or just "gathering data"?

Freq---

Gruntled

1:13 am on Dec 21, 2005 (gmt 0)

10+ Year Member



I just noticed this change in code placement as well, when I added a new profile. Unfortunately, all of my sites are brand new and not generating any traffic yet.

My guess is that it makes no difference where the code is placed.

incywincy

1:57 pm on Jan 13, 2006 (gmt 0)

10+ Year Member



I'm not subscribed to Analytics but my guess is that placing the code just before the body close tag means that if the Google Analaytics server is down the majority of your HTML will have been rendered before you reach the Analytics code. If you placed the code in the head section then the html will not have been rendered when your browser tries to reach the Google server and hangs.