Migrate via npm
Step 1: Extract your current configuration
Option A: From the Cloudflare Dashboard
Connect to your Cloudflare Dashboard and go to the Workers & Pages section.

Cloudflare Dashboard.
In the Overview page, click on your current DataDome Worker, in this example datadome-worker
.

Overview of Workers.
Click on the Edit code icon at the top of the page.

Quick edit Worker.
Option B: From your codebase
Locate your current DataDome Worker code.
Step 2: Map the v1 configuration to your v2 configuration
- 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 v1 | Default value | Name in npm pacjage |
---|---|---|
DATADOME_LICENSE_KEY | 'YOUR_DATADOME_SERVER_KEY' | serverSideKey |
DATADOME_JS_KEY | '' | clientSideKey |
DATADOME_JS_URL | 'https://js.datadome.co/tags.js' | jsURL |
DATADOME_JS_ENDPOINT | '' | jsEndpoint |
DATADOME_JS_TAG_OPTIONS | '{ "ajaxListenerPath": true }’ | jsTagOptions |
DATADOME_TIMEOUT | 300 | timeout |
DATADOME_LOG_VALUES | [] | logpushConfiguration |
DATADOME_URI_REGEX | null | Fused with URLPatternInclusion |
DATADOME_URL_REGEX | null | URLPatternInclusion |
DATADOME_URI_REGEX_EXCLUSION | See list of static assets below. | URLPatternExclusion |
DATADOME_HOSTNAME_REGEX_EXCLUSION | null | Is now set inside Worker's Triggers -> Custom Domains |
DATADOME_JS_HOSTNAME_REGEX_EXCLUSION | null | Fused with jsURLRegexExclusion |
DATADOME_JS_URI_REGEX_EXCLUSION | null | Fused with jsURLRegexInclusion |
DATADOME_URL_REGEX_EXCLUSION | null | jsURLRegexExclusion |
DATADOME_JS_URL_REGEX | null | jsURLRegexInclusion |
DATADOME_IP_FILTERING | null | IPExclusion |
DATADOME_ENABLE_DEBUGGING | false | enableDebugging |
DATADOME_ENABLE_GRAPHQL_SUPPORT | false | enableGraphQLSupport |
/\.(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
- Optional: Remove Cloudflare Worker HTTP Service Binding
- Delete the binding to your Worker B from the interface (Workers & Pages > datadome-service-name > Bindings) or from your
wrangler.toml
file. - Delete the DataDome Worker from the Route and Domain, and set your Worker B on that same Route and Domain.
- Delete the binding to your Worker B from the interface (Workers & Pages > datadome-service-name > Bindings) or from your
- If you want to use the new DataDome package, you can follow these installation steps.
- Update the settings using the table created in step 2. Eg:
const dataDomeHandler = activateDataDome(myHandler, {
serverSideKey: env.DATADOME_SERVER_SIDE_KEY,
clientSideKey: env.DATADOME_CLIENT_SIDE_KEY,
});
- You can now remove the old DataDome Worker from the Routes & Domains it was on.
- You can delete the old DataDome Worker.
- Congrats! You migrated from DataDome Worker v1 to DataDome Worker v2!
Updated about 17 hours ago