While not a first-class feature of RightMessage, many of our customers have asked about geolocation.
This guide walks you through how easy it is to personalize based on geolocation.
When it comes to geolocating visitors on your website, you have two options:
Follow our guide for installing your custom tracking script, but instead have our tracking script load within the following loadRM()
function.
This sample code is coming soon.
You can personalize (change images, text, etc.) per your location segments the same way you’d personalize for any other segment data. See our guide to creating auto-segment rules for more information.
You’ll want to add JavaScript variables rules that reference the data you expose to your page (after successfully geolocating.) If you’re using the script examples above, this would be:
{
"ip": "161.185.160.93",
"hostname": "161.185.160.93",
"type": "ipv4",
"continent_code": "NA",
"continent_name": "North America",
"country_code": "US",
"country_name": "United States",
"region_code": "NY",
"region_name": "New York",
"city": "Brooklyn",
"zip": "11238",
"latitude": 40.676,
"longitude": -73.9629,
"location": {
"geoname_id": 5110302,
"capital": "Washington D.C.",
"languages": [
{
"code": "en",
"name": "English",
"native": "English"
}
],
"country_flag": "http://assets.ipapi.com/flags/us.svg",
"country_flag_emoji": "🇺🇸",
"country_flag_emoji_unicode": "U+1F1FA U+1F1F8",
"calling_code": "1",
"is_eu": false
},
"time_zone": {
"id": "America/New_York",
"current_time": "2018-09-24T05:07:10-04:00",
"gmt_offset": -14400,
"code": "EDT",
"is_daylight_saving": true
},
"currency": {
"code": "USD",
"name": "US Dollar",
"plural": "US dollars",
"symbol": "$",
"symbol_native": "$"
},
"connection": {
"asn": 22252,
"isp": "The City of New York"
},
"security": {
"is_proxy": false,
"proxy_type": null,
"is_crawler": false,
"crawler_name": null,
"crawler_type": null,
"is_tor": false,
"threat_level": "low",
"threat_types": null
}
}
Segmenting everyone in the United States is then as simple as creating an auto-segment rule where location.country_code
is equal to “US”.
You can also output location content directly to a page (“Hello, London!”) using Liquid templating.
Create a segment called something like “Has Location” (where, e.g., the location.city
value doesn’t equal “”), and then create a personalization campaign that targets it.
Find the text you want to change, and set it to “Hello, {{ js.location.city }}!”
RightMessage can automatically send segmentation data, captured either through behavior or survey responses, directly to your integrated ESP/CRM.