- 3 Minutes to read
- Print
- DarkLight
Media Tracking
- 3 Minutes to read
- Print
- DarkLight
You can use our media tracking API to track user behavior on your media files.
Parameter Constants
The following parameters are mandatory and need to be configured when initializing the MIMediaParameters() object.
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
name | the name of the video as displayed in Intelligence | - | Navigation > Media > Media |
action | The following actions are possible:
| - | Navigation > Media > Media Player Actions |
position | Marks the current position of the video when sending the request. | - | Navigation > Media > Media Run Time |
duration | Specifies the total length of the video. | - | - |
The following parameters are optional and can be configured in the MIMediaParameters() object.
Parameter | Description | Where to configure (Mapp Q3 > Configuration > ...) | Where to analyze |
---|---|---|---|
customCategories | You can assign additional information to the media. | Categories > Media Categories > New Category | Datatype Text: Navigation > Media Categories > [Name of media category] Datatype Figure: metric |
soundVolume | Volume, number 0-255, 0 is minimal, 255 is maximal | - | Navigation > Media > Media Player Volume |
soundIsMuted | (1=mute active, volume off, 0=mute not active, volume on) | - | Navigation > Media > Media Player Mute |
bandwidth | Bandwidth bits/seconds | - | Navigation > Media > Media Bandwidth |
Methods for Media Tracking
Method | Description |
---|---|
trackMedia() | Used track media events in Intelligence. It must contain the name of the file, action, position, and duration of the media. |
Example iOS
Please note that custom parameters are optional in the request.
Define all information you want to track:
let mediaProperties = MIMediaParameters("TestVideo", action: "play", position: 12, duration: 120) let mediaEvent = MIMediaEvent(pageName: "Test", parameters: mediaProperties)
Call the trackMedia method
MappIntelligence.shared()?.trackMedia(mediaEvent)
Full Code Example
@IBAction func trackMedia1(_ sender: Any) {
let mediaProperties = MIMediaParameters("TestVideo", action: "play", position: 12, duration: 120)
let mediaEvent = MIMediaEvent(pageName: "Test", parameters: mediaProperties)
MappIntelligence.shared()?.trackMedia(mediaEvent)
}
Define all information you want to track:
MIMediaParameters* mediaProperties = [[MIMediaParameters alloc] initWith:@"TestVideo" action:@"view" position: [NSNumber numberWithInt:12] duration:[NSNumber numberWithInt:120]]; MIMediaEvent* mediaEvent = [[MIMediaEvent alloc] initWithPageName:@"Test" parameters:mediaProperties];
Call the trackMedia method
[[MappIntelligence shared] trackMedia: mediaEvent];
Full Code Example
-(void)trackMedia {
MIMediaParameters* mediaProperties = [[MIMediaParameters alloc] initWith:@"TestVideo" action:@"play" position: [NSNumber numberWithInt:12] duration:[NSNumber numberWithInt:120]];
MIMediaEvent* mediaEvent = [[MIMediaEvent alloc] initWithPageName:@"Test" parameters:mediaProperties];
[[MappIntelligence shared] trackMedia: mediaEvent];
}
Demo app for iOS features tracking volume and mute state through AVAudioSession.sharedInstance().
Since AVAudioSession.sharedInstance() always returns the same volume level in tvOS, volume and mute tracking its not present in the tvOS example app. However, SDK API allows setting these for tracking with Media event, thus it's possible to implement it in your own app.