Migrate via Wrangler

Step 1: Extract your current configuration

Inside your Worker project, locate the script from DataDome.

Step 2: Map the v1 configuration to your v2 configuration

  1. Retrieve the specific values that you may have set to configure your DataDome Worker that are not the default value to reuse them in the Worker v2 integration.
Name in Worker v1Default valueName in Worker v2
DATADOME_LICENSE_KEY'YOUR_DATADOME_SERVER_KEY'DATADOME_SERVER_SIDE_KEY
DATADOME_JS_KEY''DATADOME_CLIENT_SIDE_KEY
DATADOME_JS_URL'https://js.datadome.co/tags.js'DATADOME_JS_URL
DATADOME_JS_ENDPOINT''DATADOME_JS_ENDPOINT
DATADOME_JS_TAG_OPTIONS'{ "ajaxListenerPath": true }’DATADOME_JS_TAG_OPTIONS
DATADOME_TIMEOUT300DATADOME_TIMEOUT
DATADOME_LOG_VALUES[]DATADOME_LOGPUSH_CONFIGURATION
DATADOME_URI_REGEXnullFused with DATADOME_URL_REGEX_INCLUSION
DATADOME_URL_REGEXnullDATADOME_URL_REGEX_INCLUSION
DATADOME_URI_REGEX_EXCLUSIONSee list of static assets below.DATADOME_URI_REGEX_EXCLUSION
DATADOME_HOSTNAME_REGEX_EXCLUSIONnullIs now set inside Worker's Triggers -> Custom Domains
DATADOME_JS_HOSTNAME_REGEX_EXCLUSIONnullFused with DATADOME_JS_URL_REGEX_EXCLUSION
DATADOME_JS_URI_REGEX_EXCLUSIONnullFused with DATADOME_JS_URL_REGEX_INCLUSION
DATADOME_URL_REGEX_EXCLUSIONnullDATADOME_JS_URL_REGEX_EXCLUSION
DATADOME_JS_URL_REGEXnullDATADOME_JS_URL_REGEX_INCLUSION
DATADOME_IP_FILTERINGnullDATADOME_IP_EXCLUSION
DATADOME_ENABLE_DEBUGGINGfalseDATADOME_ENABLE_DEBUGGING
DATADOME_ENABLE_GRAPHQL_SUPPORTfalseDATADOME_ENABLE_GRAPHQL_SUPPORT
/\.(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)$/i

Step 3: migrate to new version

  1. Download the latest version of our Cloudflare Worker script.
  2. Copy the file datadome.tsinto your Wrangler project.
  3. Update the settings in the code of datadome.ts using the table created in step 2.
  4. Create a Cloudflare Worker secret named DATADOME_SERVER_SIDE_KEY:
wrangler secret put DATADOME_SERVER_SIDE_KEY

A prompt appears. Enter the value of your DataDome server-side key you can find in your DataDome Dashboard.

  1. Create a Cloudflare Worker secret named DATADOME_CLIENT_SIDE_KEY:
wrangler secret put DATADOME_CLIENT_SIDE_KEY

A prompt appears. Enter the value of your DataDome client-side key you can find in your DataDome Dashboard.

  1. Update your wrangler.toml file:
  • Change the value of main with the path to the datadome.ts file,
  • Add the route key to configure the domains and routes you want to set the DataDome Worker on.
name = "datadome-worker"
main = "src/datadome.ts"
route = { pattern = "example.org/*", zone_name = "example.org" }
  1. Deploy your Worker (you will be asked to authenticate with Cloudflare if you are not logged in already):
wrangler deploy
  1. Congrats! You migrated from DataDome Worker v1 to DataDome Worker v2!