---
updatedAt: 2026-07-27T10:12:21.000Z
agentTools:
  projectIndex: https://developers.dailymotion.com/v0/llms.txt
---

# Google Analytics 4 (Web)

Connect your Dailymotion analytics with Google Analytics 4 to get a full overview of your content analytics on web in real time.

<br />

# Introduction

Dailymotion provides a convenient way to easily collect and send the events of your embedded Players to a connected Google Analytics account (GA4).

In this article, we’ll show you how to setup the connection between your Player events and your GA4 account using Google Task Manager (GTM) for web.

<Callout icon="📘" theme="info">
  **Google Analytics compatibility**

  This implementation works with Players initialized via our Player Embed Script or Player Library Script methods.

  It is not compatible with Players embedded via our iFrame method.

  Find dedicated documentation for GA4 Android / iOS integration
</Callout>

# Setup instructions

In this guide, we’ll use Google Task Manager (GTM) to setup the connection between your Dailymotion Players and Google Analytics 4 (GA4). GTM allows setting up an event tracking configuration to decide which Player events to track and how, and sends them to GA4.

<Callout icon="🚧" theme="warn">
  Getting started with GTM:<br />The following steps assume GTM is already activated for the domain where the Player is embedded on. If you need to get started with GTM, please refer to this guide before proceeding with the below setup.
</Callout>

<br />

## Import Dailymotion GTM container file

Download the Dailymotion GTM container file (JSON) attached below. To know more about the details of each component used in the container, please refer to this section.

<Anchor target="_blank" href="https://corpostatic.dailymotion.com/corporate-cms-upload-assets-prod-aws/uploads/sites/150001/2023/12/GTM_Dailymotion.json_.zip">Download Dailymotion GTM container (JSON)</Anchor> - Then log in to your GTM account and <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/6106997?hl=en">import the container file</Anchor>.

<br />

## Add your GA4 Measurement ID

Replace the GA4 Measurement ID in the GTM container:

* Navigate to **Variables**
* Click on **GA4 Measurement ID** constant
* **Add your GA4 Measurement ID in the Value field**. By default, the value is G-XXXXXXXXXX.
* <Anchor target="_blank" href="https://support.google.com/analytics/answer/12270356?sjid=15912021733664116621-AP">Refer to this guide</Anchor> if you need help finding the Measurement ID from your GA4 account.

<br />

## Customize tracked events

Navigate to **Tags** to find the file called **cHTML – Dailymotion Listener**: this is a custom HTML tag with a script that captures specific Player events and sends them to GTM.

Depending on your needs, **this script can be customized** using any of the available events of our Web SDK.

<Anchor target="_blank" href="https://developers.dailymotion.com/v0/docs/google-analytics-4-web#chtml--dailymotion-listener">Learn more about this file, the events tracked by default and how to customize them.</Anchor>

<br />

## Test your integration

Before publishing your integration, we recommend testing it to make sure it is working as intended.

Click on **Preview** in the top right corner and connect your website to test your changes.

Once your website opens in Preview Mode, go on a Player and trigger some of the actions related to the tracked events (pause, play etc). Since the container loads on every page of your website, you should see in your GTM account that events are being properly tracked.

Refer to this section to see examples of tracked events in GTM and GA4.

<br />

<br />

## Publish your integration

Once you’re set, publish your GTM integration by clicking Publish in the top right corner.

See more details about publishing, versions and approvals on GTM.

<br />

<br />

## Player library script prerequisite

If you are loading the Player using Player Library Script, please update your embed code as shown below to include the DM\_GTM\_INIT(player) method

```javascript
<!-- Please replace the Library Script URL to include your unique Player ID created with your account and retrieved from your Dailymotion Studio or via the Platform API -->

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

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

<script type="text/javascript">

    dailymotion
    .createPlayer('my-dailymotion-player', {
        video: 'x84sh87',
    })
    .then((player) => {
        console.log(player);
        window.DM_GTM_INIT(player);
    })
    .catch((e) => console.error(e));

</script>
```

<br />

***

<br />

# About the Dailymotion GTM container

In this section, we’ll go through each element of the Dailymotion GTM container to help you understand the different tags, triggers and variables it includes.

## Tags

The Dailymotion GTM container includes the 3 following tags:

* cHTML – Dailymotion Listener
* GA4 – Video Interaction
* Google Tag

<br />

### cHTML – Dailymotion Listener

Type: <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/6107167?hl=en#CustomHTML">Custom HTML tag</Anchor> - Trigger: <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/7679319?hl=en">All Pages</Anchor>

This tag is a Custom HTML that triggers on Page View, it means that the script inside the HTML block will load on every page of the website. The script uses our Web SDK events to listen to the Player’s events, generate event objects, and pass them to the data layer object.

The script includes some basic configuration to facilitate its integration:

