2021-12-02 16:56:04 +00:00
|
|
|
//
|
|
|
|
// Copyright 2021 New Vector Ltd
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
|
|
|
import AnalyticsEvents
|
|
|
|
|
|
|
|
/// A protocol representing an analytics client.
|
|
|
|
protocol AnalyticsClientProtocol {
|
|
|
|
/// Whether the analytics client is currently reporting data or ignoring it.
|
|
|
|
var isRunning: Bool { get }
|
|
|
|
|
|
|
|
/// Starts the analytics client reporting data.
|
|
|
|
func start()
|
|
|
|
|
|
|
|
/// Associate the client with an ID. This is persisted until `reset` is called.
|
|
|
|
/// - Parameter id: The ID to associate with the user.
|
2022-02-17 12:39:11 +00:00
|
|
|
func identify(id: String)
|
2021-12-02 16:56:04 +00:00
|
|
|
|
2021-12-13 17:30:38 +00:00
|
|
|
/// Reset all stored properties and any event queues on the client. Note that
|
|
|
|
/// the client will remain active, but in a fresh unidentified state.
|
2021-12-02 16:56:04 +00:00
|
|
|
func reset()
|
|
|
|
|
2021-12-13 17:30:38 +00:00
|
|
|
/// Stop the analytics client reporting data.
|
|
|
|
func stop()
|
|
|
|
|
2021-12-02 16:56:04 +00:00
|
|
|
/// Send any queued events immediately.
|
|
|
|
func flush()
|
|
|
|
|
|
|
|
/// Capture the supplied analytics event.
|
|
|
|
/// - Parameter event: The event to capture.
|
|
|
|
func capture(_ event: AnalyticsEventProtocol)
|
|
|
|
|
|
|
|
/// Capture the supplied analytics screen event.
|
|
|
|
/// - Parameter event: The screen event to capture.
|
|
|
|
func screen(_ event: AnalyticsScreenProtocol)
|
2022-02-15 17:54:17 +00:00
|
|
|
|
|
|
|
/// Updates any user properties to help with creating cohorts.
|
|
|
|
/// - Parameter userProperties: The user properties to be updated.
|
|
|
|
///
|
2022-02-17 12:39:11 +00:00
|
|
|
/// Only non-nil properties will be updated when calling this method. There might
|
|
|
|
/// be a delay when updating user properties as these are cached to be included
|
|
|
|
/// as part of the next event that gets captured.
|
2022-02-15 17:54:17 +00:00
|
|
|
func updateUserProperties(_ userProperties: AnalyticsEvent.UserProperties)
|
2021-12-02 16:56:04 +00:00
|
|
|
}
|