Use Cases

Geo-targeted content

You can use CheerVision API to identify the location of your website visitors and serve them geo-targeted content based on their location.

We recommend performing the check on server side (i.e. not on client side). Otherwise, users can easily bypass your restriction. 

Here is a PHP code snippet example:

<?php$ip = $_SERVER['REMOTE_ADDR'];$api_key = 'YOUR_API_KEY_HERE';$url = "https://ipdata.cheervision.co/?ip=$ip&key=$api_key";$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$response = curl_exec($ch);curl_close($ch);$data = json_decode($response, true);$country = $data['location']['country']['name'];if ($country == 'United States') {  // serve geo-targeted content for US visitors} elseif ($country == 'Canada') {  // serve geo-targeted content for Canadian visitors} else {  // serve default content for other visitors}?>



Blocking Users by Country

The CheerVision API enables content restriction from a list of countries.

Here is a PHP code snippet example to detect users country and take action:

<?php$apiKey = 'YOUR_API_KEY';$ipAddress = $_SERVER['REMOTE_ADDR'];$ipCVUrl = "https://ipdata.cheervision.co/?ip=$ip&key=$api_key";$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $ipCVUrl);curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);$response = curl_exec($curl);curl_close($curl);$data = json_decode($response, true);$countryCode = $data['location']['country']['code'];if ($countryCode === 'US') {    header('HTTP/1.0 403 Forbidden');    exit('Access denied');}?>

Here is aPython code snippet example to detect users country and take action:

import requestsapi_key = 'YOUR_API_KEY'ip_address = requests.get('https://api.ipify.org').textip_registry_url = f'https://ipdata.cheervision.co/?ip=$ip&key=$api_key'response = requests.get(ip_registry_url)data = response.json()country_code = data['location']['country']['code']if country_code == 'US':    raise Exception('Access denied')



Detecting Users Currency

cheerVision helps you personalize your e-commerce or pricing pages with your users home currency.

If you are looking at a concrete example about how to implement currency localization, have a look at our technical post entitled Currency Conversion using Geolocation and Open Exchange Rates.

Request Example

curl https://ipdata.cheervision.co/?ip=210.138.184.59&key=$api_key

Response Example

"currency": {    "code": "JPY",    "name": "Japanese Yen",    "name_native": "日本円",    "plural": "Japanese yen",    "plural_native": "円",    "symbol": "¥",    "symbol_native": "¥",    "format": {        "negative": {            "prefix": "-¥",            "suffix": ""        },        "positive": {            "prefix": "¥",            "suffix": ""        }    }}

Field Description
currency → code The ISO 4217 3-letter currency code.
currency → name The name of the currency in US locale.
currency → name_native The name of the currency in native locale based on detected location and primary language.
currency → plural The plural name of the given currency in US locale.
currency → plural_native The plural name of the given currency in native locale based on detected location and primary language.
currency → symbol The symbol of the given currency. For instance, A$ for Australian dollars.
currency → symbol_native The native (local) symbol of the given currency. For instance, $ for Australian dollars.
currency → format → negative → prefix The currency prefix for negative amounts. For instance, - for -10 euros.
currency → format → negative → suffix The currency suffix for negative amounts. For instance,  for -10 euros.
currency → format → positive → prefix The currency prefix for positive amounts. For instance, $ for 10 US dollars.
currency → format → positive → suffix The currency suffix for positive amounts. For instance, the empty string for 10 US dollars.


Proxy, Tor and Threat Detection

CheerVision IP threat intelligence database includes over 620M malicious IP addresses. Among others, we track Tor nodes and open proxies. Data is checked and updated continuously. Publications occur as changes are detected to reduce false positives to their minimum.

Request Example

curl https://ipdata.cheervision.co/?ip=8.8.8.8&key=$api_key

Response Example

{    "security": {        "is_abuser": false,        "is_attacker": false,        "is_bogon": false,        "is_cloud_provider": false,        "is_proxy": false,        "is_relay": false,        "is_tor": false,        "is_tor_exit": false,        "is_vpn": false,        "is_anonymous": true,        "is_threat": false    }}
Field Description
security → is_abuser Boolean indicating whether the IP Address is a known source of abuse (e.g. spam, harvesters, registration bots).
security → is_attacker Boolean indicating whether the IP Address is a known source of malicious activity (e.g. attacks, malware, botnet activity).
security → is_bogon Boolean indicating whether the IP Address is a Bogon: an unassigned, unaddressable IP address.
security → is_cloud_provider Boolean indicating whether the IP address is used by a Content Delivery Network (CDN) or for hosting purposes (e.g. a node from Akamai, Cloudflare, Google Cloud Platform, Amazon EC2, and more).
security → is_proxy Boolean indicating whether the IP Address is a known proxy. It includes HTTP/HTTPS/SSL/SOCKS/CONNECT and transparent proxies.
security → is_relay Boolean indicating whether the IP Address is a known relay. Relay IP addresses are not designed to bypass geo-controls but instead pool multiple users behind the same IP. At this time, only Apple Private Relay IP addresses are detected.
security → is_tor Boolean indicating whether the IP Address is a Tor relay: exit relay node, middle relay node or a bridge.
security → is_tor_exit Boolean indicating whether the IP Address is a Tor exit relay node.
security → is_vpn Returns true when the IP address under search is used by a Virtual Private Network (VPN), false otherwise. VPNs encrypt internet traffic and disguise online identity.
security → is_anonymous Boolean with true value if is_proxy OR is_tor is satisfied.
security → is_threat Boolean with true value if is_abuser OR is_attacker is satisfied.