How to Filter Selective Destinations

An easy-to-follow guide on filtering selective destinations while sending event data in RudderStack

RudderStack lets you send your event data only to certain intended destinations by filtering out the rest. For the JavaScript SDK, you can do this by passing an integrations object in the options parameter of the event method. For most of the other SDKs, you can use the integrations object parameter for the associated event.

This feature is currently supported only for cloud mode integrations. For more information on the cloud mode, refer to the RudderStack Connection Modes guide.

How it works

The following example demonstrates how to send a sample event only to Google Analytics and Intercom via the JavaScript SDK:

rudderanalytics.identify(
  "sample user id",
  {
    email: "name@email.org",
    name: "sample name",
  },
  {
    integrations: {
      All: false,
      "Google Analytics": true,
      Intercom: true,
    },
  }
)

Unless explicitly defined otherwise, All is always set to true. This means that RudderStack sends the events to all destinations by default.

The line All: false instructs RudderStack not to send the event data to any destinations by default, unless they are explicitly set to true.

You can also disable sending event data to certain destinations. In this case, the event data is sent to all the other destinations except the specified ones. An example of how to do this is shown below:

rudderanalytics.identify(
  "sample user id",
  {
    email: "name@email.org",
    name: "sample name",
  },
  {
    integrations: {
      "Google Analytics": false,
      Intercom: false,
    },
  }
)

In the above code snippet, RudderStack will send the event data to all destinations except Google Analytics and Intercom.

Examples

The following are some examples of the track() call sent from a variety of SDKs.

Note that ome of the SDKs follow their own convention that is different than the examples below. The notable SDKs with different convention are iOS and Android. Refer to the respective SDK documentation for the correct format of filtering selective destinations.

JavaScript SDK

rudderanalytics.track(
  "samplename",
  "sampleEventName",
  {
    email: "name@email.org",
    name: "Samplename",
  },
  {
    integrations: {
      All: false,
      "Amazon S3": true,
      "Heap.io": false,
    },
  }
)

Python SDK

rudder_analytics.track(
    'sample event name',
    {
      'email': 'name@email.org',
      'name': 'sample name'
    },
    integrations={
      'All': False,
      'Amazon S3': True,
      'Heap.io': False
    }
)

In the above examples, the track events will only be sent to the Amazon S3 and Heap.io destinations.

Destination naming convention

To filter the destinations, you need to specify the exact destination names. To get these names, you can go to the RudderStack directory.

Note that the destination names are case sensitive.

Contact us

For more information on any of the sections in this guide, you can contact us or start a conversation in our Slack community.

Last updated