@Romain opened this Issue on January 20th 2020

I updated Matomo from 1.13.0 to 1.13.1 last week.
Since then, my plugin displays incoherent data.

Digging into this problem, I realized that this new version of Matomo introduced a change in the content returned by the API endpoint Live.getLastVisitsDetails. The visitIp key is not included in the JSON response anymore.

Could you include this value again in the response?

How to reproduce

@sgiehl commented on January 20th 2020 Member

That hasn't been changed. The visitIp should still be included.

@tsteur commented on January 20th 2020 Member

@Romain are you using a valid token_auth of a user with at least view access when fetching the list of segments? There was some refactoring which was needed for some issue but it should still behave the same. I was going to say you could workaround by adding a _showAllSegments=1 to the request but I think underscore parameters can maybe not be used. So this might not work.

cc @diosmosis

@tsteur commented on January 20th 2020 Member

Actually, I was reading this wrong. This is not about segments.

@tsteur commented on January 20th 2020 Member

This works for me. It looks like the token_auth is not valid very likely. Maybe the token was regenerated?

@Romain commented on January 21st 2020

Hi @tsteur ,

Thanks for having a look a this.
Actually, the token_auth shouldn't be a problem. Since I'm using the Request class, I think that this parameter is not required.

Here is what I'm doing:

$response = Request::processRequest('Live.getLastVisitsDetails', [
            'idSite'        => $idSite,
            'period'        => $period,
            'date'          => $date,
            // 'token_auth'    => $_ENV['AUTH_TOKEN']

I tried to pass the token_auth there, but it doesn't change anything.
Everything was working smoothly up to the moment where I updated to 1.13.1.
If I dump the response, there's no visitIp key in the visits listed.

@Romain commented on January 21st 2020

I also tried _showAllSegments but the result was the same.

@tsteur commented on January 22nd 2020 Member

@Romain I see. Thought you do this through the HTTP API. I just tried to reproduce this and it seems to work for me. Maybe you have some other plugins active that maybe change this behaviour?

@Romain commented on January 22nd 2020

@tsteur Unfortunately I don't. On my dev setup, I just have Matomo, my plugin, the LogViewer and the VisitorGenerator. On my prod setup, I just have Matomo and my plugin. Here are the plugins that are installed on my dev setup:

Capture d’écran 2020-01-22 à 08 32 47-fullpage

@Romain commented on January 22nd 2020

Just to give you more information on the data I get.

Here is a sample of code more detailed:

$response = Request::processRequest('Live.getLastVisitsDetails', [
            'idSite'        => $idSite,
            'period'        => $period,
            'date'          => $date

foreach ($response->getRows() as $visitRow) {

This logs what follows:

# ['idvisit' => '1337', 'idsite' => '1', 'idvisitor' => '?d???L?', 'visit_last_action_time' => '2019-12-19 13:08:59', 'config_id' => '?O???R', 'location_ip' => 'd.
@Romain commented on January 22nd 2020

Ok, I solved it by changing my request this way:

$response = Request::processRequest('Live.getLastVisitsDetails', [
            'idSite'            => $idSite,
            'period'            => $period,
            'date'              => $date,
            'segment'           => $segment,
            'flat'              => FALSE,
            'doNotFetchActions' => FALSE

Thank for your help.

This Issue was closed on January 22nd 2020
Powered by GitHub Issue Mirror