How to Filter Selective Destinations

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

RudderStack allows you to send your event data only to a few intended destinations by filtering out the rest. For the JavaScript SDK, you can do so by passing an integrations object in the options parameter of the event method. For most of the other SDK's you can use the integrations object parameter for the associated event. The filter destination feature is currently only supported for cloud mode integrations.

How it works

The following is an example of how to send a sample message only to Google Analytics and Intercom in the JavaScript SDK:

rudderanalytics.identify(
"samplename",
{
name: "Samplename",
},
{
integrations: {
All: false,
"Google Analytics": true,
"Intercom": true
}
}
);

NOTE: Unless explicitly defined otherwise, 'All' is always set to true. This means that sending events to all destinations is enabled by default.

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

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 this is as shown from the JavaScript SDK:

rudderanalytics.identify(
"samplename",
{
name: "Samplename",
},
{
integrations: {
"Google Analytics": false,
"Intercom": false,
},
}
);

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

Examples

The following are examples for the same track() call from a variety of SDK's.

Please Note: Some of the SDK's follow their own convention that is different than the examples below. The notable SDK's with different convention are IOS and Android. Please read the respective SDK Integration Guide section for your given SDK to find the correct format to filter selective destinations.

JavaScript SDK

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

Python SDK

rudder_analytics.track(
'sampleName',
'sampleEventName',
{
'email': '[email protected]',
'name': 'Samplename'
},
integrations={
'All': False,
'Amazon S3': True,
'Heap.io': False
}
)

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

Destination Naming Convention

By default, for the destination name please use the displayed destination name on the RudderStack directory in your control plane.

These destination names are case sensitive!

Contact Us

For more information on any of the sections in this guide, feel free to contact us or start a conversation on our Slack channel, and we will be happy to help you!