@p-banaszczyk opened this Issue on April 21st 2015

Currently we can use API or the UI to access data on visitor_id level.

Since Piwik has a user_id field that is used more often (e.g AdTruth integration), it makes sense also to allow users to access the data grouped by User ID on both API and UI level.

@ruchitrami commented on April 22nd 2015

+1

@mattab commented on July 14th 2015 Member

Hi @p-banaszczyk

the Live API with visitorId parameter is: Live.getVisitorProfile (idSite, visitorId = '', segment = '') - is your request to add userId parameter to this API?

For other APIs, it's possible to use &segment=userId==XXX to filter for a given User ID. By "Grouping by user_id" did you mean "Filter visitors to a given user_id" ?

@peachp commented on July 27th 2019

I tried something similar with:

https://xxxxxxx.matomo.cloud/index.php?date=2019-07-26&expanded=1&filter_limit=10&format=JSON&idSite=1&method=Live.getLastVisitsDetails&module=API&period=week&segment=userId%3D<a class='mention' href='https://github.com/T'>@T</a>%gmaiiiiil.com&token_auth=xxxxxxxxxxxxxxxxxxxx

It then returned I assume an array of visits, where you can also see userId. So the data could be aggregated I guess.

Is there another way to get something similar like the profile, but aggregated by userId?

@tsteur commented on July 28th 2019 Member

You could do something like UserId.getUsers to get a list of users (note: the result might be truncated depending on your config settings in config/config.ini.php the value for datatable_archiving_maximum_rows_userid_users=XYZ to 50K rows). You can then use these UserIDs to request Live.getVisitorProfile for example.

In Matomo 4 we may be adding a new API Live.getVisitors which has been prepared here: https://github.com/matomo-org/matomo/pull/13414 where you could pass along a segment that says userId is not null

@tsteur commented on July 28th 2019 Member

In general you want to use the UserId.getUsers API though I suppose. Closing this issue for now as I think we have the issue https://github.com/matomo-org/matomo/issues/7732 already and in general things seem maybe possible already.

In the Live API the data isn't grouped though when you apply a userId segment fyi. It returns basically only individual visits from visitors that had a userId

@peachp commented on July 29th 2019

nope, I don't really need the list of users. My master DB will have them.
What I need is the data similar like returned by Live.getVisitorProfile:

https://xxxxxxxx.com/matomo/index.php?......visitorId=970e9d0cd781aed8&method=Live.getVisitorProfile&format=JSON

But for a specific User ID, not visitorId, ideally aggregated. Is it possible with the API?
It feels like accessing raw SQL data might be the only way for now?

@tsteur commented on July 29th 2019 Member

If you pass the segment userId=XYZ then this should work.

@peachp commented on July 29th 2019

Thanks, but since then I realised that the User ID is not suitable for us,
as setting it changes the Visitor so Matomo reports them like two separate
unique visitors. I am trying to solve it with Custom Dimension (Visit
scope). I am basically recording what would be User ID as custom dimension
values and then viewing them under Visitors as well as querying raw SQL
data.

Do you see any potential issues with that?

On Mon, 29 Jul 2019 at 21:12, Thomas Steur <notifications@github.com> wrote:

If you pass the segment userId=XYZ then this should work.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/matomo-org/matomo/issues/7732?email_source=notifications&email_token=ALIFVZK4XIJPHAVJGOVWKITQB5FMVA5CNFSM4BAU7XN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3B3YUI#issuecomment-516144209,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALIFVZOEC5QK2OV6NLYRNE3QB5FMVANCNFSM4BAU7XNQ
.

This Issue was closed on July 28th 2019
Powered by GitHub Issue Mirror