Back to Blog
Tutorials

DataDome Bot Protection: JavaScript Analysis and Detection Mechanisms Guide

Technical breakdown of DataDome's bot detection JavaScript, device fingerprinting, signal collection, dd cookie structure, and real-time CAPTCHA system used by Reddit and Hermes.

Astify Team·2025-01-13·16 min read
#datadome#bot-protection#captcha#enterprise

What is DataDome?

DataDome is a real-time bot protection platform that distinguishes itself through its speed and accuracy of detection. Unlike solutions that rely heavily on client-side challenges, DataDome's primary detection engine operates server-side, analyzing every single HTTP request in under 2 milliseconds. The client-side JavaScript component supplements this with browser fingerprinting and behavioral signals that feed into DataDome's machine learning models.

DataDome protects major platforms including Reddit, Hermes, Rakuten, and thousands of e-commerce sites. For security researchers and analysts, understanding DataDome's JavaScript tag and detection methodology is important for privacy auditing, security assessment, and academic research.

DataDome Architecture

Server-Side Detection Engine

DataDome's server-side component processes every incoming request, analyzing:

  • Request patterns: Rate, frequency, and distribution of requests from each client
  • IP reputation: Cross-referencing against known bot networks, data centers, and residential proxy pools
  • HTTP fingerprint: TLS fingerprint (JA3/JA4), header ordering, and protocol-level signals
  • Session behavior: Navigation patterns, referrer chains, and resource loading sequences

Client-Side JavaScript Tag

The JavaScript tag is DataDome's client-side component. It collects browser fingerprint data and behavioral signals that cannot be gathered from server-side request analysis alone.

1// DataDome tag is typically loaded from:
2// https://js.datadome.co/tags.js
3
4// It can also be served from first-party domains
5// via reverse proxy configuration
6
7// The tag initializes with a configuration object:
8window.ddjskey = 'XXXXXXXXXXXXXXXXXXXXXXXX';
9window.ddoptions = {
10  ajaxListenerPath: true,
11  endpoint: '/dd/tags',
12  sessionByHeader: true
13};

Detection Decision Flow

  1. Request arrives: DataDome edge server intercepts the request
  2. Server-side analysis: Request metadata, IP, TLS fingerprint analyzed in real time
  3. Client-side signal integration: If JavaScript tag data is available, it enriches the detection model
  4. Decision: Allow, challenge (CAPTCHA), or block
  5. Cookie issuance: The datadome cookie is set or updated with session state

JavaScript Tag Deep Dive

Tag Loading and Initialization

1// Deobfuscated DataDome tag initialization flow
2(function() {
3  var apiKey = window.ddjskey;
4  var options = window.ddoptions || {};
5  var signals = {};
6
7  // Collect device information
8  signals.ua = navigator.userAgent;
9  signals.lang = navigator.language;
10  signals.pf = navigator.platform;
11  signals.sr = screen.width + 'x' + screen.height;
12  signals.cd = screen.colorDepth;
13  signals.tz = new Date().getTimezoneOffset();
14
15  // Collect browser capabilities
16  signals.ss = !!window.sessionStorage;
17  signals.ls = !!window.localStorage;
18  signals.idb = !!window.indexedDB;
19  signals.wgl = hasWebGL();
20
21  // Generate canvas fingerprint
22  signals.cv = getCanvasFingerprint();
23
24  // Check for automation
25  signals.wd = navigator.webdriver;
26  signals.hw = navigator.hardwareConcurrency;
27  signals.dm = window.deviceMemory;
28
29  // Send to DataDome endpoint
30  sendSignals(signals, apiKey, options.endpoint);
31})();

Signal Collection Categories

DataDome's JavaScript tag collects signals across several categories:

Device Fingerprint Signals

  • Screen properties: Resolution, color depth, pixel ratio, available screen dimensions
  • Hardware indicators: hardwareConcurrency (CPU cores), deviceMemory, maxTouchPoints
  • Operating system: Platform string, OS-specific API availability
  • Browser identity: User agent, vendor, build ID, product sub

