Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live.getLastVisitsDetails retireves data for different dates when idSite=all #20042

Closed
Sonofendor opened this issue Nov 23, 2022 · 3 comments
Closed
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@Sonofendor
Copy link

API method Live.getLastVisitsDetails retrieves data for different dates when trying to retrieve data for previous day and idSite is set to "all"

Expected Behavior

When sending request to API like method=Live.getLastVisitsDetails&idSite=all&period=day&date=yesterday data retrieved from API should have one similar serverDate for all records (because server and all the visitors are in one timezone in my case). For example if I send this request today (2022-11-23) the serverDate should be 2022-11-22

Current Behavior

Currently such request retreives data whith three different serverDate values: today, yesterday and day before yesterday (for example on 2022-11-23 I recieved serverDate values 2022-11-21,2022-11-22,2022-11-23). If I change parameter to idSite=1 or idSite=2 request works fine and serverDate is only 2022-11-22. idSite=1,2 also produces the same issue as idSite=all.

Result does not depend on format - I tried csv, xml, json and original. All have same issue

Also I tried following combinations of parameters and all of them produces the same results:

  • &period=day&date=yesterday
  • &period=day&date=YYYY-MM-DD
  • &period=day&date=previous1
  • &period=range&date=YYYY-MM-DD,YYYY-MM-DD (where YYYY-MM-DD is one same date)

Context

We have ETL proccess that requests data for previous day from Matomo API whith Live.getLastVisitsDetails method and loads it to Data Warehouse. When we had only one site everything was working fine. Couple of weeks ago we changed idSite=1 to idSite=all and then found out that data has complete duplicates for every day since when we changed that parameter. It turned out that API was sending some of the visits twice on different dates.

For our purposes we now have two ETL processes (one for idSite=1 and other for idSite=2) but it would much better if API would work as expected

Your Environment

  • Matomo Version: 4.10.1 (on-premise)
  • PHP Version: 8.0.22
  • MySQL version: 10.6.8-MariaDB-log
  • Additionally installed plugins: None
@Sonofendor Sonofendor added Potential Bug Something that might be a bug, but can't be reproduced (yet). To Triage An issue awaiting triage by a Matomo core team member labels Nov 23, 2022
@bx80
Copy link
Contributor

bx80 commented Nov 23, 2022

Hi @Sonofendor, thanks for the detailed report 👍

When data is requested for a specific site then that site's timezone is used.
When data is requested for all sites then the default timezone set at Administration > Measurables > Settings > "Default timezone for new websites" is used. By default this is set to UTC.

Could you check if your default timezone is set to the correct timezone for your server? If it is set to UTC then changing it to your timezone may fix this issue.

@bx80 bx80 added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Nov 23, 2022
@Sonofendor
Copy link
Author

@bx80 I checked and default timezone was indeed different from server's timezone. After I switched it to match, request seems to be working fine. Thank you!

However is such a nuance mentioned anywhere in documentation? I didn't manage to find it

@bx80
Copy link
Contributor

bx80 commented Nov 23, 2022

@Sonofendor Glad to hear that worked for you 😃

The documentation could definitely be improved here, "Default timezone for new websites" doesn't indicate that this timezone will also be used when requesting data for all sites. I'll create a new issue to improve the documentation / UI to make this clearer 👍

@bx80 bx80 added answered For when a question was asked and we referred to forum or answered it. and removed Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. Potential Bug Something that might be a bug, but can't be reproduced (yet). To Triage An issue awaiting triage by a Matomo core team member labels Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants