Great mod. It frustrated me that the Visitor Log didn’t have city/state so, after including the above changes, I modified plugins/Live/templates/visitorLog.tpl to include the following:
after hours of reading and searching why and how I could fix that problem with different countries in different widgets, I finally… found you! :)-D
The first patch is working perfectly.
For the second patch, about showing the cities, your point 2 “edit /plugins/Live/templates/lastVisits.tpl, and replace” is not good anymore as the html in that file isn’t the same anymore.
I made following changed from first patch and i got error. following are my changes
function getCountryName()
{
return Piwik_CountryTranslate($this->details['location_geoip_country']);
}
function getCountryFlag()
{
return Piwik_getFlagFromCode($this->details['location_geoip_country']);
}
function getContinent()
{
return Piwik_ContinentTranslate($this->details['location_geoip_continent']);
}
Following error i got on Realtime visitor log
There is an error. Please report the message (Piwik 1.8.1) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).
Notice: Undefined index: location_geoip_country in /var/www/html/owa/piwik/plugins/Live/Visitor.php on line 207
Backtrace -->
#0 Piwik_ErrorHandler(...) called at [/var/www/html/owa/piwik/plugins/Live/Visitor.php:207]#1 Piwik_Live_Visitor->getCountryName(...) called at [/var/www/html/owa/piwik/plugins/Live/Visitor.php:74]#2 Piwik_Live_Visitor->getAllVisitorDetails(...) called at [/var/www/html/owa/piwik/plugins/Live/API.php:162]#3 Piwik_Live_API->getCleanedVisitorsFromDetails(...) called at [/var/www/html/owa/piwik/plugins/Live/API.php:132]#4 Piwik_Live_API->getLastVisitsDetails(...) called at [:]#5 call_user_func_array(...) called at [/var/www/html/owa/piwik/core/API/Proxy.php:190]#6 Piwik_API_Proxy->call(...) called at [/var/www/html/owa/piwik/core/API/Request.php:128]#7 Piwik_API_Request->process(...) called at [/var/www/html/owa/piwik/plugins/Live/Controller.php:96]#8 Piwik_Live_Controller->getLastVisitsStart(...) called at [/var/www/html/owa/piwik/plugins/Live/Controller.php:29]#9 Piwik_Live_Controller->widget(...) called at [:]#10 call_user_func_array(...) called at [/var/www/html/owa/piwik/core/FrontController.php:138]#11 Piwik_FrontController->dispatch(...) called at [/var/www/html/owa/piwik/index.php:53]
I’m using 1.8.2 and im getting the following error when I make the change to visitorlog.tpl
There is an error. Please report the message (Piwik 1.8.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).
Notice: Undefined index: city in /home/kkpixels/public_html/stats/tmp/templates_c/%%46^462^46227F0A%%visitorLog.tpl.php on line 147
Backtrace --> #0 Piwik_ErrorHandler(…) called at [/home/kkpixels/public_html/stats/tmp/templates_c/%%46^462^46227F0A%%visitorLog.tpl.php:147]#1 include(…) called at [/home/kkpixels/public_html/stats/libs/Smarty/Smarty.class.php:1263]#2 Smarty->fetch(…) called at [/home/kkpixels/public_html/stats/core/View.php:133]#3 Piwik_View->render(…) called at [/home/kkpixels/public_html/stats/core/Controller.php:153]#4 Piwik_Controller->renderView(…) called at [/home/kkpixels/public_html/stats/plugins/Live/Controller.php:84]#5 Piwik_Live_Controller->getVisitorLog(…) called at [:]#6 call_user_func_array(…) called at [/home/kkpixels/public_html/stats/core/FrontController.php:138]#7 Piwik_FrontController->dispatch(…) called at [/home/kkpixels/public_html/stats/index.php:53]
Perhaps I have missed something, can someone just list all the changes that are needed to make this work on 1.8.2
Or better still, just post the changed files so anyone can just copy these into their installation
You have to update files like explained in the first two messages.
Based on your error message, it seems that the field ‘city’ does not exist. You have to add the line in Visitor.php and also add the function that will return the city name (check in the second message of the post)
Good workaround, it should be included in core as the Geo IP features should work out of the box if Piwik is to be considered as a viable alternative to GA. And of course, non-developer users might not be able to edit the files in question.
Thanks for the help chris, seems i had updated my local server copy and not uploaded all changes!
For what it’s worth whilst I dont mind updating files it can get more difficult when the changes are for much older versions, my vote would also be that is should be in core as GeoIP is being integrated so much
One other change I made was to visitorLog.tpl
If you change the line (around line number 46) that reads
Not only will you have the right country flag from the earlier update, but on hovering over the flag you will also see the city (from GeoIP) not just the country. Might be of interest to some people
Good news: GeoIP is now integrated in Piwik, enabling Accurate Visitors Geolocation in your Analytics reports. To enable GeoIP go to the Settings > Geolocation admin page, and follow the short instructions.
We need YOUR help! We are running a crowd funding campaign to raise funds to implement the detailed Visitors Maps of Countries, Regions and Cities (for all countries)!
These maps will be beautiful, usable, and built using open standards SVG+JS. They will show detailed visitor count, conversion rates, by Country but also (New!) by city and region.