DataDome Ruby module detects and protects against bot activity.

The DataDome Ruby SDK was developed as a gem and can be found part of the RubyGem ecosystem.


This integration is compatible with

  • Ruby on Rails applications with versions 3.2.2 and higher


  1. Install this gem by running gem install datadome_module.


Name of the gem is datadome_module

Please note that there may be other gems with names containing datadome that are not maintained by us.

  1. Update the config/application.rb to include require 'datadome_module'.
  2. Update the environment ruby files (meaning config/environments/development.rb, config/environments/production.rb, and any other environments where you want to enable the DataDome integration) to include the DataDome Module as middleware.
# This adds the DataDomeModule middleware that will be executed for each incoming request
config.middleware.use DataDomeModule
# This configures the DataDomeModule middleware to be executed before the exception handling middleware
config.middleware.insert_before ActionDispatch::ShowExceptions, DataDomeModule
  1. Open a terminal and set up the required configuration as environment variables.
## Mandatory
## Modify the value of the DATADOME_SERVER_SIDE_KEY to hold the value of your DataDome Server-side key available in your DataDome dashboard.

Congrats! You can now see your traffic in your DataDome dashboard.


Configuration of the DataDome module is done using environment variables.

Refer to the next Settings section for the full list of possible configuration settings.


SettingsEnvironment Variable NameDescriptionDefault value
Server-side keyDATADOME_SERVER_SIDE_KEYValue of your Server Side Key available in the dashboard.
API endpoint URLDATADOME_ENDPOINTURL of the closest
DataDome TimeoutDATADOME_TIMEOUTThe maximum amount of time that the client (Faraday) will wait to receive a response from the DataDome API after sending a request.300ms
Regex URL inclusion pattern matcherDATADOME_URL_PATTERN_INCLUSIONBy default, all dynamic calls invoke the DataDome API.
Regex URL exclusion pattern matcherDATADOME_URL_PATTERN_EXCLUSIONBy default no calls will be made to DataDome for static assets."\\.(avi|flv|mka|mkv|mov|mp4|mpeg|mpg|mp3|flac|ogg|ogm|opus|wav|webm|webp|bmp|gif|ico|jpeg|jpg|png|svg|svgz|swf|eot|otf|ttf|woff|woff2|css|less|js|map|json)$"


Can DataDome coexist with other integrations?

DataDome package has been written in the form of a Rack middleware.

Middleware components are executed in a specific order, from the outermost layer to the innermost layer. This order allows for a sequence of processing steps, and each middleware can modify the request or response before passing it to the next layer.

Consequently, the DataDome module can coexist with any other integrations present in the system.