Closed GoogleCodeExporter closed 9 years ago
I went through and manually ran the query through the API, and the problem is
that
results over 10 million are returned expressed in scientific notation:
1.76160784E8
9.3857385E7
4.2922605E7
3.949009E7
Original comment by austinre...@gmail.com
on 9 Jun 2009 at 12:15
On line 346 the GAPI class incorrectly performs an 'intval' conversion on the
data.
The majority of metrics returned by Google Analytics are integers, but certain
metrics like timeOnPage and CPM are float values.
A quick fix is to change Line 346 to:
$report_aggregate_metrics[str_replace('ga:','',$aggregate_metric->attributes()->
name)] =
floatval($aggregate_metric->attributes()->value);
The correct way to handle this data would be to check the string returned for
decimal
point and use intval or floatval appropriately. Large integers are also
returned by
Google Analytics in 'scientific notation' which can also be understood by
floatval.
This fix will be incorporated into GAPI v1.2 and will be released within the
next few
days.
Cheers,
Stig
Original comment by stigmann...@gmail.com
on 9 Jun 2009 at 3:49
GAPI 1.3 has been released and contains a fix for this issue. Proper float /
integer
detection and conversion for metrics.
http://code.google.com/p/gapi-google-analytics-php-interface/downloads/detail?na
me=gapi.class.php
Cheers,
Stig
Original comment by stigmann...@gmail.com
on 9 Jun 2009 at 1:30
Wow, that was fast, I did notice that incorrect intval, and tried changing that
it to
strval just to see what would happen, but it still came back wrong. I didn't
realize
floatval could decipher that notation though. Awesome
Thank You
Original comment by austinre...@gmail.com
on 9 Jun 2009 at 7:53
Hi again,
Try this new link for version 1.3:
http://gapi-google-analytics-php-interface.googlecode.com/files/gapi-1.3.zip
I have just discovered a 'feature' with Google Code Project that when a file is
downloaded enough, it is locked and cannot be updated. GAPI releases will now
be in
versioned archive files.
Thanks,
Stig
Original comment by stigmann...@gmail.com
on 9 Jun 2009 at 10:24
Original issue reported on code.google.com by
austinre...@gmail.com
on 8 Jun 2009 at 11:55Attachments: