I'm trying to figure out the problem below. So far I'm certain that
some profiles work file while others only show a subset of the blocks
correctly and give errors for the rest.
Based on the sites I'm using, I've found that sites that have GA stats
starting around Jan-Mar 2006 have something wrong with them, whereas
sites who'se stats only go back as far as Sep-Nov 2006 work
perfectly.
I suspect that sites with older profiles (from around the time that GA
first started up) are somehow producing different output than newer
ones, and that the plugin is choking on them. Joe Tan probably has a
newer account, so he can't see the problem and probably never will.
PLEASE: anyone who has or had this problem (where some reports work
but others don't), please check how far back your stats go in GA and
reply to me with what was broken and when your stats start. If I can
fix this then hopefully Joe Tan can put the fix into the plugin for
others to use.
Thank you,
Jeremy Clarke
j...@simianuprising.com
tech, GlobalVoicesOnline.org
Anyway, the problem is that if you get a result for any give period
that is higher than 999 Google Analytics gives the number a stupid
formatting that breaks Tantan's script. Instead of writing 1000 they
write "1,000", and the comma and quotes make the plugin not understand
the number and so not give any results. That's why different reports
were broken for different people, they had different results that were
over 1000. The site I work on is very popular, so everything was
broken, lucky us.
I worked through the code and wrote a fix that takes only three lines
of change. I posted the solution on the Google Code project for the
plugin, so it will hopefully be in the next release, but if you want
to fix your copy right away it is pretty easy.
INSTRUCTIONS
* FTP to your wordpress installation and go to the plugins directory
(/wp-content/plugins/)
* Go to the following folder that has the tantan files
/tantan/wordpress-reports/
* Open the file 'lib.googleanalytics.php' to edit. If you can't edit
in your ftp, then just download it and open the file on your computer.
* at line 384 (search for it if you can't see line numbers) you'll see:
$isDate = ($line{0} == '"');
* Change this to:
$isDate = (eregi('^"[a-z]', $line));
* Next go to line 437, you'll see the following two lines:
} else {
$chunks = explode(',', $line);
* Add in the two new lines in between these so it looks like:
} else {
$line =
ereg_replace("\"([0-9]+),([0-9]+)\",\"([0-9]+),([0-9]+)\"","\\1\\2,\\3\\4",
$line);
$line = ereg_replace("\"([0-9]+),([0-9]+)\"","\\1\\2",$line);
$chunks = explode(',', $line);
* Save the file back in the same location.
That's it. The new lines just make sure that the plugin doesn't choke
on the big numbers and gets all the reports working again.
Hope this helps some of you :)
Jeremy Clarke
j...@simianuprising.com
http://simianuprising.com
If you are going to fix it yourself, please copy the code from the
attatched text file instead of the above email!
Sorry for spamming you, enjoy your day!
JEre