|
|
|
|
![]() ![]() |
Nov 4 2007, 04:36 PM
Post
#1
|
|
|
Member [ Level 1 ] 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 ? |
|
|
|
Nov 5 2007, 03:12 AM
Post
#2
|
|
|
Absolute Newbie 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 |
|
|
|
Nov 5 2007, 04:21 AM
Post
#3
|
|
|
Teh Coder 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. |
|
|
|
Nov 5 2007, 05:52 AM
Post
#4
|
|
|
Member [ Level 1 ] 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... |
|
|
|
Nov 5 2007, 06:14 AM
Post
#5
|
|
|
Teh Coder 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? |
|
|
|
Nov 5 2007, 08:04 AM
Post
#6
|
|
|
Techno-Necromancer 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 |
|
|
|
Nov 5 2007, 08:39 AM
Post
#7
|
|
|
Teh Coder 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. |
|
|
|
Nov 5 2007, 05:47 PM
Post
#8
|
|
|
Premium Member 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 |
|
|
|
Nov 23 2007, 11:46 PM
Post
#9
|
|
|
Premium Member 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. 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>) ? 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.
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 ? |
|
|
|
Dec 10 2007, 08:10 PM
Post
#10
|
|
|
Newbie [ Level 2 ] 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. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th September 2008 - 05:19 AM |