Most communication between users and websites requires IP addresses. However, when profiling web traffic it is more useful to consider where users are physically located. Geocoding is the process of translating an IP address to a physical location.
Geocoding is an imprecise science. It works by looking up an IP address in a database. Databases use a variety of information sources to link IPs and locations, such as tracing web traffic and ownership of IPs. However there is no permanent mapping from an IP address to a location, so this is a "best efforts" service.
This article describes how to code IPs in Displayr. To demonstrate geocoding, we'll use the IP addresses of the universities listed on this website. We are using universities because they each have a defined location, enabling us to check if this matches their geocoding. The first task is to convert URLs to IP addresses using DNS. The 25 IP addresses are listed below. If you are analyzing traffic from a website then you'll have a list of IP addresses already (rather than URLs).
Note that we are using IPv4 addresses but this works with IPv6 addresses as well.
- A data set that contains either URL or IP addresses.
- To perform geocoding in Displayr, select the variable containing the IP addresses from the Data Sets tree.
- Either hover over any variable in your Data Sets tree > Plus (+) > Insert Variable(s) > Ready-Made New Variable(s) > Countries from IP Address(es) (Geocoding) or else from the toolbar menu, select Anything > Data > Variables > New > Ready-Made New Variable(s) > Countries from IP Address(es) (Geocoding).
- This will create a new Nominal: Mutually exclusive categories variable that is the country, see below:
Geocoding in Displayr uses the flipAPI package which uses the rgeolocate package, which in turn uses a MaxMind database.
How to Import and Analyze Google Trends Data
Article is closed for comments.