Hello Matomo (Piwik) Community!
My name is Brett Csorba, a Software Engineer out of the US. I’d like to introduce the Matomo Java Tracker project, an easy way to track usage data within your Java applications!
When would I need to track users in a Java application? What’s wrong with front end tracking?
Absolutely nothing! We encourage users to track information where it makes the most sense for them! But in cases where
- you have a 100% Java based application
- you expose a REST layer where users can bypass your front end tracking code
- you have valuable data you want to track that is unnecessary or too sensitive to pass back to the user
the Matomo Java Tracker can help you track the data you need.
What exactly can it track?
We aim to provide the full Tracking HTTP API. If you find we’ve left something out by mistake, let us know!
You’ve sparked my curiosity, how would I use such a thing?
Well, once you’ve installed Matomo and set up your first website, you can grab the latest jar and include it in your project. The dependencies needed to both use and test this library can be found here.
This library is intended to be used for projects that support Java 8. The released binaries are built, tested, and deployed from Oracle JDK 8.
Using this API is as simple as creating a new request
PiwikRequest request = new MatomoRequest(1, new URL("https://my-site.com/action"));
Setting some more information if you want to
request.setActionName("myAction"); request.setPageCustomVariable("key", "value");
and firing the request.
PiwikTracker tracker = new PiwikTracker("http://your-piwik-domain.tld/piwik.php"); HttpResponse response = tracker.sendRequest(request);
Check out this guide to using the API for some more information!
Looks cool so far, can I help out?
Yes! Absolutely! Download the project, try it, break it without mercy! (Just make sure you tell us how.) Contribute to the project or let us know what we can do to it to improve it. As with all open source projects, we need your help to improve it.