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

[2.4.1] VisitorMap wrong visit summary? #5854

Closed
ThaDafinser opened this issue Jul 18, 2014 · 13 comments
Closed

[2.4.1] VisitorMap wrong visit summary? #5854

ThaDafinser opened this issue Jul 18, 2014 · 13 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@ThaDafinser
Copy link
Contributor

I have two locations, where my visitor come from US.

  • Indiana: 210
  • Michigan: 16

The summary in Visitor map (top left) shows 231, but should be 226?

json

visitormap

@tsteur
Copy link
Member

tsteur commented Jul 19, 2014

Just to make sure: Is it possible that there are visitors with location "unknown" or from any other country not visible on this map?

@ThaDafinser
Copy link
Contributor Author

Yes i have such visitors. Is that a problem?

@tsteur
Copy link
Member

tsteur commented Jul 21, 2014

If there are 5 visitors having an unknown region it would explain the difference between 231 and 226.

@ThaDafinser
Copy link
Contributor Author

@tsteur i have 7 unknown visitors, when i view this:

SELECT count(1) FROM piwik_log_visit
where idsite =16 and visit_first_action_time between '2014-07-17 00:00:00' and '2014-07-17 23:59:59'
and location_city IS NULL

is the query this way correct? would be only 2 visitors to much?

But the count from unknown visitors make only sense on the global map? If i click on north america, i only want north america?

@tsteur
Copy link
Member

tsteur commented Jul 21, 2014

I think in this case you wanna search for location_region is null. Or probably even better location_region is null and location_country = 'us' in case there are unknown regions from other countries.

It is possible that the United States was detected as country for 231 visitors but it was only able to detect the region for 226 visitors of those 231. So displaying 231 visitors would be correct but we should definitely mention the number of unknown regions or cities depending on the zoom level, otherwise it can be confusing

@ThaDafinser
Copy link
Contributor Author

It's exactly 5 with your query:

SELECT count(1) FROM piwik_log_visit
where idsite =16 and visit_first_action_time between '2014-07-17 00:00:00' and '2014-07-17 23:59:59'
and location_region is null and location_country = 'us'

It comes from the browser language to country guessing..(which is now disabled).

Yeah mention those 5 would be less confusing.

@tsteur
Copy link
Member

tsteur commented Jul 21, 2014

Has anyone an idea how to display those unknown visitors? Any suggestions? Maybe it is enough to display on hover (title) on the text "231 visitors...": "231 visitors 5 of those with unknown region/city"

@ThaDafinser
Copy link
Contributor Author

@tsteur i would only show them on the global map.
And display it in a way you suggested: 231 visitors (5 with unknown region)

@tsteur tsteur added this to the 2.5.0 - Piwik 2.5.0 milestone Jul 23, 2014
@mattab
Copy link
Member

mattab commented Jul 25, 2014

+1 for suggested solution

@tsteur
Copy link
Member

tsteur commented Jul 25, 2014

I already tried to fix it but couldn't. Maybe someone else can have a look? Otherwise I'd invest more time

@ThaDafinser
Copy link
Contributor Author

When loading the global data, they are saved "forever":

Do this:

  • load the global map
  • inspect with JS console UserCountryMap.countriesByIso <-- to high number (which stays)
  • click down on a continent (values stay in UserCountryMap.countriesByIso)
  • click down on a country (values stay in UserCountryMap.countriesByIso)

And then in this function, the value from the global map is used.
https://github.com/piwik/piwik/blob/master/plugins/UserCountryMap/javascripts/visitor-map.js#L164
https://github.com/piwik/piwik/blob/master/plugins/UserCountryMap/javascripts/visitor-map.js#L156

Because the new loaded data from region get never globally updated:
https://github.com/piwik/piwik/blob/master/plugins/UserCountryMap/javascripts/visitor-map.js#L699-L703

//BTW: Pretty crazy JS file Oo (maybe a refactor in some time)

@tsteur
Copy link
Member

tsteur commented Jul 25, 2014

Done! I noticed after some more research there is already a function that displays the number of unlocated cities and region on the (i) info button on the bottom left. I do now display it in the title if there are any as you suggested. Tried to display it on hover as title/tooltip but this didn't really work since the title which contains the number of visits sometimes disappears etc. Indeed a refactoring wouldn't be that bad ;) That's why I was so struggling

@tsteur tsteur closed this as completed Jul 25, 2014
@tsteur tsteur self-assigned this Jul 25, 2014
@mattab
Copy link
Member

mattab commented Aug 3, 2014

a solution well done!

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. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

3 participants