Alex Hardy


Hello there!

Mint inclusion fix for WordPress

I continue to have difficulty with wildly different numbers reported by Mint and Google Analytics. I’m using the Google plugin by Semiologic for WordPress because it tracks outbound links in a handy way, but I just added the Mint JavaScript include code to header.php of my theme.

So far so good, the Google plugin even disables itself when I’m logged in. Alas, the same cannot be said for my Mint include. So all the time I have been logged in to WordPress, writing my fevered thoughts, Mint has been diligently recording pageviews that Google has not. D’oh!

A little poking around in the WordPress source finds my solution: the global variable that holds your user ID while logged in. So a little bit of PHP like so…

global $user_ID;

if (!$user_ID) {
	// Put the Mint JS include here
}

… and presto, one more discrepancy sorted.

I expect it will take a month or two for the stats to even out and for me to be able to confirm that.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Facebook
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Ma.gnolia
  • Technorati

Comments are welcome. Keep it friendly and on-topic please.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>