Add GeoIP location automatically to a hidden form field?

That’s really interesting, Phillip. Do you think the issue could have been that the students were selecting campuses that were further away from where they were at the moment? As a rough example, if they’re selecting a campus that they attend (or want to attend in the future) but they actually live 150 miles away, and are still living at home. Could that be a possibility? 

Regardless, thanks for sharing your personal experience with this one. Accuracy could make or break this idea completely. 

Hi Aleks,

This was a few months ago, tried this version and doesn’t seem to work. I did some investigation and it seems Maxmind have a new script for Geo-locations.

() 

I’m not a programmer but this is the script I have to fill the form but it doesn’t work.

as you can see I’m looking for the city.

I have a Maxmind account and loaded the domain. Any help would be appreciated.

Cheers
Brendon

Hi Brendon

This should do: https://gist.github.com/alewolf/275278f1da379b56512d

Be aware that the accuracy on city level is lower than compared to country level.

Cheers
Aleks 

Hi Aleks,
First of all, thank you very much for your code. I can not make it work, you could help me? I’ve tried a thousand things. Thanks. http://forms.geek.education/tutores-biologia/ 

Hi Mauro

I’ve tested a query on your page and I got an error from Maxmind.

Have you purchased database access at Maxmind and set your domain in the settings?

Hi @C_sar_Mid_o,

The undefined response you are getting back might be due to implementation problems rather than not being able to detect the city.

Also keep in mind that on city level these services are not very reliable.

Best,
Hristian

Hello Hristian,

Thanks .

I know, i just need to receive one city to split contacts by north and south.

I have no problem if the service is not 100% reliable.

But not defined are creating problems for my team to manage contacts.

So my ideia is use for example to services and reduce undefined.

Any ideia?

Hi @Cesar_Midao,

You can, of course, use two services but that would only add to the load time of your page.

Maxmind’s service is probably the best one out there so my suggestion is trying to trouble shoot it, instead of adding one more service.

Did you purchase enough credits from Maxmind? Have you tried reaching out to their support?

Hi @C_sar_Mid_o

I’ve used this service before to write the country of a lead into a hidden field. It’s pretty accurate on a country level but not sure how accurate it’s going to be on a city level.

You can contact their support or run a few tests yourself.

Best,
Hristian

Just wanted to chime in and say that @Rob has published a new #unbounce-tips-and-scripts post about how to do just this by using GeoIP.

Hi Aleks,

I’ve used your code (shared on GitHub) to pull the metro_code to a hidden field and then to the CRM and it works perfectly for the pages, thanks so much for adding it! Do you know if it needs to be changed to use on convertables? Can’t make it work on the exit overlays.

Me neither :frowning: I am trying to do the same thing but can’t get it to work on exit pop up

I haven’t tried it yet.
Do you have an example page I could have a look at?

Yeah check out this page here (WIP) https://pestpop.com/signup/

I’ve tried putting the script on just the page itself, on the page and the popup, and just the popup, and none of them work.

I can’t access that page: https://monosnap.com/file/aWs7JWvbhc7GpzTXC0M3g6swQmldmJ

Sorry - https://www.pestpop.com/signup/

Needed www

It doesn’t look like the MaxMind script is installed right now.
And looking that the popup code I can’t see why this should not be working. It would need some customization though. Have you tried it?

No I was using the script mentioned in this post: [How-to] Use Geotargeting to Display a Visitors Location on a Page

Ah. Ok. That one I can’t help you with.

I got it to work! I had an error in the case of my script. I was using cityField but it should have been cityfield. Working now! Thanks for your help