Plot Projects integration
Segment your users based on the places they visit and add a location-intelligence layer to your marketing campaigns.
Using Plot Projects and Leanplum together allows you to segment your users based on the places they visit and add a location-intelligence layer to your marketing campaigns.
For example, you can send push notifications to and target users whom you have qualified as 'Train Commuters’ based on who visited a train station more than eight times in the last week.
Visit Plot Project's docs for more info.
Set up a Listening Campaign in the Plot Projects dashboard
Plot Projects offers a Geo SDK that easily connects to the Leanplum SDK. Once this is done you can create Listening Campaigns in the Plot Projects dashboard that track visits of your users.
The first step is to create the locations you want to track. This can be a single location like a train station:
Or a large set of locations:
Once your locations are set up, you can create a Plot Projects Listening Campaign defining the Segment you’d like users to be added after visiting the designated location(s).
When creating the campaign, set the field "Listening campaign Data" with the tag value visited_train_station
.
That’s it, you’ve finished setting up the location campaigns! Users can now be automatically added to the corresponding segments in your Leanplum dashboard.
Plot Projects Listening Campaigns have many options, including:
- Trigger on geofences, polygons, and/or beacons.
- Trigger on enter, exit, or dwell.
- Define opening hours per location.
- Define start and end dates of the campaign.
Integrating with your app
Now that your Listening Campaign is set up, your app can be location-aware and track the events in Leanplum. This integration guide is designed for iOS and Android, but also works for other supported platforms of the Plot SDK.
After completing the integration guide, if a user enters the station, Plot Projects triggers a Leanplum event which will be available on the Events page and can be selected when building an audience. You can then save this Audience from the Audiences page and use it to target users with specified attributes.
iOS integration
Start with Leanplum's iOS setup guide and with the Plot Projects iOS integration guide. After integrating both libraries, you can track geotrigger events from Plot Projects in Leanplum.
To receive geotrigger events from Plot Projects add the plotHandleGeotriggers
method to your AppDelegate.m file. In that method you also call the Leanplum API in order to send the event.
The plotHandleGeotriggers
method sends an event to Leanplum using the data field set in the dashboard as key and the current timestamp as value.
- (void)plotHandleGeotriggers:(PlotHandleGeotriggers*) geotriggerHandler {
for (PlotGeotrigger* geotrigger in geotriggerHandler.geotriggers) {
NSString* data = [geotrigger.userInfo objectForKey:PlotGeotriggerDataKey];
NSString *now = [NSString stringWithFormat:@"%.f",[[NSDate date] timeIntervalSince1970]];
NSDictionary* info = [NSDictionary dictionaryWithObject:now forKey:@"Date"];
[Leanplum track:data withParameters:info];
NSLog(@"Tracking event with properties:(%@,%@)",data,info);
}
[geotriggerHandler markGeotriggersHandled:geotriggerHandler.geotriggers];
}
What's next
Users are now added automatically to the corresponding segments in the Leanplum dashboard. You can now target or create location-based marketing campaigns for these segments.
Android Integration
Start with Leanplum's Android setup guide and with the Plot Projects Android integration guide. After integrating both libraries, you can track geotrigger events from Plot Projects in Leanplum.
To receive geotrigger events from Plot Projects, create a class that extends GeotriggerHandlerBroadcastReceiver
. To track the geotrigger event you call the Leanplum API from that class.
The MyGeotriggerHandlerBroadcastReceiver
, presented above, records an event for Leanplum using the data field set in the dashboard as key.
public class MyGeotriggerHandlerBroadcastReceiver extends GeotriggerHandlerBroadcastReceiver {
private static final String LOG_TAG = "MyGeotriggerHandler";
@Override
public List<Geotrigger> handleGeotriggers(List<Geotrigger> list) {
for (Geotrigger geotrigger: list)
try {
String key = geotrigger.getData();
Leanplum.track(key);
Log.d(LOG_TAG, "track Leanplum event: " + key);
} catch (LeanplumException e) {
// handle Leanplum exception
}
return list;
}
}
To let Android find the receiver, add it to AndroidManifest.xml.
<receiver
android:name=".MyGeotriggerHandlerBroadcastReceiver"
android:permission="false">
<intent-filter>
<action android:name="${applicationId}.plot.HandleGeotriggers" />
</intent-filter>
</receiver>
What's next
Users are now added automatically to the corresponding segments in the Leanplum dashboard. You can now target or create location-based marketing campaigns for these segments.
Updated over 3 years ago