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

Calling MultiSites.getOne with API.getBulkRequest returns wrong stats #5830

Closed
onpubcom opened this issue Jul 15, 2014 · 1 comment
Closed
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Milestone

Comments

@onpubcom
Copy link

For example, the Piwik API request: http://demo.piwik.org/?module=API&format=JSON&token_auth=anonymous&method=API.getBulkRequest&urls[0]=method=MultiSites.getOne&idSite=3&period=day&date=today&urls[1]=method=MultiSites.getOne&idSite=7&period=day&date=today&urls[2]=method=MultiSites.getOne&idSite=32&period=day&date=today is returning:

[
{
"nb_visits": 0,
"nb_actions": 0,
"visits_evolution": "-100%",
"actions_evolution": "-100%",
"pageviews_evolution": "-100%",
"revenue_evolution": "0%",
"nb_pageviews": 0,
"revenue": 0
},
{
"nb_visits": 0,
"nb_actions": 0,
"visits_evolution": "-100%",
"actions_evolution": "-100%",
"pageviews_evolution": "-100%",
"revenue_evolution": "0%",
"nb_pageviews": 0,
"revenue": 0
},
{
"nb_visits": 0,
"nb_actions": 0,
"visits_evolution": "-100%",
"actions_evolution": "-100%",
"pageviews_evolution": "-100%",
"revenue_evolution": "0%",
"nb_pageviews": 0,
"revenue": 0
}
]

The results are strange as well if the explicit date format is used. For example:

http://demo.piwik.org/?module=API&format=JSON&token_auth=anonymous&method=API.getBulkRequest&urls[0]=method=MultiSites.getOne&idSite=3&period=day&date=2014-07-14&urls[1]=method=MultiSites.getOne&idSite=7&period=day&date=2014-07-14&urls[2]=method=MultiSites.getOne&idSite=32&period=day&date=2014-07-14

Is currently returning:

[

{
    "nb_visits": 8,
    "nb_actions": 9,
    "visits_evolution": "60%",
    "actions_evolution": "50%",
    "pageviews_evolution": "60%",
    "revenue_evolution": "0%",
    "nb_pageviews": 8,
    "revenue": 0
},
{
    "nb_visits": 8,
    "nb_actions": 9,
    "visits_evolution": "60%",
    "actions_evolution": "50%",
    "pageviews_evolution": "60%",
    "revenue_evolution": "0%",
    "nb_pageviews": 8,
    "revenue": 0
},
{
    "nb_visits": 8,
    "nb_actions": 9,
    "visits_evolution": "60%",
    "actions_evolution": "50%",
    "pageviews_evolution": "60%",
    "revenue_evolution": "0%",
    "nb_pageviews": 8,
    "revenue": 0
}

]

Please investigate. Thanks!

@tsteur
Copy link
Member

tsteur commented Jul 19, 2014

I think there are two things to consider.

today might by different to 2014-07-14 if the timezone of the site is different to your local date. So it is possible that Piwik used already 2014-07-15 which explains the difference. I tried to reproduce and I am getting the same result when comparing today with the actual today of the websites timezone.

Please note that each request must be URL encoded which is not the case in the above mentioned URL. See http://developer.piwik.org/api-reference/reporting-api#advanced-users-send-multiple-api-requests-at-once
For example:

&urls[0]=method%3dVisitsSummary.get%26idSite%3d1%26date%3d2012-03-06%26period%3dday&urls[1]=method%3dVisitorInterest.getNumberOfVisitsPerVisitDuration%26idSite%3d1%26date%3d2012-03-06%26period%3dday

@tsteur tsteur closed this as completed Jul 19, 2014
@tsteur tsteur self-assigned this Jul 19, 2014
@tsteur tsteur added this to the 2.5.0 - Piwik 2.5.0 milestone Jul 19, 2014
@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants