Optimize my Web Service Integration

 

Work with your developers to make sure you're making GeoIP2 web service queries efficiently to keep your query volume manageable. Queries are sometimes referred to as "requests", "calls", or "lookups" in our documentation. Every time you lookup an IP address, whether you use the account portal, the command line, or through an integration with your web applications, you have sent one query, spending some of your service credit. Learn more about looking up IPs using the web services.

Excluding search engine spiders

Search engine spiders may also crawl your site and deplete your GeoIP2 web service credit unexpectedly. The robots exclusion standard can help prevent your system from sending queries for search engine spiders. You can write code to check the User-Agent header for the client to see if it’s a spider. Implementing this standard can help prevent runaway query usage.

Cache your queries

Ideally, most GeoIP2 users would want to set up their integration so that one visitor equals one query.  However, if you send a query every time someone loads a page, and a single visitor loads many pages, you might send many queries for every visitor to your site. To help keep your query usage in line with your volume of unique site visitors, you may wish to explore independently caching query response data in your system for your internal use.

If you want to query the GeoIP2 web service only once per unique visitor to your site, you will have to set up your integration to query the web service the first time a visitor comes to your site, and cache that query for the duration of their visit. How long you want to store these queries may depend on the patterns of your website users, and your specific use case.

Other query usage issues

If you have already set up your integration so that you do not send queries for search engine spiders, and you have appropriate caching in place to limit the number of queries per unique user of your website, we recommend logging each request to the GeoIP2 web services so that you can better understand your query usage and track any bugs or problems. You may also be able to diagnose query usage irregularities by generating a query usage report based on specific license keys. Learn more about generating query usage reports.

If you still need help

We do not cache or log your GeoIP2 web service query responses. However, we are able to generate logs of your query usage volume over the past 30 days upon request. These support-generated logs can be helpful for troubleshooting query usage issues, but they do not include the response data for your queries. Please reach out to our support team if you would like to get a query report to help with troubleshooting.

This page was last updated on .

Was this article helpful?