Get started with our free IP Geolocation API

Use visitor country, state & city data in your website

FREE PRODUCT

API Usage Instructions

Step 1 : Get a free API key emailed to you

The API key can only be used in the website provided. Enter your website domain only.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Step 2 : Install JavaScript in your website

Place the JavaScript code below in your website's footer or just before the closing </body> tag. Don't forget to replace {your-api-key} with your free API key.

<script>
(function(g,e,o,t,l,y){
var l=g.getElementsByTagName(e)[0],y=g.createElement(e); y.async=true;
y.src='//geotargetly-geoip.com?key={your-api-key}';
l.parentNode.insertBefore(y,l);
})(document,'script','style','head');
</script>

Step 3 : Use our geolocation tags or functions

Our geolocation tags allow you to easily display visitor location information in your website content using simple html class names.

<!-- geolocation html tags-->

<span class="geotargetly_country_name"></span>
<span class="geotargetly_country_code"></span>
<span class="geotargetly_region_name"></span>
<span class="geotargetly_region_code"></span>
<span class="geotargetly_city_name"></span>
<span class="geotargetly_lat"></span>
<span class="geotargetly_lng"></span>
<span class="geotargetly_ip"></span>

<!-- usage example -->
</p>We provide free shipping to <span class="geotargetly_country_name"></span></p>

Our geolocation functions allow you to obtain visitor location data in JavaScript using JavaScript functions. Don't forget to use the geotargetly_loaded() callback to ensure our data is available before assigning the functions to variables.

// -- geolocation JavaScript functions --

geotargetly_country_name();
geotargetly_country_code();
geotargetly_region_name();
geotargetly_region_code();
geotargetly_city_name();
geotargetly_lat();
geotargetly_lng();
geotargetly_ip();


// -- example usage --

function geotargetly_loaded(){
 var country_name = geotargetly_country_name();
 if (country_name == "United States"){
     //do something
 }
}

Live Demo

See the Pen Free IP Geolocation API by geotargetly (@geotargetly) on CodePen.

Learn more about free IP Geo Location API

Free vs paid, what's the difference?

We provide both free and paid versions of our Geo Location API product. The limitations of the free product are below:

Data accuracy - The free product data quality is exactly the same as the paid version, so you can enjoy premium accuracy for free!

Calls per month - The free product does not have any limitations to the number of calls per day or month, however we do monitor the keys for heavy misuse.

Server uptime & response - There is no guarantee on the free product server uptime and response time although we will do our best to maintain a 100% uptime and low response times.

Rate limiting - The free product has rate limiting on each API key to avoid misuse while the paid product has no rate limiting.

Number of keys - The free product is limited to 3 API keys per email whereas the paid product has no limitations on the number of keys you create and websites you can use them on.

Commercial usage - Yes the free product can be used for commercial purposes.

Can I query an IP address to retrieve IP location data?

We do not allow querying of IP addresses as we only provide a JavaScript client side API that will automatically detect a visitor's IP address in your website and return IP geolocation data in the form of JavaScript variables.

What IP location data is provided with the free IP geolocation API?

The API provides visitor country, country code, state, state code, city, latitude & longitude

Does the free IP geolocation API work for IPV6 addresses?

Yes our free IP geolocation API product and all other products support both IPV4 and IPV6 addresses.

Do you provide server side API's such as PHP, Node, C etc?

We only provide a JavaScript client side API to obtain visitor IP location data in your website. We do not support any server side languages.

“Easy to Implement and Fantastic Service”

Shawn B.
DIGITAL STRATEGY
TRY 14 DAYS FREE
Get started in minutes
No credit card required
Free on-boarding support
Your Privacy

We uses cookies to improve your experience on our site, analyse site traffic and to show you relevant content. By using our website, you consent to our use of cookies. For more information please, see our Privacy Policy

ACCEPT