Opened 2 years ago

Closed 2 months ago

Last modified 2 months ago

#3079 closed New feature (answered)

Python Tracking API and Analytics API clients

Reported by: nkuttler Owned by:
Priority: normal Milestone:
Component: Core Keywords: third-party-plugin
Cc: Sensitive: no

Description

Hi. I've written a simplified python tracking API class. It was written for a client so I have only implemented a subset of the features, and the class is Django-specific. But the code should be reasonably easy to extend and port if anybody else needs it.

The code is at https://github.com/nkuttler/django-piwik-tracking

Seems to work for me so far but some more testing is needed.

Change History (19)

comment:1 Changed 2 years ago by matt (mattab)

  • Milestone set to Third Party Piwik Plugins
  • Priority changed from normal to low

comment:2 Changed 2 years ago by nkuttler

Btw, at the moment the work is happening on the more_features branch if anybody is looking at this. I have started the work to support more features and have dropped the Django dependency.

comment:3 Changed 2 years ago by nkuttler

The project was renamed and moved:

https://github.com/nkuttler/python-piwik-tracking

The Django dependency is gone.

comment:5 Changed 2 years ago by nkuttler

Oh well, only implementing the tracking API didn't make much sense as it's not possible to verify in unit tests that the data was submitted properly. So I have started to implement the analytics API as well and renamed the project again to reflect the new scope. Certainly the last time.

Source: https://github.com/nkuttler/python-piwikapi

Docs: http://piwikapi.readthedocs.org/en/latest/index.html

Still in alpha.

Btw, could somebody remove both keywords and add Python Piwi API or somesuch?

comment:6 follow-up: Changed 2 years ago by matt (mattab)

  • Keywords PiwikTracker Python Django removed
  • Priority changed from low to normal
  • Summary changed from Python tracking API to Python Tracking API and Analytics API clients

nkuttler, really well done! excellent work...

Currently we offiially advertise the PHP and Java Analytics API on the Tracking API doc page. Also in our recent blog post from yesterday we only mention php/java API: Mobile app analytics

Is the Python Tracking API stable? would you feel confident advertising it on the piwik.org website tracking api page? Thanks!

comment:7 in reply to: ↑ 6 Changed 2 years ago by nkuttler

Thanks matt!

The tracking API is pretty stable. With today's push to github everything that doesn't involve cookies should be implemented and unit tested, but I'll have to check that again once I decide how to test the session stuff.

I think it's ok to advertise the tracking API as more testers would be good. I hope to make a 0.2 release this or next week with complete unit testing and docs for the tracking API. Then it will be ready for the official tracking API doc page.

comment:8 Changed 2 years ago by matt (mattab)

Let me know when you're happy with your code and i'll update the page. Then more users will be able to find it. We can also announce it on the blog and changelog for the next release.

  • great to hear you are writing tests for it :) what is your strategy for tests?
  • would you consider committing the code to Piwik SVN in the future?
  • can you please put all the code under BSD license?

Thanks!

comment:9 Changed 2 years ago by nkuttler

Will do!

I have a few tests for the classes themselves, exceptions etc. Most of the tests check that the submitted data was received by Piwik, either by checking the debug output or by querying the analytics API.

I think I'll refactor the debug parsing to query the API as well, that seems better. Probably not for the release though.

Of course the code can be added to SVN. Development should be done on git/github though, I guess I'll document that just in case.

The code is already licensed as BSD :-)

comment:10 follow-up: Changed 2 years ago by nkuttler

I'm a little confused with cookie handling in the PHP tracking API. There are methods like setCustomVariable() that I would have expected to set cookies, or that Piwik would set the cookies when I do the tracking request. However, it seems like it assumes that cookies are always set through JS? Just wondering what the point of setCustomVariable() in PHP is then?

Or maybe there's a better place to ask if I have generic API questions?

comment:11 in reply to: ↑ 10 ; follow-up: Changed 2 years ago by nkuttler

Replying to nkuttler:

I'm a little confused..

Oh my I guess I should go out... Piwik would recognize if the custom variables were set through cookies, and setCustomVariable() in PHP is just to submit them manually as the server has no cookies, right? Anyway... will look into this over the weekend :)

comment:12 in reply to: ↑ 11 Changed 2 years ago by matt (mattab)

Piwik would recognize if the custom variables were set through cookies, and setCustomVariable() in PHP is just to submit them manually as the server has no cookies, right?

Yes correct, the PHP client does not set /forward first party cookies, but it will read the existing javascript cookie if any was set by javascript for this user.

comment:13 Changed 2 years ago by nkuttler

Thanks matt!

I've made a 0.2 release, but the cookie stuff didn't make it in. I consider this an alpha release and am pushing the code to a few live sites to test it there. I've already found a few things I'd like to add/change before an official announcement. I'll keep you posted.

comment:14 Changed 23 months ago by matt (mattab)

Please let me know when the API is stable, and we could list it on the new page Piwik integration plugins & libraries

comment:15 Changed 20 months ago by nkuttler2

Hi matt, the code is being used by more people now so I consider the API stable for now. Feel free to list my code anywhere you like.

comment:16 Changed 20 months ago by matt (mattab)

Great news. Thank you for your contrib and work!

The Python Tracking API and Analytics API client is now listed on: http://piwik.org/integrate/#python and also on: http://piwik.org/docs/tracking-api/#toc-python-tracker-class

Kuddos for your work!

comment:17 Changed 2 months ago by matt (mattab)

  • Resolution set to answered
  • Status changed from new to closed

I can confirm it is still listed at http://piwik.org/integrate/#programming-language-platforms-and-frameworks

Hope your library is getting more users and that it works well. Keep up the good work!

comment:18 Changed 2 months ago by matt (mattab)

  • Keywords third-party-plugin added

Adding third-party-plugin tag to all Piwik 1.x third party plugins. For more information, please visit the Developer docs, the Plugins Marketplace, the themes Marketplace and see #4607

If you have any question or feedback, get in touch in our Piwik developers forum. Happy new year 2014!

comment:19 Changed 2 months ago by matt (mattab)

  • Milestone Third Party Piwik Plugins deleted

Milestone Third Party Piwik Plugins deleted

Note: See TracTickets for help on using tickets.