Can I Write Analytics Data using REST?

Hi. I’ve been playing around with the REST interface (using Ruby and the rest_client gem), and it’s pretty cool to have programmatic access to Piwik in Ruby.

We’d like to post data to the Piwik data store for testing purposes. We’d like to do that remotely, and in Ruby. However, I couldn’t find anything in the API for writing data, only for reading it.

Is this possible?

Thanks,
Keith

Yes it is possible, in fact piwik.js itself uses a REST API to record all data. However, it is not documented explicitly, but you could easily reverse engineer by looking at Tracking API - Analytics Platform - Matomo (there is some basic doc in this page)

but for advanced uses, look at the PHP client source code, eg. http://dev.piwik.org/trac/browser/trunk/libs/PiwikTracker/PiwikTracker.php#L802

Thanks, Matt.

I had found this link for a formatted version of piwik.js:

http://dev.piwik.org/trac/browser/trunk/js/piwik.js#L1

It’s a lot easier to read than the one sent to the browsers.

Has this file changed in 1.6? If so, is there a formatted version of the new piwik.js available anywhere?

Thanks,
Keith

the one you linked is always the latest version

Matt -

Excellent!

Thanks,
Keith