OtvAnalyticsAgentWrapper

public class OtvAnalyticsAgentWrapper : NSObject
  • Declaration

    Swift

    public static let shared: OtvAnalyticsAgentWrapper
  • Initialise the OpenTv Analytics Agent and Wrapper

    Call this method once, before calling any other. Do not call again unless close is called first

    Declaration

    Swift

    public func initialise(wrapperConfig: Dictionary<String, Any>, agentConfig: Dictionary<String, Any>, errorProtocol: OTVAnalyticsAgentErrorListener?) -> OTVAnalyticsAgentErrors?

    Parameters

    wrapperConfig

    Configuration for the wrapper

    agentConfig

    Configuration for the OtvAnalyticsAgent

    errorProtocol

    Reference for listener to handle errors

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise

  • Close the analytics session.

    After calling this method, do not call any other unless initialise is called again

    Declaration

    Swift

    public func close() -> OTVAnalyticsAgentErrors?

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise:

  • Provide an updated configuration to the analytics agent

    Declaration

    Swift

    public func updateConfig(wrapperConfig: Dictionary<String, Any>?, agentConfig: Dictionary<String, Any>?) -> OTVAnalyticsAgentErrors?

    Parameters

    wrapperConfig

    updated configuration for the wrapper

    agentConfig

    updated configuration for the OtvAnalyticsAgent

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise

  • Provide a reference to a Nagra Connect Player which may be used to automatically submit player events detect some activities, and populate some metadata

    Must be called before submitting the playbackStart activity Must not be changed or removed once playback has started Player may be removed by passing a nil reference

    Declaration

    Swift

    public func setConnectPlayer(player: OTVAVPlayer?) -> OTVAnalyticsAgentErrors?

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise

  • Submit the appStart Activity

    Must be the first activity submitted (must be called before any other calls to submitActivity)

    Should not be called again without first submitting an appStop activity

    Declaration

    Swift

    public func appStart(metadata: Dictionary<String, Any>) -> OTVAnalyticsAgentErrors?

    Parameters

    deviceId

    Unique device id as provided by the platform to the client

    accountId

    The account id of the current signed-in account

    userId

    Unique id to identify a user or user profile

    metadata

    Containing key-value pairs of metadata for the appStart activity

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise

  • Submit the playbackStart Activity

    Should be called after a player has been set for the wrapper

    Declaration

    Swift

    public func playbackStart(metadata: Dictionary<String, Any>, insightUserInfo: Dictionary<String, Any>?, insightContent: Dictionary<String, Any>?) -> OTVAnalyticsAgentErrors?

    Parameters

    metadata

    Containing key-value pairs of metadata for the playbackStart activity

    insightUserInfo

    if insight reporting is required

    insightContent

    if insight reporting is required

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise

    • Submit an activity

    Declaration

    Swift

    public func submitActivity(activity: OtvActivity, metadata: Dictionary<String, Any>) -> OTVAnalyticsAgentErrors?

    Parameters

    activity

    The OtvActivity being submitted

    metadata

    Containing key-value pairs of metadata for the submitted activity

    Return Value

    OTVAnalyticsAgentErrors if an error occurs, nil otherwise