Closed (fixed)
Project:
G̶o̶o̶g̶l̶e̶ A̶n̶a̶l̶y̶t̶i̶c̶s̶ A̶P̶I̶ (obsolete)
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
8 Jan 2010 at 14:05 UTC
Updated:
12 Apr 2011 at 03:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
karens commentedOh, and I changed drupal_message() to watchdog() so you'll have meaningful information if this is running in cron.
I just realized that making the $cid required will break the reports module. I suppose we could make it optional and auto generate some sort of random value if it is missing. But it would be better for the reports module to do something like provide a unique cid for each node and then re-use it so you're not re-requesting the same node's stats more than every 24 hours or so.
Comment #2
jonskulski commentedTesting, subscribing, etc.
@KarenS I agree that the reports module should be responsible for the cid. No need to try to build some sort of unique auto generator.
Comment #3
jonskulski commentedWe've been using this for a couple weeks haven't had any problems. Always refreshed. I think it's solid.
As a side note, a good method to create a per-request cache id could be something like
Then identical requests (any reqeust, not just node requests) would get cached with the same cid automatically and the calling function wouldn't have to worry about caching at all. This goes against my first point but I think it would be reliable enough.
I can reroll unless there are objections.
Comment #4
jonskulski commentedRerolled!
Changes:
Happy caching
Comment #5
jonskulski commentedSetting to review.
Comment #6
omerida commentedInstead of using array_walk_recursive, would it be faster to use serialize?
$cid = md5(serialize($request));
Comment #7
jonskulski commentedI like omerida's idea though I'm not sure on speed. It certainly is cleaner and sufficient.
Comment #8
raspberryman commentedFixed in a new API class - thanks all for your insight! http://drupalcode.org/project/google_analytics_api.git/commitdiff/d50f5e8
Note that we don't have the reports side working with this new code, just the API side. Coming soon :)