Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Tracking API and Analytics API clients #3079

Closed
anonymous-matomo-user opened this issue Apr 3, 2012 · 16 comments
Closed

Python Tracking API and Analytics API clients #3079

anonymous-matomo-user opened this issue Apr 3, 2012 · 16 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. worksforme The issue cannot be reproduced and things work as intended.

Comments

@anonymous-matomo-user
Copy link

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.
Keywords: third-party-plugin

@anonymous-matomo-user
Copy link
Author

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.

@anonymous-matomo-user
Copy link
Author

The project was renamed and moved:

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

The Django dependency is gone.

@anonymous-matomo-user
Copy link
Author

ah, nonsense, it's https://github.com/nkuttler/python-piwiktracking

@anonymous-matomo-user
Copy link
Author

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?

@mattab
Copy link
Member

mattab commented Apr 10, 2012

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!

@anonymous-matomo-user
Copy link
Author

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.

@mattab
Copy link
Member

mattab commented Apr 11, 2012

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!

@anonymous-matomo-user
Copy link
Author

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 :-)

@anonymous-matomo-user
Copy link
Author

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?

@anonymous-matomo-user
Copy link
Author

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 :)

@mattab
Copy link
Member

mattab commented Apr 16, 2012

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.

@anonymous-matomo-user
Copy link
Author

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.

@mattab
Copy link
Member

mattab commented Jun 5, 2012

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

@anonymous-matomo-user
Copy link
Author

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.

@mattab
Copy link
Member

mattab commented Sep 1, 2012

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!

@mattab
Copy link
Member

mattab commented Feb 6, 2014

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!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

2 participants