Rendering Fingerprints

1// Canvas fingerprinting in DataDome
2function getCanvasFingerprint() {
3  try {
4    var canvas = document.createElement('canvas');
5    canvas.width = 280;
6    canvas.height = 60;
7    var ctx = canvas.getContext('2d');
8
9    ctx.textBaseline = 'top';
10    ctx.font = '14px Arial';
11    ctx.fillStyle = '#f60';
12    ctx.fillRect(125, 1, 62, 20);
13    ctx.fillStyle = '#069';
14    ctx.fillText('DataDome,Browser,FP', 2, 15);
15    ctx.fillStyle = 'rgba(102, 204, 0, 0.7)';
16    ctx.fillText('DataDome,Browser,FP', 4, 17);
17
18    var dataUrl = canvas.toDataURL();
19    return hashString(dataUrl);
20  } catch (e) {
21    return 'err';
22  }
23}
24
25// WebGL fingerprinting
26function getWebGLFingerprint() {
27  try {
28    var canvas = document.createElement('canvas');
29    var gl = canvas.getContext('webgl');
30    if (!gl) return null;
31
32    var debugInfo = gl.getExtension(
33      'WEBGL_debug_renderer_info'
34    );
35    return {
36      vendor: gl.getParameter(
37        debugInfo.UNMASKED_VENDOR_WEBGL
38      ),
39      renderer: gl.getParameter(
40        debugInfo.UNMASKED_RENDERER_WEBGL
41      )
42    };
43  } catch (e) {
44    return null;
45  }
46}

Font Detection

1// DataDome font enumeration technique
2function detectFonts() {
3  var baseFonts = ['monospace', 'sans-serif', 'serif'];
4  var testFonts = [
5    'Arial', 'Courier New', 'Georgia', 'Helvetica',
6    'Times New Roman', 'Verdana', 'Trebuchet MS',
7    'Palatino Linotype', 'Lucida Console'
8  ];
9
10  var span = document.createElement('span');
11  span.style.fontSize = '72px';
12  span.textContent = 'mmmmmmmmmmlli';
13  document.body.appendChild(span);
14
15  var detected = [];
16  baseFonts.forEach(function(baseFont) {
17    span.style.fontFamily = baseFont;
18    var baseWidth = span.offsetWidth;
19    var baseHeight = span.offsetHeight;
20
21    testFonts.forEach(function(testFont) {
22      span.style.fontFamily = testFont + ',' + baseFont;
23      if (span.offsetWidth !== baseWidth ||
24          span.offsetHeight !== baseHeight) {
25        detected.push(testFont);
26      }
27    });
28  });
29
30  document.body.removeChild(span);
31  return detected;
32}

The datadome cookie is the session-level tracking mechanism used by DataDome to maintain state between requests.

  • Name: datadome
  • Value: A long encoded string containing session ID, validation state, and feature flags
  • Domain: The protected domain
  • Path: /
  • Secure: true
  • SameSite: Lax

When JavaScript signals are submitted, the server correlates them with the session cookie and may update the cookie value to reflect the new trust level. A request with no datadome cookie or an invalid one triggers either JavaScript tag injection (soft challenge), CAPTCHA interstitial (hard challenge), or a block page for known bad actors.

Interstitial Page and CAPTCHA System

DataDome's CAPTCHA system is triggered when the detection engine determines that a client is likely automated but wants to give it a chance to prove otherwise.

CAPTCHA Types

  • Slider CAPTCHA: A puzzle piece that must be dragged to complete an image. DataDome analyzes the drag movement for human-like characteristics.
  • Image CAPTCHA: Select matching images from a grid, similar to traditional image recognition challenges
  • Invisible challenge: Background JavaScript challenge that runs without user interaction

Interstitial Page Flow

