Plugin stopped working... Only get page views per visit graph now

1 view
Skip to first unread message

fatback

unread,
Sep 21, 2007, 11:44:22 AM9/21/07
to TanTanNoodles Toolkit
The reports plugin stopped working for me. Only the page views per
visit graph and the new vs returning graphs show up. The page views
has data but the new vs returning say zero/zero. When I select nother
site from my google analytics dropdown list it works fine, but not for
my main site. Weird huh?

Jeremy Clarke

unread,
Oct 11, 2007, 4:17:48 PM10/11/07
to TanTanNoodles Toolkit
Hi everyone who uses the Tantan plugin for Google Analytics.

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

sunburntkamel

unread,
Oct 12, 2007, 9:51:19 AM10/12/07
to TanTanNoodles Toolkit
my stats start april 12th, 2006, and the plugin works fine.

Jeremy Clarke

unread,
Oct 12, 2007, 1:18:59 PM10/12/07
to tantan...@googlegroups.com
Thanks Sunburnt, though after emailing the list I found the real
problem and it's not about age but about popularity! (the two are
linked i guess).

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

Jeremy Clarke

unread,
Oct 12, 2007, 1:23:14 PM10/12/07
to tantan...@googlegroups.com
Oops! I think Gmail may have messed up the formatting on the code
lines I posted above!

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

upgrade-tantan.txt
Reply all
Reply to author
Forward
0 new messages