> For the complete documentation index, see [llms.txt](https://doc.dastra.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.dastra.eu/en/features/cookies/integration/quickstart.md).

# 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](https://doc.dastra.eu/en/features/settings/api-keys.md).

<figure><img src="https://2697025545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LvBxs22wUMicv9uWp6C-1972196547%2Fuploads%2Fgit-blob-48cf9361a1c99d0e8d5b2a5fd00bef0405f61be8%2Fcookies-quickstart-1.png?alt=media" alt="The Api keys &#x26; MCP page with the list of keys"><figcaption><p>The "Api keys &#x26; MCP" page</p></figcaption></figure>

## Configure your banner

Configure your banner by following the guide below:

{% content-ref url="/pages/-M4QG18lMk2aXM5oxk6j" %}
[Banner setup](https://doc.dastra.eu/en/features/cookies/banner.md)
{% endcontent-ref %}

## Insert 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.

{% hint style="info" %}
For the code to work, the public API key must be configured beforehand.
{% endhint %}

Here is the banner integration code:

```html
<div id="dastra-cookie-consent" data-widgetid="{your_widget_id}"></div>
<script src="https://cdn.dastra.eu/sdk/dastra.js?key={your_public_key}" async></script>
```

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**.

{% hint style="info" %}
Always copy the code from the application. Depending on the hosting region of your organization, the address of the script (`cdn-bleu.dastra.eu` instead of `cdn.dastra.eu`) and the address of the API (`api-bleu.dastra.eu` instead of `api.dastra.eu`) change.
{% endhint %}

Once the code is inserted before the `</body>` tag of your website, the banner appears.

{% hint style="warning" %}
For better performance, the browser caches the banner in the `sessionStorage`.
{% endhint %}

## 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:

```html
<button type="button" onclick="dastra.openCookieConsent()">Check your cookie consent</button>
```

## WordPress

If you use WordPress, the following page explains how to install the banner with the Dastra plugin.

{% content-ref url="/pages/-M73IeHnSxtI3StYVEKB" %}
[Wordpress](https://doc.dastra.eu/en/features/cookies/integration/quickstart/wordpress.md)
{% endcontent-ref %}

Once the banner is integrated, move on to the testing phase.

{% content-ref url="/pages/-M5n-JlwIaL2BmQOHPgl" %}
[Test the integration of a banner](https://doc.dastra.eu/en/features/cookies/integration/test.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.dastra.eu/en/features/cookies/integration/quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
