Quantcast
Channel: Support & Bugs - Matomo forums
Viewing all articles
Browse latest Browse all 5706

How to track Video analytics in iOS using SDK?

$
0
0

Hi,

I have been trying for two days to get Video analytics working using the iOS SDK and can’t work out why it doesn’t work. I am using the “custom tracking parameters” example as a basis. I get a success response with a tracked flag set. However it never shows up as a Video event, and mostly it doesn’t even show up at all.

My code:

    var asMatomoEvent : [String:String] {
        var parameters = [String:String]()
        parameters["ma_id"] = uniqueId
        parameters["ma_ti"] = title
        parameters["ma_re"] = url.absoluteString
        parameters["ma_mt"] = type
        parameters["ma_pn"] = player
        if let currentTimeSeconds = currentTimeSeconds, currentTimeSeconds.isNaN == false {
            parameters["ma_st"] = String(format: "%.2f", currentTimeSeconds)
        }
        if let videoSize = videoSize {
            parameters["ma_w"] = "\(videoSize.width)"
            parameters["ma_h"] = "\(videoSize.height)"
        }
        parameters["ma_fs"] = fullscreen ? "1" : "0"
        return parameters
    }

    func trackMediaEvent(action: String, mediaEvent: MediaEvent) {
        
        let trackingParameters = mediaEvent.asMatomoEvent
        
        let event = Event(tracker: self.tracker,
                          action: [action, "custom tracking parameters"],
                          url: mediaEvent.url,
                          eventCategory: "MediaVideo",
                          eventAction: action,
                          customTrackingParameters: trackingParameters)
        
        self.tracker.track(event)
        #if DEBUG
        tracker.dispatch()
        #endif
    }

   trackVideoEvent(action: progress > 0.0 ? "pause" : "play")

I have verbose logging on and am using Charles to verify that the messages are being sent and received by Matomo.

Any help would be greatly appreciated as I have been working on this for days.
Brett

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5706

Trending Articles