Welcome Guest ( Log In | Register )



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Google Analytics Tracking Code Position
mHelmy
post Nov 4 2007, 04:36 PM
Post #1


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 41
Joined: 22-July 07
Member No.: 23,529



Are there any different tracking results when placing google analytics tracking code at the beginning (after <body>) or at the end (before </body>) ?

I post this question because I think a heavy site will load slower so it can be failed to load all site's contents and GA tracking code at the end of the site will not be loaded and it will affect the counter.

Any experience about this ?
Go to the top of the page
 
+Quote Post
vujsa
post Nov 5 2007, 03:12 AM
Post #2


Absolute Newbie
Group Icon

Group: Admin
Posts: 887
Joined: 20-February 05
From: Indianapolis, Indiana, USA (Midwest)
Member No.: 2,714



Well, I started using Google Analytics three days ago since my built in web stats component is using a very large amount of space in my database. I wanted to find a way to replace it and save the space used so I signed up for Google Analytics. I did as suggested and placed my tracking code right before </body>.

There is a very large difference between what Google shows my traffic as and what my built in system.
For example, yesterday, my built in system told me that I had 2684 page views (not visitors but actual page loads) but Google only shows 773 page views. I checked the server logs and found that 2684 was the correct amount.

Maybe I'll try placing the tracking code at the beginning of the page instead of the end and see if it helps.

I would have to say that other than the fact that Google Analytics is incapable of providing accurate statistics, the tool does offer a lot of insight to traffic patterns on your website. The bounce rate alone tells you whether or not the content on your pages is useful or not. Having a better idea of where your visitors come from and a clean organized way to view your stats is priceless.

vujsa
Go to the top of the page
 
+Quote Post
Chesso
post Nov 5 2007, 04:21 AM
Post #3


Teh Coder
Group Icon

Group: Members
Posts: 1,053
Joined: 18-April 06
From: Australia
Member No.: 12,833



Wow that sounds good, I haven't heard of this yet.

But that is a nasty little innacuracy.

I would probably contact them and explain it, there might be a good reason why.
Go to the top of the page
 
+Quote Post
mHelmy
post Nov 5 2007, 05:52 AM
Post #4


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 41
Joined: 22-July 07
Member No.: 23,529



and by the way, google analytics tracking code is a javascript code. so it won't count traffics from non-javascript browser.

I also have built in wordpress statistic using a plugin, and it records all traffics.

But I heard there are some visitor tracking softwares in cpanel, maybe they can be more accurate.

From replies above, google analytics seems useless. But look at html page source of this forum, google analytics tracking code is placed right after <head> tag...
Go to the top of the page
 
+Quote Post
Chesso
post Nov 5 2007, 06:14 AM
Post #5


Teh Coder
Group Icon

Group: Members
Posts: 1,053
Joined: 18-April 06
From: Australia
Member No.: 12,833



Oh right that makes sense about the JS code.

Is there not an alternative method that is more reliable?

Can PHP be of any help possibly?
Go to the top of the page
 
+Quote Post
vizskywalker
post Nov 5 2007, 08:04 AM
Post #6


Techno-Necromancer
Group Icon

Group: Members
Posts: 1,018
Joined: 13-January 05
From: The Net
Member No.: 2,127



One thing to remember is that Google Analytics (I believe) uses a slightly different definition of "page view" than we do. I'm not sure why, but it's the only thing I can think of for the discrepancy. I've been the only person (pretty much) looking at my site while it undergoes development and testing, so I know very well how many page views there are, upwards of 100 because I keep refreshing. Google Analytics doesn't count many of these as separate page views, instead, it seems to simply keep that count as time on the page. So perhaps for each visit, a jump from homepage to another page back to homepage counts as 1 view, since it is one person viewing the page on one visit, even though it is two loads. I think that is how the calculation is done. It doesn't seem to be total page views, but visits to that page. Also, I haven't noticed a difference depending on where the code is placed. I agree that the end is best, because it doesn't cause a slowdown of the page loading.

Edit: I just stumbled across something on the Google Analytics help that confirms this.
QUOTE(Google)
In Analytics, if a user comes to your site twice within thirty minutes without closing their browser, they'll register as one visit. Other web analytics solutions may treat this behavior as two visits, depending on their definitions.
For the full article, which explains in pretty good detail differences between analytics and other stat generators, see this help page.

~Viz
Go to the top of the page
 
+Quote Post
Chesso
post Nov 5 2007, 08:39 AM
Post #7


