[ckan-dev] Google analytics API

Ross Jones ross at servercode.co.uk
Thu Oct 18 15:01:06 UTC 2012


Hi,

I've just pushed a fix to https://github.com/okfn/ckanext-googleanalytics which should resolve the auth issues around fetching data in the background.  It appears not everyone does this, but as we have some similar code for data.gov.uk it made sense to port it over.

Unfortunately since Google killed v2.3 of their API both the authentication required, and the API used has changed.  I've fixed both and so it should work, unfortunately it requires a lot more setup in advance - which is documented in the README under the authorization section.  From a current (non) working installation of the google-analytics you will need to follow those steps ( including the paster getauthtoken once you have the credentials file).  New config options are:

googleanalytics.account = Account name (see top level item in your tree at https://www.google.com/analytics, required as some may have lots of web properties recorded.  For us this is data.gov.uk and so I expect it will be similar to the site name - but not always exactly the same.)

ckan.legacy_templates = true (only required if you are using 1.x branch).

I'd love some feedback on whether this works for you, unfortunately I can't streamline the process much more than the 10 or so steps in the documentation, but if you have any questions please let me know and I'll try and answer (and update the docs).

Ross.


On 11 Oct 2012, at 18:15, Sean Hammond wrote:

>> We're doing some work on this, so hope to have an update for it
>> probably next week.
> 
> Hey, we're also working on ckanext-googleanalytics for publicdata.eu,
> but probably on a different aspect to what you're working on.
> 
> We don't use the code for pulling stats from Google Analytics into CKAN,
> only the reporting of page views etc. from CKAN to Google Analytics.
> I'm looking into updating the code for this to work with CKAN 2.0's new
> template system.
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev





More information about the ckan-dev mailing list