Google Analytics 4 (iOS)
Dailymotion currently supports client-side integration with Google Analytics. It allows collecting client-side events from iOS apps and send them to a Google Analytics account for further storage and analysis.
Implementation steps
1. Add the Analytics SDK to your app
Use Swift Package Manager to install and manage Firebase dependencies:
- In Xcode, with your app project open, navigate to File > Add Packages.
- When prompted, add the Firebase Apple platforms SDK repository:
https://github.com/firebase/firebase-ios-sdk.git
Learn more about adding Firebase to your project.
2. Initiate the Firebase SDK
Import the FirebaseCore module in your UIApplicationDelegate, as well as any other Firebase modules your app delegate uses. For example, to use Cloud Firestore and Authentication:
import os.log
import DailymotionPlayerSDK
import GoogleCast
import FirebaseCoreConfigure a FirebaseApp shared instance in your app's delegate application(_:didFinishLaunchingWithOptions:) method:
FirebaseApp.configure()3. Send event to Google Analytics
Check the dedicated guide to learn how to listen to events.
func addPlayerEvent(event: String) {
Analytics.logEvent("DailymotionPlayer", parameters: ["playerEvent": event])
}Sent the first time the Player attempts to start the playback, either because of user interaction, an autoplay parameter or an API call (e.g. play(), loadContent(), etc.)
Sent when the video playback has paused:
func videoDidPause(_ player: DMPlayerView) {
addPlayerEvent(event: "videoDidPause")
}See all supported iOS events.
Updated 17 days ago
