How to Allow or Block an Event for a Specific Destination

Learn how to allow or block an event for a specific destination in the Kotlin SDK.

This guide demonstrates how to use the integrations field of the RudderOption instance to implement event filtering, that is, allowing or blocking an event from being sent to a specific destination.

Overview

By default, the integrations object is configured to send the event to all destinations which are present and initialized.

{
  //.....
  "integrations": {
    "All": true
  },
  //.....
}

You can override this behavior by tweaking the integrations object to allow or block an event from being sent to a specific destination in cloud, device, or hybrid mode.

info
The SDK does not persist the integrations field set for an event for subsequent events. Therefore, you must pass this parameter every time you want to allow or block an event for a specific destination.

Allow event for a specific destination

To send an event only to a specific destination, configure the integrations options so that:

  • The All parameter is set to false
  • The destination-specific parameter is set to true
warning

The destination name in the integrations object should match the name exactly as displayed in the RudderStack dashboard. It should not be the name that you assigned to the destination while setting it up in RudderStack.

An example of how to configure the integrations options to allow an event to be sent only to the Firebase destination is shown below:

After making the above call, the integrations key at the root level of the event payload is shown below. RudderStack then sends this event only to the Firebase destination.

{
  //.....
  "integrations": {
    "All": false,
    "Firebase": true
  },
  //.....
}

Block event for a specific destination

To block an event from being sent to a specific destination, configure the integrations options so that:

  • The All parameter is set to true
  • The destination-specific parameter is set to false
warning

The destination name in the integrations object should match the name exactly as displayed in the RudderStack dashboard. It should not be the name that you assigned to the destination while setting it up in RudderStack.

An example of how to configure the integrations options to block an event from being sent to the Firebase destination is shown below:

After making the above call, the integrations key at the root level of the event payload is shown below. RudderStack then sends this event to all destinations except Firebase.

{
  //.....
  "integrations": {
    "All": true,
    "Firebase": false
  },
  //.....
}

Block event for all destinations

To block an event from being sent to all destinations, configure the integrations options so that:

  • The All parameter is set to false

An example of this use case is shown below:

After making the above call, the integrations key at the root level of the event payload is shown below. RudderStack then does not send this event to any destination.

{
  //.....
  "integrations": {
    "All": false
  },
  //.....
}

Questions? Contact us by email or on Slack