Teh Coder
Group Icon

Group: Members
Posts: 1,053
Joined: 18-April 06
From: Australia
Member No.: 12,833



Ahhhhh yes that would certainly make sense.

Although it slightly complicates the data lol.
Go to the top of the page
 
+Quote Post
ethergeek
post Nov 5 2007, 05:47 PM
Post #8


Premium Member
Group Icon

Group: [HOSTED]
Posts: 393
Joined: 9-March 07
From: Tucson, AZ
Member No.: 20,794



I always put my GA track code at the bottom of my pages...the reason being, is that I don't want the script load tying up my page load on browsers that don't pipeline and evaluate the JS before building the DOM (most mobile browsers).

I've noticed that the GA code can sometimes be very slow to load...and if it makes the page unusable, then all GA is gonna see is the visitor that won't ever come back biggrin.gif
Go to the top of the page
 
+Quote Post
Arbitrary
post Nov 23 2007, 11:46 PM
Post #9


Premium Member
Group Icon

Group: [HOSTED]
Posts: 363
Joined: 17-June 06
From: Adblock life
Member No.: 13,992



QUOTE
In Analytics, if a user comes to your site twice within thirty minutes without closing their browser, they'll register as one visit. Other web analytics solutions may treat this behavior as two visits, depending on their definitions.
Ohhh, now that would explain very well the huge discrepancy. smile.gif I was thinking that there couldn't be a few thousand visitors to vujsa's site that disabled javascript or didn't load the page up to the beginning of </body>. So basically Google Analytics only registers unique hits rather than all hits. I suppose, though, some people may find it more useful for Google Analytics to register both unique and all hits just so they can see the differences.

QUOTE
Can PHP be of any help possibly?
Yeah, if you were doing it on your own server, you could definitely use php to keep track of hits. But Google can't since it's doing it from theirs. They basically have to use javascript because they don't have access to your server. Which basically means that their hits would be off by a bit (probably not that much off since not that many people actually disable javascript.)

QUOTE
Are there any different tracking results when placing google analytics tracking code at the beginning (after <body>) or at the end (before </body>) ?

I post this question because I think a heavy site will load slower so it can be failed to load all site's contents and GA tracking code at the end of the site will not be loaded and it will affect the counter.

Any experience about this ?
While this may be possible, I don't think it's all that likely that it would actually happen. But just in case, it's probably better to put the code at the beginning of your site just in case.
Go to the top of the page
 
+Quote Post
muztagh
post Dec 10 2007, 08:10 PM
Post #10


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 19
Joined: 5-October 07
Member No.: 25,346



I have found a tip on the web and tried it and the page load became faster.
The tip is host the "urchin.js " file locally means download it from the google website and upload it to your web server, and do not forget to update the link in the google analytics tracking code. Before it is "www.google-analytics.com/urchin.js" now it should be "www.yourdomain/urchin.js".

The reason behind this technique is some times google analytics website may be very busy and loads the urchin.js file very swlowly on your website but if you place it on your server it will be downloads at the same time with your webpage and does not effect the speed. I found it extreamly conving especially for websites hosted far from google data center.
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Google Webspace(21)
  2. The Bad Side Of .....google(50)
  3. The Hacker's Google(29)
  4. Rate Google On A Scale Of 1-10(59)
  5. Google - How To Hit The Top(13)
  6. SiteAdvisor: Search Engines Take Users To Spyware Sites(11)
  7. Google- Changing The Search Preferences!(3)
  8. How Long Does It Take To Be Listed On Google?(15)
  9. Strange Google(7)
  10. Google(3)
  11. New Universal Search By Google(1)
  12. Google Webpages!(16)
  13. Removing Information From Google Search Engine(8)
  14. Google Problem(5)
  15. Google Launches Us Wireless Crusade(0)
  1. Fun Answers Google Will Give You(10)
  2. Submit(3)
  3. Google Wants You To Share Stuff(4)
  4. Do Google Search Better Than Yahoo?(15)
  5. Tips To Earn In Google Adsense(7)
  6. Does Google Provide This Tool?(9)
  7. Do You Like Google?(32)
  8. My First Google Error(8)
  9. Google Servers(2)
  10. Geocamming On "google" .....look At What They Are Watching........(2)
  11. How To View Live Traffic Cameras Using Google(3)
  12. Is The Sandbox Only For Google?(0)
  13. Google Apps(0)


 



- Lo-Fi Version Time is now: 5th September 2008 - 05:19 AM