--- title: "JavaScript profiling overview" slug: "javascript-profiling" description: "Understand Darwinium JavaScript profiling behavior, configuration, and the lifecycle of collecting browser profiling information." updated: 2026-11-11T04:02:04Z published: 2026-11-11T04:02:04Z canonical: "docs.darwinium.com/javascript-profiling" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.darwinium.com/llms.txt > Use this file to discover all available pages before exploring further. # JavaScript profiling overview Darwinium JavaScript profiling runs in your customer's browser while they use a page. It collects details about the device, the network connection and how the person types, clicks and swipes. That data feeds the rules and models that separate genuine customers from fraudsters and automation. For what profiling collects and how it reaches Darwinium, see [Profiling explained](/v1/docs/darwinium-profiling). ## Two ways to add profiling to a page - **Through the edge:** our edge worker adds profiling to your pages on the CDN. See [Insert JavaScript profiling at the edge](/v1/docs/inserting-darwinium-js-profiling). - **As a JavaScript tag:** your developers add the profiling script to your pages and call it from your code. See [Install JavaScript tags](/v1/docs/tags-deployment). The profiling code is the same either way, and most options are shared. What changes is who adds the script to the page and who sends the result to Darwinium. | | Through the edge | As a JavaScript tag | | --- | --- | --- | | **Who adds the script** | Our edge worker, on the CDN, as the page loads | Your developers, with a `<script>` tag | | **Who starts and collects profiling** | Automatic | Your code calls `start()` and `collect()` | | **How the result reaches Darwinium** | Added to the next request as the `dwn-profiling` header (or a hidden form field), then read by the edge worker | Your backend sends it in the `dwn-profiling` header of an Event API call | | **Changes to your site** | None, all set in the Darwinium Portal | Script tag, start/collect calls, backend API call | | **Needs** | A CDN deployment ([Cloudflare](/v1/docs/cloudflare-deployment), [CloudFront](/v1/docs/cloudfront-deployment), [Akamai](/v1/docs/akamai-deployment)) | A subdomain on your site to serve the script | | **Best for** | Sites already on a supported CDN, and adding profiling to new pages without a release | Single-page apps, mobile web, or when you want precise control of when profiling starts and stops | **Through the edge**, the edge worker reads the `dwn-profiling` header on the submit request and creates the event. It can also pass risk headers on to your server. ![A request with the dwn-profiling header goes through the edge worker, which can add risk headers before it reaches your origin server](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/image(233).png?sv=2026-02-06&spr=https&st=2026-11-19T12%3A45%3A20Z&se=2026-11-19T13%3A45%3A20Z&sr=b&sp=r&sig=KZFdFooIcun3wLM0lUN%2Ft2bxHquUnpo22ObisERen3I%3D) **As a JavaScript tag**, your backend receives the header and sends it to a Darwinium API step, which returns the risk response. ![A request with the dwn-profiling header reaches your backend, which sends the profiling blob to a Darwinium API step and gets the risk response back](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/image(234).png?sv=2026-02-06&spr=https&st=2026-11-19T12%3A45%3A20Z&se=2026-11-19T13%3A45%3A20Z&sr=b&sp=r&sig=OOmaSLi9PTXD7A0Gc92jaeKrWefpMaZXJkUJ5aE5X5k%3D) You can use both on one site. For example, the edge for login and registration pages, and tags inside a single-page checkout. ## Choose where the script runs on the page Profiling can sit in the page's `<head>` or `<body>`. Either way, the script is added at the start of that section and starts collecting once the page has loaded. We recommend `<head>`, so profiling is ready before your own scripts send requests. ## Choose the options Both methods share most options: which data to collect (biometrics, geolocation), which detections to run (remote desktop, browser extensions, developer tools) and limits on how large the result can get. See [JavaScript profiling snippet options](/v1/docs/javascript-profiling-snippet-options). ## Before you go live Check the site requirements Your site's Content Security Policy, CORS, Permissions-Policy and header size limits can stop profiling working, often without an obvious error. Check [Site requirements for JavaScript profiling](/v1/docs/javascript-profiling-site-policies) during setup and after changing them. The page is private: sign in through the Portal (see [Help & documentation access](/v1/docs/access-gated-docs-links)) or ask your Darwinium contact. - Map your form fields to keyboard contexts so typing behaviour is compared field by field: in the Portal on the edge ([Step 6](/v1/docs/inserting-darwinium-js-profiling#step-6-map-keyboard-fields-recommended)), or in `key_bm` with tags ([Step 4](/v1/docs/tags-deployment#b-start-profiling)). - Test on a staging environment first. Profiling is passive, but your site may reject requests that carry unexpected headers.