1// When DataDome challenges a request:
2
3// 1. Server returns 403 with challenge page
4// Response contains an iframe pointing to
5// DataDome's CAPTCHA delivery service
6
7// 2. CAPTCHA iframe URL format:
8// https://geo.captcha-delivery.com/captcha/
9//   ?initialCid=XXXX&hash=YYYY&cid=ZZZZ
10//   &t=fe&s=SSSS
11
12// Key parameters:
13// initialCid: Initial challenge ID
14// hash: Challenge validation hash
15// cid: Customer ID
16// t: Challenge type (fe = frontend)
17// s: Signal score that triggered the challenge
18
19// 3. User completes CAPTCHA
20// 4. DataDome validates and sets/updates cookie
21// 5. Original request is retried

Real-Time Detection Signals

DataDome's JavaScript collects real-time behavioral signals that are continuously assessed:

Mouse Behavior

1// Deobfuscated mouse tracking in DataDome
2var mouseTracker = {
3  events: [],
4  maxEvents: 50,
5
6  init: function() {
7    document.addEventListener(
8      'mousemove', this.onMove.bind(this)
9    );
10    document.addEventListener(
11      'click', this.onClick.bind(this)
12    );
13  },
14
15  onMove: function(e) {
16    if (this.events.length < this.maxEvents) {
17      this.events.push({
18        type: 'mm',
19        x: e.clientX,
20        y: e.clientY,
21        ts: Date.now()
22      });
23    }
24  },
25
26  onClick: function(e) {
27    this.events.push({
28      type: 'mc',
29      x: e.clientX,
30      y: e.clientY,
31      ts: Date.now(),
32      btn: e.button
33    });
34  },
35
36  serialize: function() {
37    return this.events.map(function(e) {
38      return [e.type, e.x, e.y, e.ts].join(':');
39    }).join('|');
40  }
41};

Page Visibility and Focus Tracking

1// DataDome tracks tab visibility changes
2document.addEventListener(
3  'visibilitychange', function() {
4    signals.visibilityChanges++;
5    if (document.hidden) {
6      signals.lastHidden = Date.now();
7    } else {
8      signals.hiddenDuration +=
9        Date.now() - signals.lastHidden;
10    }
11  }
12);

Obfuscation Techniques

DataDome's JavaScript tag uses moderate obfuscation compared to some competitors:

Variable and Property Name Mangling

1// Obfuscated DataDome code
2var _0x2f4a = function(_0x3b1c, _0x4d2e) {
3  var _0x5e3f = _0x3b1c + _0x4d2e['charCodeAt'](0);
4  return _0x5e3f;
5};
6
7// Deobfuscated
8var computeHash = function(hash, char) {
9  var result = hash + char.charCodeAt(0);
10  return result;
11};

String Concatenation Obfuscation

1// DataDome often splits property names
2var a = 'get';
3var b = 'Element';
4var c = 'ById';
5document[a + b + c]('container');
6// = document.getElementById('container')

Sites Using DataDome

Reddit (reddit.com)

Reddit's deployment of DataDome focuses on preventing automated scraping, vote manipulation bots, and securing account creation flows. Reddit's implementation is notable for its integration with Reddit's own rate limiting system.

Hermes (hermes.com)

The luxury fashion house uses DataDome to protect against automated purchasing of high-demand items. The implementation includes enhanced detection on product availability endpoints and checkout flows.

Rakuten

Rakuten uses DataDome across its marketplace to prevent price scraping, fake review injection, and automated account creation.

Other Notable Deployments

  • AllTrails: Protecting trail data and user-generated content
  • Leboncoin: France's largest classified ads platform
  • Various luxury brands: Stock monitoring and purchase automation prevention

Integration Patterns

First-Party Integration

// Client-side: Point tag to first-party endpoint
window.ddoptions = {
  endpoint: '/dd/js/',
  ajaxListenerPath: '/dd/'
};

AJAX Listener

