Geofencing and location-based messaging

Using location tracking with Leanplum

In Leanplum, you have the ability by default in our SDKs to target users based on their City, State/Region or Country. This is automatically captured in the SDK on the .start() call. For those use cases where you want to target a user in more specific location (ie: an Airport, specific store etc), you can set up a geofence and iBeacon region to trigger in-app messages and push notifications. You will set up the regions from the dashboard and the below will show you what you need to do to implement client side.

Location Services Setup Guides

Click the below platform specific setup guide for implementing location services in Leanplum

Setting up iBeacons and location services

Setting up location services

Setting up location services

How it works

By default, Leanplum will use IP-based geolocation for all users. This is captured in the Leanplum.start() call. The Leanplum SDK can also capture GPS/cell-based geolocation from the user's device when available. This can be accomplished with our separate Leanplum Location library.

A few other notes about Leanplum location based messaging:

  • GPS/cell-based information is always trusted more — when available, we use the latitude/longitude coordinates from the device and use reverse-geocoding to determine the name of the Country, Region, and City.

  • Geolocation is gathered only on app start or resume, so a user's location is based on their most recent session.

  • We also provide methods to disable automatic collection of GPS/cell-based geolocation (not IP), as well as a method to set user location manually, which allows you to truncate the lat/long to a custom number of decimal points, ultimately limiting the precision of geolocation and protecting user privacy.

You could, for example, then truncate to two decimal places, which will blurring the accuracy to about a 1 kilometer. See our iOS location services and Android location services docs for more on these methods.


Note on Geo-Fence Setup

If you set up a message or campaign with a geofence region that has a radius smaller than 20km, we only include users with CELL or GPS Location accuracy. (Because this kind of campaign is very location-specific, we require a high degree of confidence to run it.) If the geofence radius is 20km or larger, we will also include users with IP Location accuracy.