Google analytics. Where?

Would you folks advise to place it in the header or footer.
my experience i put in the footer. Does it matter?
thx
D

Since the javascript file for google analytics is hosted on a different domain other than your own, the download will be asynchronous, thus won’t much affect page load times. It’s safe to put in the head.

In the head to register all visits.

Force, Picnic, thank you both. will do

I have successfully used this plugin on all my WP sites:

Just enter your GA ID and save. GA will start tracking within a minute or so.

why bother w/a plugin when google does it?

One could also say “Why bother with Google Analytics when WordPress Stats does it?”

well where? I have not seen a metrics/visitor analysis/tracking that is native to wp. Or at least not in the wp admin panel.
D

OK, you caught me :shifty:

There used to be the WordPress.com Stats plugin.

WordPress.com stats has merged into Jetpack. Please use Jetpack instead of this plugin.

WordPress.com stats has merged into Jetpack and all future upgrades to WordPress.com Stats will only be available in Jetpack. Jetpack connects your blog to the WordPress.com cloud, enabling awesome features. Get Jetpack now!

There are many plugins and services that provide statistics, but data can be overwhelming. WordPress.com Stats makes the most popular metrics easy to understand through a clear and attractive interface.

your idea of what “most popular metrics” are might differ.

These may or may not be good enough for you http://en.support.wordpress.com/stats/

And just because WordPress is closely tied to Automattic and shows both Akismet and Jetpack in the AdminCP doesn’t really make them “core”, though I imagine they’re well integrated, or at least would hope so.

Why not be consistent and place it at the very bottom of the HTML where you place ALL JavaScript. If someone stays on your page for such a short time that the HTML doesn’t fully download then they probably are not worth including in the count.

Good point. Even though Google says https://support.google.com/analytics/answer/1008080?hl=en&utm_medium=et&utm_campaign=en_us&utm_source=SetupChecklist

  1. Copy and place the code snippet
    Once you find the code snippet, copy and paste it into your web page, just before the closing </head> tag*. If your website uses templates to generate pages, enter it just before the closing </head> tag in the file that contains the <head> section.

    *One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the <head> section, and we recommend placing the snippet at the bottom of the <head> section for best performance.

I guess it depends on what you consider “best performance” to be.

Google is wrong. with their statement about where JavaScript goes - unless they are still looking primarily at Netscape browser users.

It is customary to place JavaScript code immediately before the </body> tag when targetting browsers other than Netscape 4 and earlier. That eliminates any need to test for whether the documenthas loaded or not.

Of course it makes no difference to me where people place their Google Analytics code as I have that script blocked so that it never loads regardless of where people put it. So there page will load just as fast no matter where they put that call.

ok…well, placed in the header. seems to be working fine and causing no issues.
Thank you all. And Mittineague for the jetpack info i’ll keep it mind & perhpas try both on the next site so i can compare.
D

I add it to the specific pages I want to track (normally just the squeeze pages).

I prefer it in the footer but i am using allinone seo pack plugin it gives an option for placing the google analytics code