How to handle matomo visitor ID on flutter client

We’re currently developing a flutter app using your package (https://pub.dev/packages/matomo_tracker#using-userid), but we don’t understand how we’re supposed to manage the matomo cookies in a flutter app using your flutter package. Which cookies must be forwarded from the mobile app to the server on which the Matomo Tracker (PHP) runs, such that methods such as getVisitorId() etc. work properly on the backend?

We’ve found this page:

Informing about the cookie names, yet there’s the getCookieName() method from the PHP Matomo Tracker package which sends some kind of unpredictable cookie names using hashes etc.? As the ‘Cookie’ header must be set explicitly within requests coming from the mobile app, we must know exactly how to build the according matomo cookie headers on the client-side, without further information.

We know that can extract e.g. the visitor ID by using MatomoTracker.instance.visitor.id, yet this only gives us the 16-characters long visitor ID. Yet if you inspect the cookies of a running website using matomo, the value of the visitor ID cookie is something like {visitorID}.{timestampOrWhatever?}, and even the name is not simply _pk_id as written in your documentation, but instead it’s something like pk.1.81c7; how are you supposed to determine that cookie name??

Suggestion: Something like a ‘getCookieHeaders()’ method, giving you the cookie headers set for the currently set MatomoTracker.instance in flutter would be really handy for this. The only other option we see is to send the visitor ID (obtained within Flutter via MatomoTracker.instance.visitor.id) with a custom additional HTTP header from our mobile app to our server, and thus customize the entire visitor-ID logic on the server-side for mobile app requests anyways?