# JavaScript Embed

### Getting Started

For each integration, you need to create an embed code in your Caravan dealer account. \
Go to "[Tools > Inserate-Integration](https://www.caravan24.ch/chde/user/embed/)".

Each embed code consists of two lines of code containing a token:

{% code title="Caravan24 Embed Code" %}

```html
<div id="caravan24" data-token="..." data-language="de"></div>
<script src="https://embed.caravan24.ch/v1/loader.js"></script>
```

{% endcode %}

Simply copy and paste this code (including your embed token) and integrate it in the body of your website. The ads will be rendered automatically into the site.

### Changing the language

To change the language of the integration, simply set the language code in the data-language attribute.

{% code title="Language Code" %}

```html
<div id="caravan24" data-token="..." data-language="fr"></div>

```

{% endcode %}

#### Available languages

`de, fr`

### Page Header Offset

If a visitor clicks on an ad in your embed, the browser will focus on top of the detail view of the ad. If you have a large page header and you want to keep this page header visible, you can define a offset value in pixels:

{% code title="Offset Value" %}

```
<div id="caravan24" data-token="..." data-offset="150"></div>
```

{% endcode %}

With this offset value set, the detail view will open with x Pixels of the page header visible.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.caravan24.ch/javascript-embed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
