CleanInsightsSDK Documentation Beta

Class Configuration

@objc open class Configuration: NSObject, Codable
Configuration Configuration NSObject NSObject Configuration->NSObject Codable Codable Configuration->Codable

Nested Types

Configuration.CodingKeys

Conforms To

Codable
NSObject

Initializers

init(server:​site​Id:​timeout:​max​Retry​Delay:​max​Age​OfOld​Data:​persist​Every​NTimes:​server​Side​Anonymous​Usage:​debug:​campaigns:​)

@objc public init(server: URL, siteId: Int, timeout: TimeInterval = 5, maxRetryDelay: TimeInterval = 3600, maxAgeOfOldData: Int = 100, persistEveryNTimes: Int = 10, serverSideAnonymousUsage: Bool = false, debug: Bool = false, campaigns: [String : Campaign])

init(from:​)

public required init(from decoder: Decoder) throws

Properties

server

let server: URL

The server URL should look like https://myhost.example.com/ci/cleaninsights.php.

site​Id

let siteId: Int

The Matomo site ID to record this data for.

timeout

let timeout: TimeInterval

Connection timeout. OPTIONAL, defaults to 5 seconds.

max​Retry​Delay

let maxRetryDelay: TimeInterval

The SDK uses a truncated exponential backoff strategy on server failures. So the delay until it retries will rise exponentially, until it reaches maxRetryDelay seconds.

OPTIONAL, defaults to 3600 seconds. (1 hour)

max​Age​OfOld​Data

let maxAgeOfOldData: Int

The number in days of how long the SDK will try to keep sending old measurements. If the measurements become older than that, they will be purged.

OPTIONAL, defaults to 100 days.

persist​Every​NTimes

let persistEveryNTimes: Int

Regulates, how often data persistence is done. OPTIONAL. Defaults to 10.

If set to 1, every time something is tracked, ALL data is stored to disk. The more you track, the higher you should set this to avoid heavy load due to disk I/O.

server​Side​Anonymous​Usage

let serverSideAnonymousUsage: Bool

When set to true, assumes consent for all campaigns and none for features. Only use this, when you're running on the server and don't measure anything users might need to give consent to!

debug

let debug: Bool

When set, CleanInsights SDK will print some debug output to STDOUT. OPTIONAL. Defaults to false.

campaigns

let campaigns: [String : Campaign]

Campaign configuration.

description

var description: String

Methods

encode(to:​)

public func encode(to encoder: Encoder) throws

check(debug:​)

public func check(debug: (_ message: String) -> Void) -> Bool

Checks configuration for some well-known problems, emits a debug message and returns false, if one found.

Parameters

debug (_ message:​ String) -> Void

Function to handle the debug message.

Returns

true, if config seems ok, false if known problems exist.