Table of Contents

Web Analytics - Location (Country, State)

About

Location is a dimension of a visit that can be defined in a hierarchical level as:

Management

Ip to Country

The Ip of a visit can be mapped back to the country with a process called geolocalization.

Example with an JQuery ajax to the great https://ip2c.org/ ip to country service.

$.ajax(
	'https://ip2c.org/self',
	{
		success: function (data) {
			console.log("The data that we get from Ip2C: "+data);
			let countryCode = data.split(";")[1];
			let countryDesc = data.split(";")[3];
			console.log('Your country is '+countryDesc+" ("+countryCode+")");
		}
	}
)