Version:

Events Filtering in JavaScript SDK

Filter events sent to downstream destinations using the JavaScript SDK.

This guide covers the following event filtering use cases:

Filter destinations while loading SDK

You can send the event data only to the selective destinations by passing an integrations object in the load API options. RudderStack then loads and sends events only to the specified (and enabled) destinations.

A sample snippet to send event data only to the Google Analytics and Intercom destinations:

rudderanalytics.load(WRITE_KEY, DATA_PLANE_URL, {
    integrations: {
        All: false,
        "Google Analytics": true,
        "Intercom": true
    }
});

Filter destinations at event level

In this scenario, the SDK sends events only to the specified (and enabled) destinations at the individual API level.

A sample track event instrumentation to send event data only to the Google Analytics destination:

rudderanalytics.track(
    "Order Completed", {
        revenue: 30,
        currency: "USD",
        user_actual_id: 12345
    }, {
        integrations: {
            All: false,
            "Google Analytics": true
        }
    }
);

The destination name inside the integrations object should exactly be the same as displayed in the RudderStack dashboard.

Client-side event filtering

When you send events to a destination via web device mode, you can use the Client-side Events Filtering feature to configure the track events that should be discarded or allowed to flow through.


Questions? Contact us by email or on Slack