AnalyticsProvider

public protocol AnalyticsProvider

The provider for report related properties and methods.

  • The id for the visitor.

    Declaration

    Swift

    var visitorId: UUID? { get }
  • viewPage(title:url:) Asynchronous

    Reports to CXone that a some page/screen in the app has been viewed by the visitor.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func viewPage(title: String, url: String) async throws

    Parameters

    title

    The title or description of the page that was viewed.

    url

    A URL uniquely identifying the page.

  • CXone reporting that a visitor has left a certain page/screen in the application.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func viewPageEnded(title: String, url: String) async throws

    Parameters

    title

    The title or description of the page that was left.

    url

    A URL uniquely identifying the page.

  • chatWindowOpen() Asynchronous

    Reports to CXone that the chat window/view has been opened by the visitor.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func chatWindowOpen() async throws
  • Reports to CXone that a conversion has occurred.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func conversion(type: String, value: Double) async throws

    Parameters

    type

    The type of conversion. Can be any value.

    value

    The value associated with the conversion (for example, unit amount). Can be any number.

  • Reports to CXone that a proactive action was displayed to the visitor.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func proactiveActionDisplay(data: ProactiveActionDetails) async throws

    Parameters

    data

    The proactive action that was displayed.

  • Reports to CXone that a proactive action was clicked or acted upon by the visitor.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func proactiveActionClick(data: ProactiveActionDetails) async throws

    Parameters

    data

    The proactive action that was clicked.

  • Reports to CXone that a proactive action was successful or fails and lead to a conversion.

    Throws

    missingVisitorId if prepare(environment:brandId:channelId:) or prepare(chatURL:socketURL:brandId:channelId:) method was not called before triggering analytics event.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Throws

    channelConfigFailure if the URL cannot be parsed, most likely because environment.chatURL is not a valid URL.

    Throws

    URLError.badServerResponse if the URL Loading system received bad data from the server.

    Throws

    EncodingError.invalidValue if a non-conforming floating-point value is encountered during encoding, and the encoding strategy is .throw.

    Throws

    NSError object that indicates why the request failed

    Declaration

    Swift

    func proactiveActionSuccess(_ isSuccess: Bool, data: ProactiveActionDetails) async throws

    Parameters

    data

    The proactive action that was successful or fails.

  • Reports to CXone that some event occurred with the visitor.

    This can be used to report any custom event that may not be covered by other existing methods.

    Throws

    notConnected if an attempt was made to use a method without connecting first. Make sure you call the connect method first.

    Throws

    EncodingError.invalidValue(_:_:) if the given value is invalid in the current context for this format.

    Declaration

    Swift

    func customVisitorEvent(data: VisitorEventDataType) throws

    Parameters

    data

    Any data associated with the event.