Tracking users with a unique ID over time

I am a newbie and yet to install piwik.

I am interested in doing a lifetime value analysis for a website. For this I want to be able to track “user1” from his first visit, till date. Basically, a unique ID to a new visitor which is again mapped to, when the visitor returns back after a day or two. Currently, as per my understanding :
(please correct if I am wrong)
In the Tracking API, one of the HTTP GET parameters is “_id” - unique user ID.

So my question is if it is possible to persist this value for the same user across multiple sessions over a period of time (say more than a month). So that, ultimately, I can track users and fetch data about all their sessions from the database ?
I am not interested in reports and I would manually pull data from the database and perform analysis.

i’d recommend to use &cid parameter which requires the token_auth

Also this ticket will help futher once we implement it (hoefuly 2-3 months)( Accurate User Detection cross devices: User ID (set in JS and all other clients) · Issue #3490 · matomo-org/matomo · GitHub

@Matt Thank You for this quick a reply.

Looking at the ticket, I am guessing, by implementing this we’ll be able to track users who have logged into my site. (or is it not ? )

Typically, I am looking at a scenario where I want to pick a cohort of visitors, say new visitors in a week, and track them over a time frame of say 2 months. Like using cookies, to assign a visitor ID which doesnt lapse after a visit and is used again in subsequent visits.
To look at it, the Visitor Profile feature, gives out almost all visits of a particular visitor. In lay man terms, I want the raw data used for that filtered information. And I want to be able to get pageview level data for each visit. Is this level of data being captured currently ? Can I access the data externally ( as in query from the database)

And in your above made comment, does using the &cid parameter solve my problem ? If you could elaborate, or if you have any document I can myself refer to, it would be great.

Pardon my ignorance on the technical aspects. I am just trying to understand as an end user.

Thanks again