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

Platforms:   iOS   Android 

Note

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

iOS

When you want to handle your geotriggers, or use them as trigger events for your own code, you can use the geotrigger handler. The delegate passed to initializeWithPublicKey:launchOptions:delegate: may implement the optional method -(void)plotHandleGeotriggers:(PlotHandleGeotriggers*)geotriggerHandler. When the method is implemented, 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. Please note that due to restrictions in iOS dwelling time is not supported for geotriggers in iOS.

Make sure to always call markGeotriggersHandled: at the end of your handling, even when you have no geotriggers left. This way our plugin knows you have finished.

//Example for plotHandleGeotriggers:
-(void)plotHandleGeotriggers:(PlotHandleGeotriggers*)geotriggerHandler {
    NSMutableArray* toPass = [[NSMutableArray alloc] init];
    for (PlotGeotrigger* geotrigger in geotriggerHandler.geotriggers) {
        if ([@"pass" isEqualToString:[geotrigger.userInfo objectForKey:PlotGeotriggerDataKey]]) {
            [toPass addObject:geotrigger];
        }
    }
    // Always call markGeotriggersHandled at the end of the method
    [geotriggerHandler markGeotriggersHandled:toPass];
}

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

When you have enabled the data protection feature of iOS, you have to ensure that the files you read in the handler are readable when the phone is locked. This can for example be done by setting the protection level of these files to None or CompleteUntilFirstUserAuthentication.