{"id":19,"date":"2014-04-04T14:31:01","date_gmt":"2014-04-04T12:31:01","guid":{"rendered":"https:\/\/jm.garreta.eu\/blog\/en\/?p=19"},"modified":"2014-04-04T14:31:01","modified_gmt":"2014-04-04T12:31:01","slug":"how-to-enhance-geolocation-in-piwik","status":"publish","type":"post","link":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/","title":{"rendered":"How to enhance geolocation in Piwik"},"content":{"rendered":"<p>If you decide to use <a href=\"http:\/\/piwik.org\/\" target=\"_blank\">Piwik<\/a> for you website statistics, here is a procedure to enhance the accuracy of geolocation.<\/p>\n<p>We will configure our Linux server (Debian or Ubuntu) with <strong>PECL<\/strong> that is recommended method (only if you have a dedicated server and you can configure it as you want, for a shared one, use PHP method instead).<\/p>\n<p>Connect to it with SSH et install libraries and tools :<\/p>\n<p><code>apt-get install php-pear php5-geoip php5-dev libgeoip-dev<br \/>\npecl install geoip<\/code><\/p>\n<p>We are going to install the database. When libraries are installed, go to <em>Piwik &gt; Settings &gt; Geolocation<\/em>, and at the bottom of the page, you can download the free database. If you have an error message, you can download it mannually at this <a href=\"http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCity.dat.gz\" target=\"_blank\">address<\/a>, you will have to use wget in SSH by example, then move the file in <em>&lt;piwik path&gt;\/misc<\/em>. Think to rename it from <em>GeoLiteCity.dat<\/em> to <em>GeoIPCity.dat<\/em>.<\/p>\n<p>Last step is enable it in the server. Library installation probably configured PHP automatically. Modify the needed file (<em>\/etc\/php5\/fpm\/conf.d\/20-geoip.ini<\/em> or <em>\/etc\/php5\/conf.d\/geoip.ini<\/em> by example) to get :<\/p>\n<p><code>extension=geoip.so<br \/>\ngeoip.custom_directory=&lt;chemin piwik&gt;\/misc<\/code><\/p>\n<p>Restart apache, or fpm, or anything else, and go back to Piwik administration, et check PECL that should mention <em>installed<\/em> in green text.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-26\" alt=\"Piwik GeoIP PECL install\u00e9\" src=\"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_pecl_installe.png\" width=\"140\" height=\"100\" \/><\/p>\n<p>Think to setup automatic updates (monthly by example) in adding the link above in URL field.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_configurer_mises_a_jour_automatiques_geoip.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-27\" alt=\"Piwik Configurer les mises \u00e0 jour automatique GeoIP\" src=\"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_configurer_mises_a_jour_automatiques_geoip-300x179.png\" width=\"300\" height=\"179\" \/><\/a><\/p>\n<p>If you want to test update, force Piwik cron in going to <em>http:\/\/&lt;PIWIK URL&gt;\/misc\/cron\/archive.php?token_auth=&lt;TOKEN&gt;<\/em> address replacing <em>&lt;TOKEN&gt;<\/em> by your super user token you will find in <em>Users<\/em> page.<\/p>\n<p><a href=\"http:\/\/piwik.org\/faq\/how-to\/#faq_164\" target=\"_blank\">Documentation<\/a><\/p>\n<p style=\"text-align: center;\">\n","protected":false},"excerpt":{"rendered":"<p>If you decide to use Piwik for you website statistics, here is a procedure to enhance the accuracy of geolocation. We will configure our Linux server (Debian or Ubuntu) with PECL that is recommended method (only if you have a dedicated server and you can configure it as you want, for a shared one, use &hellip; <a href=\"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to enhance geolocation in Piwik<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[4],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-informatique","tag-piwik"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to enhance geolocation in Piwik - Le blog de Jean-Mich<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to enhance geolocation in Piwik - Le blog de Jean-Mich\" \/>\n<meta property=\"og:description\" content=\"If you decide to use Piwik for you website statistics, here is a procedure to enhance the accuracy of geolocation. We will configure our Linux server (Debian or Ubuntu) with PECL that is recommended method (only if you have a dedicated server and you can configure it as you want, for a shared one, use &hellip; Continue reading How to enhance geolocation in Piwik &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/\" \/>\n<meta property=\"og:site_name\" content=\"Le blog de Jean-Mich\" \/>\n<meta property=\"article:published_time\" content=\"2014-04-04T12:31:01+00:00\" \/>\n<meta name=\"author\" content=\"jeanmich\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jeanmich\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/\"},\"author\":{\"name\":\"jeanmich\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/#\\\/schema\\\/person\\\/5ed151f48f77a878fc9d3868c8a1ed7d\"},\"headline\":\"How to enhance geolocation in Piwik\",\"datePublished\":\"2014-04-04T12:31:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/\"},\"wordCount\":267,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/piwik_pecl_installe.png\",\"keywords\":[\"piwik\"],\"articleSection\":[\"informatique\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/\",\"url\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/\",\"name\":\"How to enhance geolocation in Piwik - Le blog de Jean-Mich\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/piwik_pecl_installe.png\",\"datePublished\":\"2014-04-04T12:31:01+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/#\\\/schema\\\/person\\\/5ed151f48f77a878fc9d3868c8a1ed7d\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/piwik_pecl_installe.png\",\"contentUrl\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/piwik_pecl_installe.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/19\\\/how-to-enhance-geolocation-in-piwik\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to enhance geolocation in Piwik\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/\",\"name\":\"Le blog de Jean-Mich\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/#\\\/schema\\\/person\\\/5ed151f48f77a878fc9d3868c8a1ed7d\",\"name\":\"jeanmich\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/816266d852c4595a2bfa578a991fa68bb8ed5e0217f3565158ca20c139873bda?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/816266d852c4595a2bfa578a991fa68bb8ed5e0217f3565158ca20c139873bda?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/816266d852c4595a2bfa578a991fa68bb8ed5e0217f3565158ca20c139873bda?s=96&d=mm&r=g\",\"caption\":\"jeanmich\"},\"url\":\"https:\\\/\\\/jm.garreta.eu\\\/blog\\\/en\\\/author\\\/jeanmich\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to enhance geolocation in Piwik - Le blog de Jean-Mich","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/","og_locale":"en_US","og_type":"article","og_title":"How to enhance geolocation in Piwik - Le blog de Jean-Mich","og_description":"If you decide to use Piwik for you website statistics, here is a procedure to enhance the accuracy of geolocation. We will configure our Linux server (Debian or Ubuntu) with PECL that is recommended method (only if you have a dedicated server and you can configure it as you want, for a shared one, use &hellip; Continue reading How to enhance geolocation in Piwik &rarr;","og_url":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/","og_site_name":"Le blog de Jean-Mich","article_published_time":"2014-04-04T12:31:01+00:00","author":"jeanmich","twitter_misc":{"Written by":"jeanmich","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#article","isPartOf":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/"},"author":{"name":"jeanmich","@id":"https:\/\/jm.garreta.eu\/blog\/en\/#\/schema\/person\/5ed151f48f77a878fc9d3868c8a1ed7d"},"headline":"How to enhance geolocation in Piwik","datePublished":"2014-04-04T12:31:01+00:00","mainEntityOfPage":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/"},"wordCount":267,"commentCount":0,"image":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#primaryimage"},"thumbnailUrl":"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_pecl_installe.png","keywords":["piwik"],"articleSection":["informatique"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/","url":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/","name":"How to enhance geolocation in Piwik - Le blog de Jean-Mich","isPartOf":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#primaryimage"},"image":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#primaryimage"},"thumbnailUrl":"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_pecl_installe.png","datePublished":"2014-04-04T12:31:01+00:00","author":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/#\/schema\/person\/5ed151f48f77a878fc9d3868c8a1ed7d"},"breadcrumb":{"@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#primaryimage","url":"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_pecl_installe.png","contentUrl":"https:\/\/jm.garreta.eu\/blog\/wp-content\/uploads\/2014\/04\/piwik_pecl_installe.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jm.garreta.eu\/blog\/en\/19\/how-to-enhance-geolocation-in-piwik\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jm.garreta.eu\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"How to enhance geolocation in Piwik"}]},{"@type":"WebSite","@id":"https:\/\/jm.garreta.eu\/blog\/en\/#website","url":"https:\/\/jm.garreta.eu\/blog\/en\/","name":"Le blog de Jean-Mich","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jm.garreta.eu\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/jm.garreta.eu\/blog\/en\/#\/schema\/person\/5ed151f48f77a878fc9d3868c8a1ed7d","name":"jeanmich","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/816266d852c4595a2bfa578a991fa68bb8ed5e0217f3565158ca20c139873bda?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/816266d852c4595a2bfa578a991fa68bb8ed5e0217f3565158ca20c139873bda?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/816266d852c4595a2bfa578a991fa68bb8ed5e0217f3565158ca20c139873bda?s=96&d=mm&r=g","caption":"jeanmich"},"url":"https:\/\/jm.garreta.eu\/blog\/en\/author\/jeanmich\/"}]}},"_links":{"self":[{"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":1,"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jm.garreta.eu\/blog\/en\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}