Live Analytics

The InkryptVideos SDK automatically tracks playback analytics and reports them to the InkryptVideos analytics backend. This guide explains what is tracked, how the system works, and how to correlate SDK analytics with your own data.


Overview

Analytics collection is automatic and enabled by default - no configuration is required to activate it. The SDK tracks playback events continuously during a session and sends them to the InkryptVideos analytics service in near real-time.


What is Tracked

Playback Events

The SDK tracks 11 event types across the video lifecycle:

EventWhen It Fires
setupPlayer begins initializing
startupFirst frame of video is rendered
playingVideo is actively playing (sent periodically during playback)
playPlayback resumes after a pause or seek
pausePlayback is paused
seekingUser initiates a seek operation
bufferingStartPlayback stalls waiting for data
bufferingEndBuffering completes and playback resumes
qualityChangeThe active quality level changes
endedVideo plays to completion
closePlayer is reset or destroyed

Per-Event Data

Every event payload includes the following fields:

FieldTypeDescription
sessionIdStringUnique UUID for this player instance
userIdStringPersistent device-specific UUID
videoIdStringThe video being played
videoTimeStartIntPlayback position at event start (seconds)
videoTimeEndIntPlayback position at event end (seconds)
videoDurationIntTotal video duration (seconds)
videoBitrateIntActive bitrate at the time of the event (bps)
videoPlaybackWidthIntVideo resolution width (pixels)
videoPlaybackHeightIntVideo resolution height (pixels)
deviceTypeString"mobile" or "tablet"
screenWidthIntDevice screen width
screenHeightIntDevice screen height
sequenceNumberIntIncrementing counter per session (for ordering events)
dateTimeDateTimestamp of the event
m3u8UrlString?HLS manifest URL
analyticsVersionString?SDK analytics library version

Session and User Identifiers

Session ID

A new session ID is generated each time a new player instance is created. It resets when params.update(...) is called (which creates a new player internally).

The sessionId is tracked internally and is not part of the public API. It appears in the InkryptVideos analytics dashboard and can be used there to look up full event logs for a specific playback session.


User ID

The user ID is a device-specific UUID generated automatically on first app launch and persisted in UserDefaults. It is stable across app launches and player instances.

// Static property — same value regardless of which InkPlayer instance
let userId: String? = InkPlayer.userId

Use userId to track viewing behavior for the same device across multiple sessions.

Privacy Note: By default, userId is a randomly generated UUID with no link to the user's real identity. It is used solely for anonymous analytics aggregation.


SDK Version

let sdkVersion: String? = InkPlayer.sdkVersion

Useful for filtering analytics data by SDK version when debugging version-specific issues.


Correlating with Your Own Analytics

If your app has its own user tracking or analytics system, you can correlate events using the SDK identifiers:

InkryptVideoPlayerView(
    params: params,
    onPlayerStateReady: { state in
        // Log the SDK session alongside your own user context
        MyAnalytics.shared.track("video_session_started", properties: [
            "inkrypt_user_id": InkPlayer.userId ?? "unknown",
            "video_id": "YOUR_VIDEO_ID",
            "your_user_id": currentUser.id,
            "sdk_version": InkPlayer.sdkVersion ?? "unknown"
        ])
    }
)

Analytics Data Flow

User plays video
      │
      ▼
SDK captures playback event
(play, pause, seek, buffer, etc.)
      │
      ▼
Event sent to analytics.inkrypt.org
      │
      ▼
Data processed and aggregated
      │
      ▼
Available in InkryptVideos Dashboard

Events are dispatched asynchronously and do not affect playback performance. No analytics data is cached on-device between sessions.


Viewing Analytics in the Dashboard

All tracked data is aggregated and available in the InkryptVideos Dashboard, where you can view:

  • Total play count per video
  • Total watch time and average watch duration
  • Completion rate: what percentage of viewers finish the video
  • Quality distribution: which quality levels were watched most
  • Buffering events: frequency and duration
  • Device breakdown: mobile vs. tablet
  • Per-session event timeline: full event log for a specific session

Privacy Considerations

The SDK collects the following data:

Data PointPersonally Identifiable?Notes
userIdNoRandomly generated UUID, no PII
sessionIdNoRandomly generated per session
Playback metricsNoTiming, bitrate, resolution — no content captured
Device typeNo"mobile" or "tablet"
Screen dimensionsNoDevice screen width/height

No audio or video content is ever transmitted. Analytics are purely behavioral metadata about the viewing session.

If you replace the default userId with a real user identifier from your own system (e.g., an account ID), you must ensure this is disclosed in your app's privacy policy and complies with applicable regulations including GDPR, CCPA, and App Store privacy nutrition labels.