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 Android, but also works for other supported platforms of the Plot SDK. You can find iOS documentation here 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 Android app, create a class that extends from GeotriggerHandlerReceiver. In that class you call the OneSignal API in order to send the event.

public class SendTagGeotriggerHandlerReceiver extends GeotriggerHandlerReceiver {

   static final String LOG_TAG = "Send tag Handler";

   @Override
   public List<Geotrigger> handleGeotriggers(List<Geotrigger> geotriggers) {

       for (Geotrigger geotrigger : geotriggers) {
           String data = geotrigger.getData();
           String now = String.valueOf(System.currentTimeMillis() / 1000);
           OneSignal.sendTag(data,now);
           Log.d(LOG_TAG, "Sent tag " + "(" + data + ", " + now + ")");
       }
       return geotriggers;
   }
}

The SendTagGeotriggerHandler, presented above, sends a tag to OneSignal using the data field set in the dashboard as key and the current timestamp as value.

To let Android find the service, add it to AndroidManifest.xml

<service android:name=".SendTagHandlerReceiver" android:exported="false" />

If you are having any dependency conflicts read about how to fix them here.

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.