Data Collection

You can disable data collection by default and require your users to opt in to data collection to register and receive notifications.

The SDK includes settings to disable both Analytics and Data Collection. Disabling analytics prevents the system from gathering event information from your user, but still allows registrations, attributes, etc.

Disabling data collection prevents new registrations.

Informationwith Analytics Disabledwith Data Collection Disabled
Direct engagement (clicks)
Session
Custom Events
Attributes
Tags
Named User
Registration
Opt-out

Disable data collection by default

You can require users to opt in before collecting any data about them. When dataCollectionOptInEnabled is true, Airship will not collect data about users who are not opted in. Adding this setting to your push worker and snippet configurations does not affect currently registered users.

Require Users to Opt In before Collecting Data
...
  'UA', {
    vapidPublicKey: 'vapidPublicKey',
    appKey: 'appKey',
    token: 'token',
    dataCollectionOptInEnabled: true // add this!
});

 Note

dataCollectionEnabled is calculated for a user when they first visit your site, and stored in the browser (IndexedDB). If data collection is disabled for a member of your audience, the setting will stay that way even if you remove dataCollectionOptInEnabled from your snippet. The only way to change the setting for your audience is to set sdk.dataCollectionEnabled = true.

Opting in to data collection

You can restore Airship functionality by opting back into data collection. Set to false to disable data collection.

Enable data collection for the audience
UA.then(function(sdk) {
  sdk.dataCollectionEnabled = true
})

You can check if data collection is enabled with the following:

UA.then(function(sdk) {
  sdk.dataCollectionEnabled.then(enabled => enabled === true)
})

Opting out of data collection

Opting a user out of data collection will also opt them out of notifications.

UA.then(function(sdk) {
  sdk.dataCollectionEnabled = false
})