Question

I like to keep my websites extremely light and fast, but of course I need some kind of user tracking and analytics.

It seems like Google Analytics always takes significant enough processing time that I'd like to replace it with something faster (and/or hosted locally), perhaps having less features.

I really only care about these metrics: browser, OS, referrer, and # hits per page on a given day or week.

Does anyone have any good suggestions, or is Google Analytics really the best option?

Was it helpful?

Solution

It may be the load time that is the main delay. Try hosting the google analytics javascript file locally.

OTHER TIPS

You should try Asynchronous Google Analytics. It loads GA in the background, so the rest of the content on the page is not blocked from rendering:

http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

Additionally, since you first asked this question, Google has upgraded their serving infrastructure. It's now faster, and much more reliable than it was in 2008. For most sites, it's better to use Google's CDN instead of hosting ga.js yourself. Since the official ga.js is on so many sites, most users will have it in their browser cache.

I second hosting the GA javascript file yourself - the only downfall is that if google updates the file your copy will be old and you may miss out on certain features - however you could mitigate this by having a script pull down the latest version each week...

The benefit of hosting yourself is you have complete control over caching etc, and there are less DNS lookups required for your site.

The other issue your probably facing is the delay (which is up to 24 hours) for the data to be updated, but for something that costs nothing I'm not complaining too much :)

I can't believe, that no one has suggested Piwik. In my opinion, it's THE best alternative to Google Analytics out there. It is also coming to full maturity in a couple of weeks.

You should definitely check it out!

a good alternative is reinvigorate. It gives you stats in "real time" and (in my opinion) is a little faster, but it doesn't have as many options as g-analytics.

Loading the urchin.js script as the very end of the page shouldn't slow page-loading down (as it will load your web-page, then contact Google Analytics). That also means it wont freeze your page if the urchin.js URL is temporarily unreachable for whatever reason (say, a slow DNS lookup)

Routinely download urchin.js and serving it locally will speed things up too. Updating it once an hour would be more than enough (given that it usually gets one request per page-view, once an hour is trivial)

I guess if you are really concerned, you could look into modifying urchin.js to make it less resource intensive, or working out what it does, and simplifying it (I would recommend checking if someone else has already done this first), but I don't think the JS execution time will be slowing your web-page down noticeably

The problem you're experiencing is just standard I/O blocking whilst javascript loads.

Take a look at this solution: http://lyncd.com/2009/03/better-google-analytics-javascript/

This should process the Google Analytics after the page has loaded.

For the metrics you need, you could use the web logs created by Apache/IIS.

You could then remove the analytics code.

you can subscribe to Google Analytics JavaScript Tracking Code Changelog
http://code.google.com/apis/analytics/docs/gaJS/changelog.html
to see if a new version is available to update the ga.js locally


I also encounter this new Asynchronous Snippet
http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
It activates Google Analytics tracking by inserting ga.js into the page. but It takes advantage of browser support for asynchronous JavaScript to enhance the speed in which the tracking code is loaded

FoxMetrics seems to work super fast. They are still in beta but it looks promising.

You can simply get hold of your logs and analyse them with a tool such as WebLog Expert Lite to get those metrics.

WebTrends is a pretty effective "paid" service ... though I gotta say, the wiz-bang features of Google Analytics are way cooler.

I've previously had a quick look at Mint, which looks interesting. But I have no information about the speed, and it costs $30 per site.

I'm a fan of Statcounter. It seems less intrusive that some of the free tools I've tried and I've never had it make anything seem sluggish. The log size for free accounts is the last 500 hits, but that's expandable for a fee.

For live tracking you could also try Woopra. It is pretty stable and fast, but only allows for 10.000 pageviews a day currently as they are still in Beta. Thye have some nice feature, like live chat with your visitors.. It'not so good for conversion tracking though, but could be overcome by using good parameters in your url and ads.

AWStats will give you very thorough and well-presented stats just by parsing your log file daily. It also has a lightweight JS for more advanced stats like plugins and screen size.

Because not all browser support async loading of scripts as the current Google Analytics script uses I would still load the script only after the DOM is loaded:

// first thing to do, make sure _gaq is defined:
var _gaq = _gaq || [];

// set your account settings:
_gaq.push(['_setAccount', 'UA-XXXXX-X']);

// queue trackpageview whenever you want :)
_gaq.push(['_trackPageview']);

//////////////////////////////////////////////////////////////////

(function($){
    // load the GA script only after the dom is ready
    // for simplicity using jQuery, of course you can just listen
    // to the DOMContentLoaded / window.load event
    $(function(){

        // standard code provided by google to load the GA script
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

    });
})(jQuery);

//////////////////////////////////////////////////////////////////

// if the script is already loaded, it will execute the tracking request, otherwise it's in the queue
_gaq.push(['_trackEvent', 'Videos', 'Play', 'Gone With the Wind']);

DEMO: http://jsfiddle.net/roberkules/xyU8K/

If you're for some reason forced to use the old version of the Google Analytics script (without queuing) you have to write the queue functionality yourself (which is quite easy) and handle the queue once the script is loaded (which is still loaded only after the DOM is ready).

Mixpanel offers realtime analytics.

Not to repeat an above poster, but I also love Mixpanel. It's highly customizable, extremely user friendly, is in REAL (REAL REAL) TIME, and has some incredibly robust and powerful tools - the type of tools you can choose to learn or not to learn yet still get an amazing value.

Knowing some PHP/javascript is required to take full (well, to use 100% of what they offer requires a bit more than that; however, hitting that 100% means you're doing some beyond ridiculous traffic analytics) advantage of all it's amazing abilities, but it's highly customizable to your skill level & the intensity at which you want to incorporate any programming language, script(s), or tasks(s) into it. They're customer service is great too.

They offer it for free for quite a large amount of traffic too; although, if you hit the point where you'd have to spend anything it can get a bit $$$. If you have that much traffic though, you shouldn't have much problem affording the service.

No, I don't work for Mixpanel nor am I an affiliate of them in any way.

I've only used Google Analytics; however, if you'd like to continue to use Google Analytics, you can improve the speed by:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top