* Events tracking for Players embedded with our Player Embed Script or Player Library Script methods
* Compatible when multiple Players are embedded on a page
* Player source ID stored to prevent adding event listeners to the same Player twice

#### Event object

The above script generates **event objects** for the Player’s events, which are later pushed to the data layer object of GTM.

This is an example of an event object:

```json
{
  "event": "dm_video",
  "video_provider": "Dailymotion player (client-side)",
  "video_title": "Demo video title",
  "player_source_id": "my-dailymotion-player",
  "player_id": "xlymb",
  "event_name": "player_start"
}
```

<Callout icon="📘" theme="info">
  “`event`” is a predefined property of the event object for the data layer. It provides a custom event name.

  In this case, `dm_video` is a custom event for the data layer of GTM.
</Callout>

<br />

#### Events by default

By default, the integration supports tracking of the following Player’s events:

* `PLAYER_VIDEOCHANGE`
* `PLAYER_START`
* `VIDEO_START`
* `VIDEO_PAUSE`
* `AD_START`
* `AD_PAUSE`

By default, parameters are:

* `video_provider` : Dailymotion player (client-side)
* `player_source_id` : Player Source ID is unique for each Player created in the page. (e.g., dailymotion-instance-ee534264-2b70-67c6-3c65-fe9d7c15fcd1)
* `player_id` : Player ID retrieved from your Dailymotion Studio (e.g., xlyg7)
* `video_title` : Title of the video

<br />

#### Customize tracked events

Additional events can be tracked by modifying the script using the events available in our <Anchor target="_blank" href="https://developers.dailymotion.com/v0/reference/web-sdk-player-methods">Web SDK Reference</Anchor>.

Current events can be found from line 50 in the script.

<br />

### GA4 – Video Interaction

Type: <Anchor target="_blank" href="https://support.google.com/analytics/answer/10089681">Google Analytics: GA4 Event</Anchor>  - Trigger: cEvent – Video Interaction

This tag allows sending the event data from the data layer to GA4 as an event. As you can see, we are using the data layer variables for `Event Name` and `Event Parameters`. This tag is triggered by `cEvent – Video Interaction.`

This is how a Player’s event is sent to GA4:

1. GTM loads both tags cHTML – Dailymotion Listener and Google tag on each page of your website.
2. cHTML – Dailymotion Listener listens to the Player’s event, creates an event object with Player and video information, and pushes it to the data layer object.
3. The action of pushing a `dm-video` custom event object to the data layer initiates the trigger called `cEvent – Video Interaction`. This trigger then fires the GA4 tag via `GA4 – Video Interaction`
4. GA4 tag takes values from the reference of all the data layer variables to create an event and sends it to Google Analytics 4

### Google Tag

Type: <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/11994839?hl=en">Google Tag </Anchor>  - Trigger: <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/7679319?hl=en">All Pages</Anchor> This tag enables passing your GA4 Measurement ID on all your website pages

<br />

## Trigger

The Dailymotion GTM container includes only 1 trigger.

<br />

### cEvent – Video Interaction

Type: <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/7679219?hl=en">Custom Event</Anchor> We have created this trigger to fire the `GA4 – Video Interaction` tag: every time a custom `dm-video` event object is pushed by `cHTML – Dailymotion Listener`, this trigger will be activated.

<br />

## Variables

<br />

### Debug Mode

This variable is a built-in variable provided by GTM. Learn more here.

<br />

### Data Layer Variables

Values within the <Anchor target="_blank" href="https://developers.google.com/tag-platform/devguides/datalayer?hl=en&visit_id=638986295225999440-1832365840&rd=1">data layers</Anchor> are populated with event data retrieved from `cHTML – Dailymotion Listener`.

For these data to be usable, we have created the following variables for each data point we plan to use:

* `dlv - event_name`
* `dlv - video_provider`
* `dlv - video_title`
* `dlv - player_id`
* `dlv - player_source_id`

See an example with `dlv - player_id`

<Image src="https://files.readme.io/29343c6457398e885d0508c6f1e44af3b4207c3c9f24e3d702cacc2235ff9f4c-image.png" align="center" width="400px" />

<br />

### GA4 Measurement ID

Type: <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/7683362?hl=en#constant">Constant</Anchor> - Trigger: cEvent – Video Interaction

This **constant** carries your **GA4 Measurement ID** which will be used as a variable in the **Google Tag** and **GA4 – Video Interaction tag**.

<br />

***

<br />

# Examples of tracked events from GTM and GA4

* View of a data layer in <Anchor target="_blank" href="https://support.google.com/tagmanager/answer/6107056">GTM Preview Mode</Anchor> after an event has been captured from a Player
* View from <Anchor target="_blank" href="https://support.google.com/analytics/answer/7201382?hl=en">DebugView</Anchor> mode in GA4
* Detailed view of a captured `player_start` event with data linked to the event parameters:

<br />