---
updatedAt: 2026-06-24T15:33:47.000Z
---

Fetch the complete documentation index at: https://developers.dailymotion.com/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# Contextual video matching

Create more video inventory with "Contextual video matching"

## Overview

When you don't have dedicated videos for each article on your website, the **contextual video matching feature** of the Dailymotion Player can **automatically pick and embed the most relevant videos for your text content**, saving you time and effort.

When the contextual video matching feature is activated, the Dailymotion's Player **analyzes the context of the page**, including the title and page URL, to **play the most relevant videos**. These videos are sourced from your Organization or from your channel catalog.

Contextual video matching takes over the process of finding the perfect content for each page, and **increases ad revenue** by creating **additional ad opportunities** on your website.

***

## How does it work?

When a **Player with contextual content feature** is embedded on a page, it will **automatically retrieve useful data from that page**, such as:

* **Page URL:** [www.your-website.com/your-article-name/](http://www.your-website.com/your-article-name/)
* **Titles:** we are checking if your page contains `<h1>` then falling back on `<h2>` `<h3>` and `<title>`
* **Content:** the text content of the page

These data are sent by the Player to our recommendation engine to **determine the context of the page**, which in return will send to the Player a selection of **relevant videos to play**.

<Image align="center" src="https://files.readme.io/1b663138e565ad6510156a000c869a1869d90bbaec22e67e90a707b85ce9578c-concept-contextual-embed-1024x691.gif" />

***

## Implement "contextual video matching"

You can easily **activate the contextual video matching feature using the API**.

<Callout icon="👍" theme="okay">
  If you’re not comfortable using the API, you can activate the feature from the **[Dailymotion Studio](https://faq.dailymotion.com/hc/en-us/articles/19886643105554#enable_contextual_video_matching_on_player)**.
</Callout>

### Requirements

Contextual video matching must be implemented on webpages that contain **semantic titles** and **textual content** to ensure relevant recommendations.

<br />

### 1. Create a Player with enable\_contextual\_content

> 📘 Authentication
>
> Creating a Player requires `player.write` scope. Refer to the [scope guide](https://developers.dailymotion.com/v2/reference/api-scopes)  for more details.

<Anchor label="Create a custom Player" target="_blank" href="https://developers.dailymotion.com/v2/reference/create-profile-player">Create a custom Player</Anchor> which includes the following elements:

* Activate the feature using the field `contextual_content.is_enabled` to `true`.
* Choose whether contextual content should be sourced from your `organization` or from your `profile` using `contextual_content.source`. Make sure **videos are uploaded**, whichever option you choose.
* We recommend enabling **autostart** to reduce loading time (included in code sample below).

> 🚧 Breaking change v2
>
> The `contextual_content.source` value `channel` has been renamed to `profile` in API v2. Make sure to update your configuration accordingly.

**Code example**

```
// Possible values for contextual_content_source: organization or channel
// Using autostart=on is recommended
// Replace <YOUR_PROFILE_ID> with your own profile ID

curl --request POST \
     --url https://api.dailymotion.com/v2/profiles/<YOUR_PROFILE_ID>/players \
     --header 'accept: application/json' \
     --header 'authorization: Bearer ${ACCESS_TOKEN}' \
     --header 'content-type: application/json' \
     --data '{
       "name": "My contextual Player",
       "contextual_content": {
         "is_enabled": true,
         "source": "organization"
       },
       "playback": {
         "autostart": "on"
       }
     }'
```

<br />

#### **Customization options:**

You can customize the behavior of your contextual video matching using the following options:

* `contextual_content.enable_fallback`: Allows the contextual Player to display a fallback video when highly relevant content is not available, ensuring the Player is never empty.
* `contextual_content.enable_freshness`: Limits the video selection to recent content only. Use it in combination with `contextual_content.freshness_days` to define the freshness limit in days.

Simply add these options to your Player configuration.

Example:

```
curl --request POST \
     --url https://api.dailymotion.com/v2/profiles/<YOUR_PROFILE_ID>/players \
     --header 'accept: application/json' \
     --header 'authorization: Bearer ${ACCESS_TOKEN}' \
     --header 'content-type: application/json' \
     --data '{
       "name": "My contextual Player",
       "contextual_content": {
         "is_enabled": true,
         "source": "organization",
         "enable_fallback": true,
         "enable_freshness": true,
         "freshness_days": 30
       },
       "playback": {
         "autostart": "on"
       }
     }'
```

<br />

### 2. Embed an empty Player on your page

Choose your preferred method to **embed the Player on your page**: either <Anchor label="Player Embed Script" target="_blank" href="https://developers.dailymotion.com/v2/docs/player-embed-script-web">Player Embed Script</Anchor> or <Anchor label="Player Library Script" target="_blank" href="https://developers.dailymotion.com/v2/docs/player-library-script">Player Library Script</Anchor>. This feature is not compatible with the iFrame embed method.

Make sure to **remove the video and playlist fields** (`data-video` `video` `data-playlist` or `playlist`) in order to benefit from the contextual video matching feature.

Once integrated, users landing on your page should automatically see the most relevant videos based on the context of the page.

**Code examples**

```html Player Embed Script
// Replace {Player ID} with the ID of the Player created in step 1

<script src="https://geo.dailymotion.com/player/{Player ID}.js"></script>
```
```html Player Library Script
// Replace {Player ID} with the ID of the Player created in step 1

<body>
  <script src="https://geo.dailymotion.com/libs/player/{Player ID}.js"></script>

  <div id="my-dailymotion-player">My Player placeholder</div>

  <script>
    dailymotion
      .createPlayer("my-dailymotion-player")
      .catch((e) => console.error(e));
  </script>
</body>
```

> 📘 FAQ:
>
> Refer to the **<Anchor label="contextual video matching FAQ" target="_blank" href="https://faq.dailymotion.com/hc/en-us/articles/19886643105554#faq">contextual video matching FAQ</Anchor>** for answers to common questions about the feature.