If you serve content to a geographically diverse audience, you would definitely know the significance of customized user experience. Serving the content which a user comes looking for helps you build a better audience. The more accurate and better information you have on the user, the better you can serve.
A personalized user experience can vary greatly based on the type of content you serve. If you run a news site, you would know users from different locations might not be interested in the same sort of news. So, you might prefer to shuffle the order a little bit based on their location. Similarly, if you sell some products online, you might want to compensate for parity buying power. In this whole process, the location of the user combined with the knowledge on that location is the key.
👉 Recently, I got to work with a client who wanted to dynamically change the content based on a user’s location. He wanted to filter the content on his homepage based on the geographical information of the user. By doing this, he was aiming to reduce the bouncing rate and amplify the user experience.
All I needed to do was to devise a process to determine the user’s location, grab its relevant info, and filter the content. The criterion of filtering the content was based upon the collected data and a certain set of rules. But the data collection needed to be both quick and accurate.
I looked out for various solution available to achieve the task. After a while, I encountered this amazing API called IPInfo. It was super accurate, fast, and trusted by some big names. After playing around with it for some time and comparing it with other services, I found it to be a promising option.
I settled with it and it didn’t disappoint me. In fact, I was more than happy with the results. Today, in this article, I’m gonna talk about what I liked about IPInfo, how it stands out, and why you should use it. So, let’s jump in!
IPInfo.io is a highly reliable, lightning fast, and mature API founded by a former Facebook engineer Ben Bowling. IPInfo was founded back in 2013 and during a span of almost 6 years, it managed to touch the heights of success. Although it consists of a small, yet incredibly talented and diverse group of people.
👌 It allows you to not only pinpoint the user location, but also find information regarding the ISP, IP type, and carrier. It comes with an extensive, developer friendly documentation to help you quickly get started. On the top, it provides both free and paid plans. With the free plan, you can make 1000 requests per day and check out if you really need it.
It’s backed by the solid Google Cloud infrastructure and scales automatically. Currently, it handles over 12b+ API requests per month and serves over 100,000+ business and developers. It takes pride in helping big names like Apple, Microsoft, Payoneer, Exabytes, Dell, and NPM. A few of many reasons to trust IPInfo!
IPInfo has a uniquely designed pricing page which lists down all the details regarding its monthly and annual plans along with FAQs and links to try out the free plan. It basically offers 3 plans varying in terms of no. of requests/month, features, and support type. If you need more than 6M lookups per month, you can contact the team for a custom package as well.
IPInfo plans starts from $41/month basic plan and goes up to $833/month pro plan. The same packages are offered with an annual billing option as well. You also get free two months if you switch to annual billing. 🤞
I believe there is quite a range to pick a suitable plan according to your needs. With a number of options available, you really get to pay for what you need. For example, in my case, I only needed the geolocation details, so I was good even with the basic plan to start out!
Using an IP address, you can quickly look up information like geolocation, the company using IP, the internet service provider (ISP) or ASN details, and much more. All of such distinct features of IPInfo along with sample response are listed below.
A sample response returned by IPInfo API with complete information looks like below. It contains direct info of geolocation and then it has three objects regarding ASN/ISP, company, and carrier. I’ll explain these ones by one.
- 📍 Geolocation: One of the most useful features I found from IPInfo is Geolocation. The very first part of the response consists of geolocation information. It contains info like region, country, zip code, city, and even coordinates. Basically using this info, you can actually pinpoint a user. Super cool!
- 🌐 ASN/ISP Info: After the geolocation, you have a complete object of information regarding ASN/ISP of that IP. You get information like ASN number, name, route, and domain. Just in case if you want to block a certain route, or want to get data on particular ISP, that’s the object you need to look for.
- 💼 Company: Next object is the one containing information on the company using that particular IP. So you can get to a lower level than the ISP and extract info like the domain and name of the company providing that IP. Again, like ISP, you can go one level low to get data or perform checks.
- 🔗 Carrier: Last but not least is the carrier object, which contains MCC/MNC tuple to help you uniquely identify a carrier. At this point, you’re going one step further down to get user info. If you’re collaborating with a carrier or providing carrier-based services, it can come quite handy.
- 🚅 Robustness: As I mentioned in the start, in order to personalize the content, I needed something really fast. That’s one of the characteristics of IPInfo — it’s blazing fast! I’ll be diving more into the minor details later on.
- ⛑ Secure: Using IPInfo you can make requests over HTTPS/SSL. This way, all the communication is secured through via 256-bit SSL encryption (HTTPS). So, your data remains safe!
- 🎩 Reliable: IPInfo is 6 years old, headed by a former Facebook Engineer, and used by big names, all these characteristics add up to the fact that it’s here to stay and you can rely on it. In addition, it’s backed by Google Cloud Infrastructure and new data is added on daily basis to keep it up-to-date! 🤯
🚀 Getting Started
One thing I love about IPInfo is its incredible documentation — will discuss in detail later. It saves tons of time and helps you get into the real game super quickly. The best part of IPInfo is that it has packages designed for multiple programming languages, so you can simply import those package to get started!
I will be using Python to demonstrate the usage of IPInfo using the official IPInfo Python Package. Also, I am using the pro plan of IPInfo, so your response might differ from mine, but the steps remain the same.
→ Step #1
The very first step is to create an account on IPInfo.io, a free or paid one, as you need. Once you have created the account, log in and go to your dashboard which contains your access token. You need it to authenticate and make communication with the API.
→ Step #2
Once you have got your hands on your access token, the very next step is to create a simple Python program. First, you need to install the IPInfo package using the following command.
→ Step #3
Next step is to write a simple program to use the package and make a call to the API. Below is a simple program you can use to make a call. After writing this piece of code, run the program and it will give you the output. I have included the response in the gist as well. Don’t forget to put in your access key. And you’re all good to go!
Just a few lines of code and you’re already there. Once you have the info, you can manipulate it and use it for whatever purpose you want. Isn’t super easy?
Performance, a very crucial part for an API to stand out and something, I never overlook while choosing an API. I always use Postman to test an API and see how it goes. That’s exactly what I did with IPInfo API and I was impressed with the results.
I ran multiple tests with various IP addresses to see how it goes. Below are a few stats from the experiment. All the values are average taken after multiple attempts.
- ⏱ Ran the very first query and response time was just 264 ms! 🤯
- 🤞 Tested multiple IP addresses, most of the time it took roughly 260 ms. Only a few times it fluctuated and went up to 400 ms on the first attempt only.
- 🔥 After running any IP addresses more than once, the response time lied around 260 ms.
I mean 260 ms, it’s a quite impressive response time for an API. I have used APIs before and never went this low on average. It always remained around 400 ms or so, but with IPInfo API, it’s lightning fast! So, thumbs up!
⚙️ Developer Features
The developer options provided by IPInfo are by no means limited to that described above. IPInfo has a lot more to offer to the developers. A few prominent features are listed below:
→ ASN API
IPInfo provides you an additional ASN API in standard and pro plans. It allows you to grab additional data regarding a particular ASN. Details on ASN API and its usage can be found here. You can use the following endpoint to get data regarding an ASN.
→ IP Ranges API
In addition to the ASN API, IP Info also offers you an IP Ranges API. It allows you to get the IP ranges assigned to a particular company. You can find the details on IP Ranges API here. It returns an array of IP addresses in the response of a query. You can utilize the following endpoint to make a call to the IP Ranges API.
→ Hosted Domains API
Hosted Domains API shows you the list of the domains hosted on a particular API. It gives you the number of domains and top 25 domains list based on Alexa ranking. You can hit the following endpoint to make a call to this API.
I find libraries to be one of the most exciting features of the IPInfo API. It offers you libraries in multiple languages to quickly get started. Currently, it offers PHP, Python, Perl, and Ruby libraries. On the top, it offers detailed documentation and sample codes for each library as well. You can visit their documentation page to get started with libraries.
It also has some packages for the frameworks to help you quickly integrate IPInfo in your applications. Currently, it has packages for Rails, Django, and Laravel, which can be found on their documentation page.
→ Bulk Lookup
Currently, IPInfo supports bulk lookup via UNIX commands only. What you can do is, save a list of the inputs inside a text file and then run a UNIX command recursively. It will pick each argument one by one and hit the IPInfo endpoints to fetch the results.
Let’s consider a few IP addresses saved inside a text file. We want to perform a bulk lookup on them and want to find out their country only. Below is a gist of the code containing sample IPs, UNIX command, and sample output of bulk lookup.
→ More Features
Aforementioned features are a gist of what IPInfo has to offer to the developers. I have listed the major ones above and a few other worth mentioning features are briefly mentioned below:
- ⚡️ Filtering Bot Traffic: You definitely don’t want to waste your requests on the bots. One way to avoid API calls for bot traffic is to put a filter. IPInfo has curated a detailed article on how you can do it on your site and reduce the API calls. 👌
- 🚀 Replacing getCurrentPosition(): Now, most of the browsers provide a built-in
getCurrentPosition()function to help you find user’s coordinates after appropriate permission. But there are a few drawbacks to it, the IPInfo team has documented a detailed guide on this topic and using it in combination with IPInfo API.
- 🌟 Full Country Names: One thing that you might have noticed is that IPInfo provides ISO-2 country codes instead of full names. If you are interested in displaying the full names you can utilize their JSON file to do the job.
Another last but not least interesting fact about IPInfo is its extensive documentation. That’s probably one of the most comprehensive documentation you’ll ever encounter. Repleted with code snippets, well-organized, and greatly written. Using IPInfo can help you save tons of your time by relying on the documentation. ✌️
The reason why I look for documentation is the fact that it reflects how much the developers of the product care about their users. Figuring out things at your own and writing emails back and forth consumes a lot of time, while good documentation saves time and gives a solid reason to choose it.
✌️ Wrap Up
From my experience, I can say IPInfo is highly reliable, amazingly fast, and accurate. It yields a promising result and actually helps you get the job done. Six years of history, big names in the client’s list, solid documentation, and a scalable infrastructure make it stand out.
If you’re planning on building an application which will rely on user IP information or similar data, you should definitely give it a shot. In fact, you can always try its free version to check out if that’s something you need. Later, you can transit to the required plan.
👉 Overall, it’s a pretty great product with an impressive line of features. However, from a consumer perspective, I would really appreciate some plans with the same features varying only in no. of requests. For example, as mentioned earlier, I needed only geo-location, which comes in the basic plan. But basic plan limits to 250k lookups per month. What if I need more lookups as the audience grows? I ended up paying for a standard plan just to increase the lookups, not the features.
Have you used IPInfo or any similar service to drill user’s information? Which service did you use and how was your experience? Let us know your thoughts in the comments section below.
SUBSCRIBE TO DEVELOPERS TAKEAWAY!
A Premium Development Newsletter by TheDevCouple! What is TheDevTakeaway?