New Matomo Tracking API: Track visits from Mobile apps, Desktop apps… anywhere

Contents

Recently, we released a powerful set of new APIs to track visitors, page views and goal conversions: Matomo (Piwik) Tracking APIs

If tracking visits using Javascript is not an option for you, you can use alternative ways to record visitors, visits, pages and Goal conversions in Matomo:

  1. Simple Image Tracker
    The Simple HTML Image Tracker tag can be used when Javascript is disallowed but pure HTML allowed: MySpace, Ebay for example, but also email newsletters.
    Note: the code doesn’t use Javascript so Matomo will not be able to track some user information such as search keywords, referrer websites, screen resolutions, plugin support and page titles.
  2. Matomo Tracking API
    You can call the Matomo Tracking API using your favorite programming language, over HTTP.
    Matomo comes with the PHP Client ready to use, providing a very easy way to track visits, page views, goal conversions, and also set Visitor details (user agent, language, URL, Referrer URL, etc.).
    Clients for Perl, Python, Java or Ruby will hopefully be contributed by Matomo users in the future. Please let us know if you are interested to contribute your client.
  3. Advanced Image Tracker
    The PHP Client can send direct requests to the Matomo API, but it can also generate an advanced image tag. The advanced image tag requires to be loaded in an HTML context.

Tracking API documentation

Learn more about tracking data using the new APIs in the official documentation: Matomo Tracking API documentation.

How Matomo used the new API to improve code quality and stability

We have made great progress recently regarding our Quality Assurance effort.

Using the new Tracking APIs, we added automated tests that

  1. create website and goals
  2. generate controlled hits to the Tracker
    • tracking pages
      • some of which have excluded URL parameters
    • tracking clicks and downloads
    • tracking Goals
      • matching URLs
      • triggered using the Javascript trackGoal() function
    • for several days
    • for several websites
    • with custom referrers (direct entry, websites, search, campaigns)
    • with custom browsers and OS
  3. generate hits with invalid states
    1. excluded IPs
    2. invalid websites
    3. simulate search bot visits
  4. Using the Metadata API, we get the list of all Analytics Reports API functions available in Matomo.
    We then call each function over http, and record the output XML containing the API output.
  5. We check that the returned XML is the same as the expected XML.

Using these set of tests, we are now able to detect very easily any regression introduced in the Tracking, Archiving or API code.

Tests now run continuously on Jenkins, our build server. Learn more about our QA process and efforts

Feedback

Please let us know what you think in the comments.

Happy Tracking!!

Enjoyed this post?
Join the 160,000+ subscribers who receive the Matomo Newsletter straight to their inbox every month
Get started with Matomo

A powerful web analytics platform that gives you and your business 100% data ownership and user privacy protection.

No credit card required.

Free forever.

Get started with Matomo

A powerful web analytics platform that gives you and your business 100% data ownership and user privacy protection.

No credit card required.

Free forever.