diff --git a/CHANGELOG.md b/CHANGELOG.md index a9d71dd1..3227d0bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Conviva + - Report AdTagPArameters to Conviva for THEOads sources. + ### Fixed - Conviva diff --git a/Code/Conviva/Source/Events/ConvivaReporters/BasicEventConvivaReporter.swift b/Code/Conviva/Source/Events/ConvivaReporters/BasicEventConvivaReporter.swift index 46de22a8..eda0f936 100644 --- a/Code/Conviva/Source/Events/ConvivaReporters/BasicEventConvivaReporter.swift +++ b/Code/Conviva/Source/Events/ConvivaReporters/BasicEventConvivaReporter.swift @@ -4,6 +4,9 @@ import ConvivaSDK import THEOplayerSDK +#if canImport(THEOplayerTHEOadsIntegration) +import THEOplayerTHEOadsIntegration +#endif class BasicEventConvivaReporter { @@ -84,13 +87,21 @@ class BasicEventConvivaReporter { if let source = event.source, let url = selectedSource { newSource = .init(description: source, url: url) let assetName = source.metadata?.title ?? Utilities.defaultStringValue; - let contentInfo = [ + var contentInfo = [ CIS_SSDK_METADATA_PLAYER_NAME: Utilities.playerName, CIS_SSDK_METADATA_STREAM_URL: url, CIS_SSDK_METADATA_ASSET_NAME: assetName, CIS_SSDK_METADATA_IS_LIVE: NSNumber(value: false), CIS_SSDK_METADATA_DURATION: NSNumber(value: -1) ] as [String: Any] + + // THEOads adTagParameters + if let adTagParams = self.theoAdsAdTagParams(source: newSource?.description) { + adTagParams.forEach { (key, value) in + contentInfo["theoAdsTag_\(key)"] = value + } + } + self.videoAnalytics.setContentInfo(contentInfo) self.storage.storeKeyValuePair(key: CIS_SSDK_METADATA_ASSET_NAME, value: assetName) self.storage.storeKeyValuePair(key: CIS_SSDK_METADATA_STREAM_URL, value: url) @@ -103,6 +114,20 @@ class BasicEventConvivaReporter { self.currentSession.source = newSource } + private func theoAdsAdTagParams(source: SourceDescription?) -> [String:String]? { +#if canImport(THEOplayerTHEOadsIntegration) + if let currentSource = source, + let ads = currentSource.ads, + let theoAdsDescription = ads.first(where: { + $0.integration == .theoAds && $0 is THEOAdDescription + }) as? THEOAdDescription, + let foundParams = theoAdsDescription.adTagParameters { + return foundParams + } +#endif + return [:] + } + func renderedFramerateUpdate(framerate: Float) { self.videoAnalytics.reportPlaybackMetric(CIS_SSDK_PLAYBACK_METRIC_RENDERED_FRAMERATE, value: NSNumber(value: Int(framerate.rounded()))) } diff --git a/THEOplayer-Connector-Conviva.podspec b/THEOplayer-Connector-Conviva.podspec index 9d993182..e364572f 100644 --- a/THEOplayer-Connector-Conviva.podspec +++ b/THEOplayer-Connector-Conviva.podspec @@ -22,4 +22,7 @@ Pod::Spec.new do |s| s.dependency 'ConvivaSDK', '4.0.51' s.dependency 'THEOplayerSDK-core', "~> 8" s.dependency 'THEOplayer-Connector-Utilities', "~> " + theoplayer_connector_major_minor_version, ">= " + theoplayer_connector_version + + # THEOads AdTagParameter reporting + s.ios.dependency "THEOplayer-Integration-THEOads", "~> 8.11" end