Skip to content

OneSignal

Using Plot Projects and OneSignal together allows you to segment your users based on the places they visit. This allows you to for instance send a push notification to users that visited 'LAX' or 'a Walmart in the last 7 days':

OneSignal Goal

Set up a Listening Campaign in the Plot Projects dashboard

Plot Projects offers a Geo SDK that easily connects to the OneSignal SDK (see paragraphs below). 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:

OneSignal Location

Or a large set of locations:

OneSignal Multiple Locations

Once your locations are set up, you can create a Plot Projects Listening Campaign defining the Segment the user should be added to after visiting the location. When creating the campaign, set the field 'Listening campaign Data' with the tag key value in json format. For example:

{"key": "visited_walmart"}

or

{"key": "visited_LAX"}

OneSignal 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 into your app

Now that your Listening Campaign is set up, your app can be location-aware and forward the events to OneSignal. 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 LAX, Plot triggers a OneSignal event. You can see the result in the OneSignal dashboard.

Start with the Plot Projects integration guide and the OneSignal integration guide. After integrating both libraries, you can track geotrigger events from Plot Projects in OneSignal.

To receive geotrigger events from Plot Projects on your iOS app, add the plotHandleGeotriggers method to your AppDelegate.m file. In that method you will also call the OneSignal API in order to send the event:

- (void)plotHandleGeotriggers:(PlotHandleGeotriggers*) geotriggerHandler {
        for (PlotGeotrigger* geotrigger in geotriggerHandler.geotriggers) {
            NSString* data = [geotrigger.userInfo objectForKey:PlotGeotriggerDataKey];
            NSString *now = [NSString stringWithFormat:@"%.f",[[NSDate date] timeIntervalSince1970]];
            [OneSignal sendTag:data value:now];
            NSLog(@"Sending tag pair:(%@,%@)",data,now);
        }
        [geotriggerHandler markGeotriggersHandled:geotriggerHandler.geotriggers];
}
The plotHandleGeotriggers method, presented above, sends a tag to OneSignal using the data field set in the dashboard as key and the current timestamp as value.

What's next

Users are now added automatically to the corresponding segments in the OneSignal dashboard. You can now target or create location-based marketing campaigns for these segments.