Quick start
Learn how to integrate the Dastra cookie banner into a web page using the JavaScript SDK.
Prerequisite: get a public API key
The banner needs a public API key. Click the gear icon in the top bar (Organization settings), then Api keys & MCP in the left menu. See API key management.

Configure your banner
Configure your banner by following the guide below:
Banner setupInsert the HTML integration code
Insert the HTML code available in the Installation section of the banner, JavaScript card, before the closing </body> tag of your website, on all pages. You can use Google Tag Manager to insert this code dynamically on each page.
Here is the banner integration code:
The div with the id dastra-cookie-consent is where the banner is rendered. The data-widgetid attribute identifies the banner: it is an integer. {your_public_key} is your public API key, available in Api keys & MCP.
Once the code is inserted before the </body> tag of your website, the banner appears.
Reopen the banner from a button
Withdrawing consent must be as easy as giving it. Add a button that reopens the banner to your website, for example in the footer. The same snippet is shown in the Installation section of the banner:
WordPress
If you use WordPress, the following page explains how to install the banner with the Dastra plugin.
WordpressOnce the banner is integrated, move on to the testing phase.
Test the integration of a bannerLast updated
Was this helpful?