OtvAnalyticsAgent

public class OtvAnalyticsAgent
  • Declaration

    Swift

    public static let shared: OtvAnalyticsAgent
  • Initialise the OpenTv Analytics Agent

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

    Config dictionary received in this API will look something like this:

    let config = [
     "destinations": [
       [
         "name": "uav",
         "config": [ "url": "<uav url>",  "token": "<uav token>" ],
       ],
       [
         "name": "dwh",
         "config": [ "url": "<uav url>", "token": "<uav token>" ],
       ]
     ],
    ]
    

    Declaration

    Swift

    public func initialise(config: Dictionary<String, Any>, otvaAErrorProtocol: OTVAnalyticsAgentErrorListener?) -> OTVAnalyticsAgentErrors?

    Parameters

    config

    OTVAnalyticsAgentConfig

    otvaAErrorProtocol

    reference to the error protocol used to log errors

  • Close the analytics session.

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

    Declaration

    Swift

    public func close() -> OTVAnalyticsAgentErrors?
  • Provide an updated configuration to the analytics agent

    Declaration

    Swift

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

    Parameters

    config

    OTVAnalyticsAgentConfig

  • 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

    metadata

    Containing key-value pairs of metadata for the appStart activity

    • 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