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 console tab.

Cloudflare Dashboard.

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

Overview of Workers.

Overview of Workers.

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

Quick edit Worker.

Quick edit Worker.

Option B: From your codebase

Locate your current DataDome Worker code.

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 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_TIMEOUT300timeout
DATADOME_LOG_VALUES[]logpushConfiguration
DATADOME_URI_REGEXnullFused with URLPatternInclusion
DATADOME_URL_REGEXnullURLPatternInclusion
DATADOME_URI_REGEX_EXCLUSIONSee list of static assets below.URLPatternExclusion
DATADOME_HOSTNAME_REGEX_EXCLUSIONnullIs now set inside Worker's Triggers -> Custom Domains
DATADOME_JS_HOSTNAME_REGEX_EXCLUSIONnullFused with jsURLRegexExclusion
DATADOME_JS_URI_REGEX_EXCLUSIONnullFused with jsURLRegexInclusion
DATADOME_URL_REGEX_EXCLUSIONnulljsURLRegexExclusion
DATADOME_JS_URL_REGEXnulljsURLRegexInclusion
DATADOME_IP_FILTERINGnullIPExclusion
DATADOME_ENABLE_DEBUGGINGfalseenableDebugging
DATADOME_ENABLE_GRAPHQL_SUPPORTfalseenableGraphQLSupport
/\.(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. Optional: Remove Cloudflare Worker HTTP Service Binding
    1. Delete the binding to your Worker B from the interface (Workers & Pages > datadome-service-name > Bindings) or from your wrangler.toml file.
    2. Delete the DataDome Worker from the Route and Domain, and set your Worker B on that same Route and Domain.
  2. If you want to use the new DataDome package, you can follow these installation steps.
  3. 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,
        });
  1. You can now remove the old DataDome Worker from the Routes & Domains it was on.
  2. You can delete the old DataDome Worker.
  3. Congrats! You migrated from DataDome Worker v1 to DataDome Worker v2!