-
Notifications
You must be signed in to change notification settings - Fork 595
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
geoip no data available #200
Comments
And for example, I have |
What is the respond of this: |
i have same problem and respond of dd($visitor->geoIp); is null |
Looks like a bug in the code. When Tracker is trying to retrieve GeoIp data, it finally calls the private method databaseExists() in https://github.com/antonioribeiro/support/blob/master/src/GeoIp/GeoIp.php#L21. If the database does not exist, nothing happens. This silent failure was introduced by commit antonioribeiro/support@776b3e6#diff-fdd42cf520dfaffd4c4d3a0018feb14c. Before that, it likely threw an exception and people figured out what to do. However, the readme file of this project does not tell anything about the requirement of a database file for GeoIp functionality. Further investigation reveals that the private property databasePath of GeoIp can only be set via its constructor. However, https://github.com/antonioribeiro/tracker/blob/master/src/Vendor/Laravel/ServiceProvider.php#L257 creates an instance of GeoIp without specifying databasePath. So it's to be expected that any attempt to retrieve GeoIp fails silently. |
The following fixed it for me, based on my previous findings. Go to https://dev.maxmind.com/geoip/geoip2/geolite2/ and download the databases GeoLite2 City/Country in the MaxMind format. Copy them both into the same directory of your choice. A quick hack of https://github.com/antonioribeiro/tracker/blob/master/src/Vendor/Laravel/ServiceProvider.php#L258 to instantiate GeoIp with the path to the database files enables geo ip logging. Now, I will implement a cleaner fix for my app by overloading RepositoryManager. |
Ha! In the meantime I wrote my own command to pull the geo ip databases. And using a config setting to instantiate GeoIp with the correct path, was exactly what I would have done, too. Great minds think alike. ;) Thanks for the quick coding.
It works and I got rid of my hacks. :) |
It is not working for me. Just geoip is not saving data. What can I do? |
@antonioribeiro man u could be our saver here , using laravel 5.6 and geoip v2 it's always null i walked with all issues , performed what u did exactly , am using windows 10 |
any solution for this problem ? |
sorry i get it to work finally by following this #130 |
when I run the error accour when the tracker is disabled . |
@tornadofay |
here is how i configured it: in config\app.php
in config\tracker.php
in app\Http\Kernel.php add
after that run @meeprakash25 hope this help solve the problem, |
Thank you so much I'll try it and let you know if it worked
|
@tornadofay is that geoip_database_path correct? |
sorry for late reply, yes I copied it from config\tracker.php
also you may need to take look into Torann\GeoIP, if it still not working. |
I think is related to using localhost. If u uncomment the ip range (local) in the tracking.php config file the geoip object will not gather the data required. |
Hi, I want to ask, if anybody know, where could be a problem, because in tracker_geoip table aren't any data. For example in table tracker_agents are data. In config I have 'log_geoip' => true and I have installed "geoip2/geoip2":"~2.0"
Thank you
The text was updated successfully, but these errors were encountered: