# Ad Integration

#### **Configuration**

<table><thead><tr><th width="135.39453125">Parameter</th><th width="128.39453125">Type</th><th width="118.6875">Default</th><th>Description</th></tr></thead><tbody><tr><td>ads</td><td>Boolean | object</td><td>false</td><td>This parameter is controled through the Settings on our AdManager Module. Alternatively you can also add Tags directly. Please see documentation blow.</td></tr></tbody></table>

**Using AdTags URLs**

Alternatively you can also add your AdTags directly to the Player configuration, see the following example. Here you can find some test tags from Google: <https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags>.

```js
<script>
const player = new js3q({
    playoutId: '95ea8442-c3aa-43a3-bfdd-c93f35c6242a',
    ads: {
        preroll: "your ad tag url",
        midroll: "your ad tag url",
        postroll: "your ad tag url",
        adpoints: "360,720,1140,1500,1710"
    }
});
</script>
```

**Parameter adpoints (Midrolls)**

Ad-Cue points define fixed moments during content playback where midroll ads may be shown.

* **Seeking or fast-forwarding does not skip ads.**\
  If a viewer jumps past one or more ad cue points, the player will still trigger a midroll ad.
* **No ad stacking after seeking.**\
  When multiple cue points are skipped in a single seek action, only one midroll ad is played.
* **Normal playback behavior.**\
  During regular playback, midroll ads are triggered automatically when a cue point is reached.
* **Rewinding content.**\
  When a viewer seeks backward, upcoming cue points become active again and may trigger ads when reached.

This ensures fair ad delivery while keeping the viewing experience smooth and predictable.

#### **AdEvents**

You can create EventListeners for all AdEvents, please have a look here: [Events](/player-web-sdk/events.md#a-d-events).

#### **Macros**

We have integrated the Google IMA SDK and also a custom VAST Adapter. You can utilize the following macros to customize your AdTag URL. The macros are replaced automatically when calling the Ad.

* **{random}**: A random number to ensure URL uniqueness.
* **{referrer}**: URL-encoded referrer of the current page.
* **{consentString}**: User's consent string.
* **{loggedin}**: Boolean indicating if the user is logged in.

**Example**&#x20;

```
https://pubads.g.doubleclick.net/gampad/ads
?iu=/21775744923/external/single_ad_samples
&sz=640x480
&cust_params=sample_ct%3Dlinear%26loggedin%3D{loggedin}
&ciu_szs=300x250%2C728x90
&gdfp_req=1
&output=vast
&unviewed_position_start=1
&env=vp
&url={referrer}
&gdpr_consent={consentString}
&correlator={random}
```

#### Smartclip Integration

If you are using Smartclip, we are automatically replacing and inserting the parameters `consent` and `optout`.

#### Traffective Ad Integration

If you have the Traffective SDK integrated on your website, our player connects with the SDK and fetches the AdTag URLs automatically. The following setting is added to the player automatically when you are using our [player management](https://docs.3q.video/user-guide-new-ui/players). Otherwise you can configure this directly, see our example below.

```js
<script>
const player = new js3q({
    playoutId: '95ea8442-c3aa-43a3-bfdd-c93f35c6242a',
    ads: {
        adProvider:'traffective'
    }
});
</script>
```


---

# 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://player.docs.3q.video/player-web-sdk/ad-integration.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.
