Changing resolution & cookie settings with Tracking API

On my site I am logging each request to a MySQL database and only later process these logs and feed them to Piwik through the HTTP Tracking API in bulk requests in a PHP cron job (mostly for performance reasons).

On the website I save the users viewport in javascript with cookies, but on the very first request, the viewport is not known (because the cookies have first to be set via javascript), so only on the second page from this visit the viewport/screen resolution is known.

I have noticed that Piwik seems to only “notice” setting the browser resolution on the first request - because when viewing the statistics, most visits have an “unknown” browser resolution and only few people (usually about 10%) of visitors are shown as having cookies enabled - even if I filter for users which clearly have cookies enabled because they successfully placed an order.

Is this intentional, or am I doing something wrong? Is there a way to update the stats for a visit to inform Piwik of changed/now known screen resolution and cookie support?

I have noticed that Piwik seems to only “notice” setting the browser resolution on the first request - because when viewing the statistics, most visits have an “unknown” browser resolution and only few people (usually about 10%) of visitors are shown as having cookies enabled - even if I filter for users which clearly have cookies enabled because they successfully placed an order.

Can you please explain better what you are seeing here, what you saw, and what you expected to see instead?

piwik should measure resolution of visitors on all pages, but it will only record it in the visit row, for the first page view

Ah, thanks for the information. Does Piwik just use the first page for the visit information, or just the first setting of the value (meaning if I do not explicitely set the resolution on the first page, can it be set on the second page view)? Because with custom variables I can still set “new” visit variables on later pages - but maybe that’s just a specific behavior of custom variables.

While working with PiwikTracker - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 I generally found some “holes” in the documentation - I had to find out many things through Google (for example, how to cancel an ecommerce order - but also many details about the API behavior). I guess not too many people are directly using the PHP Piwik Tracker (at least compared to the Javascript version) - is it possible to extend the documentation? I could help with that, if any help is needed.

Ah, thanks for the information. Does Piwik just use the first page for the visit information

it only uses first page for “visit information”

is it possible to extend the documentation? I could help with that, if any help is needed.

Thank you for asking :slight_smile: yes we would love your feedback and help. to be honest the docs are written by Piwik core developers when they write new features (often doc are written by myself). we don’t get much feedback on these docs, but when we do we try to improve them

This PHP tracker documentation here: http://developer.piwik.org/api-reference/PHP-Piwik-Tracker
can be edited by simply editing the text in the Comments in the PHP tracker class at: https://github.com/piwik/piwik/blob/master/libs/PiwikTracker/PiwikTracker.php

So if you edit this file PiwikTracker.php comments, submit a pull request, I could then simply merge your pull request(s) and the doc will be automatically updated few minutes later.

Thanks for the information, I will work on extending the documentation and issue a pull request when something is ready :slight_smile: