Events and Destinations Filtering in JavaScript SDK

Filter events for your allowlist or denylist via the RudderStack JavaScript SDK.

This guide covers how to achieve the following filtering operations:

  • Filtering events while sending them to the specified destinations.
  • Filtering destinations where the SDK sends the event data.

Filtering events

When sending events to a destination via web device mode, you can specify which events should be discarded or allowed to flow through - by allowlisting or denylisting them using the Client-side Event Filtering feature.

Filtering destinations

You can send the event data only to the selective destinations by passing an integrations object in the loadOptions parameter. RudderStack then loads or 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
    }
});
  • A sample track method 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.


Questions? Contact us by email or on Slack