JavaScript Tag

The JavaScript Tag installation is required for optimizing the efficiency of bot detection. Combined with the server-side module, the JavaScript Tag helps the DataDome algorithms understand how and by whom a JavaScript is executed on your website.

Install the Tag

Get your JS Key from your dashboard, copy the code and paste it at the start of the BODY tag, as shown below:

<script>
!function(a,b,c,d,e,f){a.ddjskey=e;a.ddoptions=f||null;var m=b.createElement(c),n=b.getElementsByTagName(c)[0];m.async=1,m.src=d,n.parentNode.insertBefore(m,n)}(window,document,"script","https://js.datadome.co/tags.js","YOUR_DATADOME_JS_KEY", { ajaxListenerPath: true });
</script>

The JS tag is loaded asynchronously.

Single Page Application

In case you are using a Single Page Application (SPA), please follow our SPA dedicated documentation.

Content-Security-Policy

To integrate the JavaScript Tag on a website that uses Content-Security-Policy (CSP), you need to add all the following changes to the CSP instructions:
styleSrc: "unsafe-inline" since we create (and delete) an element and append it to the DOM with some style modifications. It's invisible to the user and enables us to compute some properties related to the screen size.
scriptSrc: "unsafe-inline" for the Tag loader that is directly inlined in the HTML.
scriptSrc: "js.datadome.co" to load the JavaScript Tag (call made by the Tag loader).
connectSrc: "api-js.datadome.co" to send the fingerprint back to the API server.