@ThaDafinser opened this Issue on July 18th 2014 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 commented on July 19th 2014 Owner

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 commented on July 21st 2014 Contributor

Yes i have such visitors. Is that a problem?

@tsteur commented on July 21st 2014 Owner

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

@ThaDafinser commented on July 21st 2014 Contributor

@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 commented on July 21st 2014 Owner

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 commented on July 21st 2014 Contributor

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 commented on July 21st 2014 Owner

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 commented on July 22nd 2014 Contributor

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

@mattab commented on July 25th 2014 Owner

+1 for suggested solution

@tsteur commented on July 25th 2014 Owner

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

@ThaDafinser commented on July 25th 2014 Contributor

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 commented on July 25th 2014 Owner

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

@mattab commented on August 3rd 2014 Owner

a solution well done!

This Issue was closed on July 25th 2014
Powered by GitHub Issue Mirror