matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.91k stars 2.65k forks source link

Maps, See where your visitors are coming from, Maps shows them to you drawn on a Map #1258

Closed anonymous-matomo-user closed 13 years ago

anonymous-matomo-user commented 14 years ago

Features of this version: This version provides a widget that represents Live users on a Map and in the visitor menu you can find the same Map.

Howto Install: Download the zip provided as attachment unzip, it will create a directory Maps copy this directory in piwik/plugins/ in config add the following section

[Maps]
maps_key = "Here your Google Maps API key"

go to Piwik > Settings > Plugins and enable the plugin

Changelog: 0.1: Beta release first features are implemented and ready to be tested. Note this version can contain bugs.

Upcoming: Show visitor data retrieved from archive Show visit intensity Switch between Continent, Country, City view by buttons instead of only by zoom.

In a later stage other Maps providers will be add.

anonymous-matomo-user commented 14 years ago

Attachment: menu_continent.PNG

anonymous-matomo-user commented 14 years ago

Attachment: widget_continent.PNG

anonymous-matomo-user commented 14 years ago

Attachment: widget_country.PNG

anonymous-matomo-user commented 14 years ago

Attachment: Fix: City view Maps_0.1.zip

anonymous-matomo-user commented 14 years ago

Attachment: menu_city.PNG

mattab commented 14 years ago

That sounds interesting! could you please post screenshots of all the new screens added? thx

anonymous-matomo-user commented 14 years ago

See that there is a problem with the city view will fix asap.

mattab commented 14 years ago

Good start, I would like to see this included in Piwik core at some point. But there would be a few things to change. Would you be interested into having this in core?

I have a few questions

I gathered some thoughts in the ticket #274 ; generally I think our safest approach would be to use the open source technology SVG to draw maps, instead of relying on google maps (if we want to include this in core). Let me know what you think!

anonymous-matomo-user commented 14 years ago

Offcourse I am interested in putting it in the core. I will try to answer your questions.

At the moment every dot represents a continent, country or city. I have done this to prevent drawing endless pointers on the same place. lat/long data is on city level so drawing multiple dots would be useless. In the future coloring will indicate visit detail.

In a later stage I will add a click event to a marker to get the necessary details. At the moment Live! doesn't provide lat/long data. So I wrote my own API at the moment this can be replaced in the future.

The data is updated every 30sec. Will be adjustable in the future.

At the moment GeoIP needs to be installed because my API is gathering data like lat/long.

I created 2 DataFiles for lat/long info for countries and continents these are build from the MaxMind files. I am not sure if the abbreviations of GeoIP are similar of those piwik is using? If so these datafiles could be used also when GeoIP is disabled.

I did some research in the different maps provider and in general Google or Yahoo provide a more detailed map at the moment the opensource maps just miss general information like city names in most parts of the world. For me this was the decision to choose for Google.

I used the flash SDK which gives the advantage that all the methods needed to draw the map are build within the SWF the only thing that is retrieved from Google are the tiles. And I think that it is saver to rely on Google for the tiles then a opensource alternative.

I understand that this decision is controversial but in the end I think it is saver for now to bet on a Google or Yahoo. To be clear in the future I also will support openstreetmap but this hasn't priority at the moment. I hope this won't generate any problems.

mattab commented 14 years ago

I wasn't suggesting openstreemaps, but instead using SVG maps and add pointers/markers dynamically onto them. Take a look at #274 for pointers to SVG maps (on wikipedia).

The big problem with google maps is the need for the API_KEY. We can't force Piwik users to get one, so we would need to be independent from third party providers (and SVG is becoming really strong as a technology).

Having this plugin as a 3rd party is fine too, for sure. If you want to have it included in core, we would need to consider being independent from google or yahoo (or even openstreetmaps). Let me know what you think!

anonymous-matomo-user commented 14 years ago

I think that it is really interesting the SVG maps but at the moment it is rendering very slow. Here it took a minute to render a world map. Will do some extra research on this to see if I can make it work for the Maps plugin.

I can also try to port it to the Google Javascript API 3 from Google this doesn't need a API key anymore. But then you still are depended on Google.

anonymous-matomo-user commented 14 years ago

I think I can also make it work in SVG now found a map that has some nice features that I can use now i need to find a way how I can make the zoom element. Will drop Google for now and focus on SVG.

Is also interesting for me because I am going to learn a lot more with SVG then with Google Maps that did all the thinking for me.

mattab commented 14 years ago

renelux, great to hear. I personally don't know much about it, so anything you find or build is going to be useful.

Please feel free to post all your SVG related findings in the other ticket #274 with maybe a proposal (text or code) of how you think we should implement it in Piwik, and we can discuss / review. Cheers

anonymous-matomo-user commented 14 years ago

Hello, thanks for the great plugin! When I click on MapsLive! the map is only 205px heigh.. I tried changing the file controller.php to:

function getLiveVisitorsMapMenu() {
        $this->view("Maps.getLiveVisitsWithGeoDataDetails", "100%");
    }

But it's the same..

anonymous-matomo-user commented 14 years ago

Hey, why not using google charts to display the visit numbers? http://code.google.com/apis/charttools/ Just a suggestion!

anonymous-matomo-user commented 14 years ago

I'm getting an error trying this plugin.

Error Loading GeoData faultCode: Client.CouldNotDecode faultString: 'Error #1085' faultDefault: 'null'

What does it mean?

Google API key is in the config file...

mattab commented 14 years ago

Renelux, any update on the map plugin using SVG? Thanks

anonymous-matomo-user commented 14 years ago

Matthieu, I did look in to it but at the moment I am lacking time to work on the plugin. It is possible to let it work with SVG but in browsers like IE it is slow and not very usable.

Will see if I can contact Gregor who posted in the forum topic, about his Map in flash if we can use that I think that will be a better solution.[]

anonymous-matomo-user commented 14 years ago

Replying to cschneider:

I'm getting an error trying this plugin.

Error Loading GeoData faultCode: Client.CouldNotDecode faultString: 'Error #1085' faultDefault: 'null'

What does it mean?

Google API key is in the config file...

I'm having the same problem. Could someone explain?

Thank you!!!

anonymous-matomo-user commented 14 years ago

After the last piwik-update -> 0.6.4. I get some errors: #1505

gka commented 14 years ago

I just created another maps plugin for piwik, which doesn't rely on external services like google maps.

[1514]

anonymous-matomo-user commented 14 years ago

Some errors can be fixed:

Maps/Maps.php, line 50: Piwik_EditMenuUrl('General_Visitors', 'Maps Live!', array('module' => 'Maps', 'action' => 'getLiveVisitorsMapMenu')); to: Piwik_AddMenu('General_Visitors', 'Maps Live!', array('module' => 'Maps', 'action' => 'getLiveVisitorsMapMenu'));

Maps/API.php, line 104: /$sql = "SELECT , COUNT(".$count.") AS total FROM " . Piwik::prefixTable('log_visit') . " $sqlWhere GROUP BY ".$count." ORDER BY visit_last_action_time DESC LIMIT $limit"; / to: $sql = "SELECT , COUNT(".$count.") AS total FROM " . Piwik_Common::prefixTable('log_visit') . " $sqlWhere GROUP BY ".$count." ORDER BY visit_last_action_time DESC LIMIT $limit";

But still I get no ne markers on the google map, google maps api key and auth-token are not always submitted correctly (problem shall be reproducable with the posted changes). Does anyone knows this problem and can provide a workaround?

mattab commented 14 years ago

Renelux, do you plan to maintain the plugin? please let us know and we will reopen the ticket.