What should you do?
There are several options available. The recommended option is to switch to performing lookups on your server via an integration with our GeoIP2 Precision web services. Another option is to switch to using our GeoIP2 downloadable databases. Both of these options allow you to perform GeoIP2 lookups on your server rather than in the browser.
Before you make any updates, there are two key differences you should be aware of:
- The data provided by our GeoIP2 services has some differences from our legacy GeoIP services. You can read more about the differences here.
If you load this page, it would show something like this:
Hi, I see you are from Vancouver, Canada!
- You must switch the first
- You must use callback functions rather than direct function calls.
An easy way to switch to callback functions in the above example is to
replace the locations with
geoip_*() function calls to have
this by changing the last two
<script> elements to be
<span> elements with
Once you have these elements, you can write your callback functions. The success callback will have the results of the lookup. You can take these results and update the elements with the information.
Here is how that would look:
If you load this page, you will see the same text before.