Skip to content

Dealing with data campaigns

Since version 1.10.0 we support geotriggers. A geotrigger is used to see if users enter or exit a geofence. It works the same as a geofence notification, but does not display anything on the device of the user. You can use the geotrigger handler to call custom code inside your app, which allows you to create events depending on your app users location. Geotriggers are also available for iBeacons.

Please note that due to restrictions in iOS dwelling time is not supported for geotriggers, we do support it for Android. A full overview of the supported features can be found here.

We have blogged about how to use the geotrigger handler here.

Data Campaigns

Data campaigns is our new term to describe campaigns that are not used to show Notifications to the users’ devices as opposed to Notification campaigns. They only gather insights concerning the user’s location activity.

Data campaigns include two sub-types of campaigns. Those are Listening campaigns and Attribution campaigns.

Listening campaigns represent the previously called Geotrigger campaigns. More information about the Attribution campaigns can be found in the Attribution Campaign Guide.

Data Campaigns

Geotrigger handling

Note

It's important to keep in mind that on the device side all data campaigns notifications are called geotriggers.

Android

When you want to handle your geotriggers, or use them as trigger events for your own code, you can use the geotrigger handler. Plot automatically detects whether a service is registered in AndroidManifest.xml that extends from the class GeotriggerHandlerBroadcastReceiver. Implementations of GeotriggerHandlerReceiver must implement the method public List<Geotrigger> handleGeotriggers(List<Geotrigger> geotriggers). When the service is defined, Plot will send the geotriggers to this method before considering them as handled. This allows you to add custom code that is triggered by entering (or exiting) a geofence or beacon region.

//Example implementation for handleGeotriggers:
public class MyGeotriggerHandlerReceiver extends GeotriggerHandlerBroadcastReceiver {
    @Override
    public List<Geotrigger> handleGeotriggers(List<Geotrigger> geotriggers) {
        List<Geotrigger> passedGeotriggers = new ArrayList<Geotrigger>();
        for (Geotrigger geotrigger : geotriggers) {
            String data = geotrigger.getData();
            if (data.equals("pass")) {
                passedGeotriggers.add(geotrigger);
            }
        }
        return passedGeotriggers;
    }
}

And add this receiver to the manifest:

<receiver android:name=".MyGeotriggerHandlerReceiver" android:exported="false">
    <intent-filter>
        <action android:name="${applicationId}.plot.HandleGeotriggers" />
    </intent-filter>
</receiver>

You can read all fields from a geotrigger just as you would do that for a notification in the notification filter. Full reference for this can be found in the library reference.