ckan / ckan/ideas

Track API usage

Open
#72 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
39
Forks
1
PR merge metrics
No merged PRs in 30d

Description

We track analytics on the front end using Google Analytics or similar (e.g. piwik)

However, we don't track API usage in any systematic way. This would be useful to provide reports to users and also in order to manage API use.
## Proposal

One of the simplest options would be to plug into google analytics system but from the server side using ["universal analytics"](https://support.google.com/analytics/answer/2790010?hl=en&hlrm=de) - there's a [python universal library here](https://github.com/analytics-pros/universal-analytics-python).

```
# as python named-arguments
tracker.send('pageview', path = "/test", title = "Test page")

# as property dictionary
tracker.send('pageview', {
'path': "/test",
'title': "Test page"
})
```

We could also use this to track other activity e.g. certain kinds of events:

```
from UniversalAnalytics import Tracker

tracker = Tracker.create('UA-XXXXX-Y', client_id = CUSTOMER_UNIQUE_ID)
tracker.send('event', 'Subscription', 'billing')
```

Note: afaict alternatives to GA like piwik do not support the ["Measurement Protocol"](https://developers.google.com/analytics/devguides/collection/protocol/v1/)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.