---
updatedAt: 2026-06-11T14:49:40.000Z
agentTools:
  projectIndex: https://developers.dailymotion.com/llms.txt
---

# Google Analytics 4 (Android)

Dailymotion currently supports client-side integration with Google Analytics. It allows **collecting client-side events from Android apps and send them to a Google Analytics account** for further storage and analysis.

# Implementation steps

## 1. Add the Analytics SDK to your app

In your **module (app-level) Gradle file** (usually `<project>/<app-module>/build.gradle.kts` or `<project>/<app-module>/build.gradle`), add the dependency for the Analytics library for Android:

```kotlin
dependencies {
    // Import the BoM for the Firebase platform
    implementation(platform("com.google.firebase:firebase-bom:33.1.0"))

    // Add the dependency for the Analytics library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation("com.google.firebase:firebase-analytics")
}
```

Learn more about [**adding Firebase to your project**](https://firebase.google.com/docs/analytics/get-started?platform=android).

## 2. Send events to Google Analytics

Check the dedicated guide to <Anchor label="**learn how to listen to events**" target="_blank" href="https://developers.dailymotion.com/v2/docs/listen-to-events-with-android-sdk">**learn how to listen to events**</Anchor>.

For example, to listen to `onVideoEnd` event, just implement the method `onVideoEnd()`:

```kotlin
Dailymotion.createPlayer(
  context = context,
  playerId = "MY_PLAYER_ID",   
  playerSetupListener = object : Dailymotion.PlayerSetupListener{
    ...
  }, 
  videoListener = object : VideoListener {        
    override fun onVideoEnd(playerView: PlayerView) {    
         // video end event 
  	}    
  }
)
```

Declare the `com.google.firebase.analytics.FirebaseAnalytics` object at the top of your activity:

```kotlin
private lateinit var firebaseAnalytics: FirebaseAnalytics
```

Initialize it in the `onCreate()` method:

```kotlin
// Obtain the FirebaseAnalytics instance.
firebaseAnalytics = Firebase.analytics
```

Send event `onVideoEnd`:

```kotlin
Dailymotion.createPlayer(
  context = context,
  playerId = "MY_PLAYER_ID",   
  playerSetupListener = object : Dailymotion.PlayerSetupListener{
    ...
  }, 
  videoListener = object : VideoListener {        
    override fun onVideoEnd(playerView: PlayerView) {  

        // Create a Bundle to hold event parameters
        val bundle = Bundle().apply {
            putString("videoId", "MY_VIDEO_ID")
            putString("event", "onVideoEnd")
            putString(FirebaseAnalytics.Param.CONTENT_TYPE, "video_player")
        }
       
      	// Log the event with the parameters
        firebaseAnalytics.logEvent("DailymotionPlayer", bundle)

    }    
  }
)
```

***