Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySumbit a ticketLog In
GitHubNuGetDev CommunitySumbit a ticket
These docs are for v2.0. Click to read the latest docs for v3.0.

Bot filtering allows you to filter events by sending user agents to Optimizely with your events. Optimizely will compare the list of user agents you send to a list of known bots, and filter all user agents that are on the IAB/ABC blacklist.

## Enable bot filtering

Navigate to _Settings_ > _Advanced_ > _Bot Filtering_ in the Optimizely app to turn bot filtering on or off. For more information, see our KB article [Bot and spider filtering in Optimizely](🔗).

## Client-side JavaScript events

No additional JavaScript code is required to enable bot filtering for events sent from browsers. When you track an event by calling the JavaScript SDK’s `Activate`, `Is Feature Enabled`, or `Track` methods, the SDK automatically includes the user’s user agent in the outbound request. If bot filtering is enabled for your project, Optimizely applies bot filtering automatically.

## All other Full Stack events

When you track events with an SDK from somewhere other than a web browser, you must pass the user agent to be filtered with your event. You should pass it using the reserved `$opt_user_agent` attribute in the `Track`, `Activate`, `Is Feature Enabled`, and `Get Enabled Features` functions. If bot filtering is enabled for your project and the user agent is passed in this way, Optimizely applies bot filtering.


**Enable bot filtering in Optimizely first**. Before implementing the `$opt_user_agent` attribute, navigate to _Settings_ > _Advanced_ in the Optimizely app to turn bot filtering on or off.

The example below shows how to pass the `$opt_user_agent` attribute.