In today's digital landscape, every piece of information we can get about the user aids in enriching their online experience. By sifting through the data, we can examine their behavior and tailor our products to their evolving tendencies and expectations.

For publishers and advertisers alike, the more they understand their target audience, the more their message can be amplified through relevancy. 

One of these pieces of data that advertisers and publishers are becoming increasingly interested in is the user's geographical location.

What's location data used for? 

Location data provides valuable insight about users which can be used for different purposes. In certain cases, publishers may want to use it to see where their core audience is so they can cater their content to feed a growing niche market that's trending in a specific geographical location. 

Advertisers use it to strengthen their ad campaigns and increase CTR by delivering locally targeted ads for local goods and services. 

Whatever the constructive intention for obtaining this type of data, the Marfeel Progressive WebApp (PWA) offers two different options.

HTML5 Geolocation API

The HTML5 Geolocation API provides the precise longitude and latitude of the user accessing a Marfeelized mobile site.

The drawbacks to this API is that it requires the user's permission for it to be able to access and record this data.

In addition, not all mobile browsers support these types of APIs which may limit their impact depending on the browsers the audience is running. You can find a brief overview on the browsers supported here: http://caniuse.com/#feat=geolocation.

IP-Based Geolocation Services

Marfeel also offers an IP-based geolocation service that provides the user's city or area that we track from a precise database, without intrusively asking for or requiring permission.

In most cases where publishers or advertisers require geolocation data, the user's country and city fulfill the majority of their needs.   

For more information on location data trends in the current marketing ecosystem, check out our blog post on location-based marketing.

How Marfeel consumes IP-based information 

JavaServer Pages (environment variable)

On the server side, we're able to enable or disable Marfeel in certain countries. 

Essentially, IP-based information allows us to make decisions on the server. 

JavaScript (variable)

IP-based information allows us to make configurations on the client side. 

For example, when clients want to display different ads depending on country, we can configure this behavior. The same would be the case if we needed to configure a widget for different locations. 

switch (window.marfeel.geo) {
    case "US":
        // Advertisement setup for United States
        ...
        break;
    case "ES":
    case "FR":
    case "GB":
        // Advertisement setup for Spain, France and Great Britain
        ...
        break;
    default:
        // Advertisement setup for the rest of countries
    
}
CODE

For a complete list of country codes, see the ISO Online Browsing Platform