DataDome's tag can intercept AJAX requests to add the datadome cookie or additional headers to API calls that need protection:

// DataDome intercepts XMLHttpRequest and fetch
// to add validation headers to outgoing requests
window.ddoptions = {
  ajaxListenerPath: ['/api/', '/graphql']
};

Analysis Methodology with Astify

Step 1: Identify DataDome Presence

Look for the DataDome tag script reference, the ddjskey window variable, or requests to js.datadome.co or api-js.datadome.co in the browser's network tab.

Step 2: Capture the Tag Script

Save the tags.js file. Note that DataDome may serve different versions based on customer configuration and detected client capabilities.

Step 3: Deobfuscate with Astify

Upload the captured script to Astify. The deobfuscation engine will resolve string obfuscation, simplify control flow, and restore meaningful variable names. Since DataDome's obfuscation is moderate, the results are typically very readable.

Step 4: Map Signal Collection

Document each signal the tag collects, categorized by type. This mapping is essential for privacy compliance assessments.

Step 5: Analyze Detection Logic

Review the deobfuscated code for detection heuristics such as automation framework checks, browser consistency validation, and behavioral thresholds that trigger challenges.

Advanced Detection Capabilities

Beyond the standard fingerprinting and behavioral signals, DataDome employs several advanced detection techniques that are revealed through deobfuscation:

TLS Fingerprinting Correlation

DataDome correlates client-side JavaScript signals with server-side TLS fingerprints (JA3/JA4 hashes). If the JavaScript reports Chrome but the TLS fingerprint matches curl or Python requests, the client is flagged. This cross-layer validation makes simple user-agent spoofing ineffective.

Request Pattern Analysis

DataDome's server-side engine analyzes request patterns that are invisible to client-side scripts:

  • Request velocity: How quickly requests arrive relative to human browsing speed
  • Resource loading order: Bots often skip CSS, images, or fonts that browsers load automatically
  • Header consistency: Missing or incorrectly ordered headers compared to the claimed browser
  • Session coherence: Navigation patterns that do not match typical human browsing behavior

Machine Learning Classification

DataDome's ML models process both server-side and client-side signals to produce a risk score for each request. The model is trained on billions of requests and can detect subtle patterns that rule-based systems miss, such as residential proxy traffic that mimics legitimate user behavior but shows statistical anomalies in request timing or fingerprint distribution.

Privacy Considerations

For organizations evaluating DataDome, understanding the data collection scope is important for privacy compliance:

  • GDPR alignment: DataDome processes data for the legitimate interest of bot protection, but organizations must disclose this in their privacy policies
  • Data retention: DataDome retains session data for a limited period, primarily for detection model training
  • Cross-site tracking: Unlike some competitors, DataDome does not share fingerprint data across different customer sites, limiting cross-site tracking concerns
  • First-party integration: The option to serve the tag from first-party domains reduces the privacy impact compared to third-party script loading

Comparison with Other Bot Protection Solutions

DataDome occupies a unique position in the bot protection market:

  • vs. Cloudflare: DataDome focuses exclusively on bot protection, while Cloudflare offers it as part of a broader CDN and security platform. DataDome's detection is generally faster at the server level.
  • vs. PerimeterX: Both focus on bot protection specifically. DataDome emphasizes speed (sub-2ms decisions) while PerimeterX emphasizes behavioral biometrics depth.

Conclusion

DataDome's approach to bot protection balances server-side speed with client-side depth. Its JavaScript tag provides the browser fingerprinting and behavioral signals that enrich the server-side detection engine. The combination of real-time server-side analysis, client-side fingerprinting, and machine learning classification creates a robust detection system. For security researchers, analyzing DataDome's protection with tools like Astify offers insights into modern real-time bot detection and the evolving trade-offs between detection accuracy, privacy, and user experience.

Try Astify Today

Experience AI-powered JavaScript deobfuscation in seconds

Start Deobfuscating