How to track a mobile app with HTTP requests?
This is where the image tracker will start to be handy. In fact, this tracker is doing nothing more than using the API of Matomo in order to send HTTP requests which contain the data that we would like to send.
The advantage of using it in a platform such as App Inventor 2 is that you can use the variables in order to make the data dynamic within the requests.
Ok, let's simply study how the Matomo HTTP tracking API is working.
Here is an example:
As you can see it is composed of a basic URL:
http://localhost/mat311/matomo/matomo.php (which is our tracker).
and two parameters (the one after the ?):
idsite and rec. Both have two values, one for each, 1 for idsite, one for rec.
So this full URL http://localhost/mat311/matomo/matomo.php?idsite=1&rec=1 means that we want to record something within Matomo. Typically if you copy/paste this URL within your browser, you will see that in Matomo:
At this given step, you almost got it. What is left, is nothing more than the additional parameters that you will add in your request.
So to say if you write your request this way:
You will get this:
the list of all the other parameters that you can add are listed within the official documentation of Matomo at https://developer.matomo.org/api-reference/tracking-api
Advantages of the HTTP request method
- Easy to learn.
Drawbacks of the HTTP request method
- If you use it like this the battery life of the mobile users is going to decrease significantly. You need a way to store those requests and send them only when appropriate.
- You need to custom each HTTP request one by one which is a pain.
Last modified: Saturday, 28 December 2019, 3:05 PM