Skip to main content

Usage

Kettle

Consents

KettleConsent.surveys
KettleConsent.analytics
KettleConsent.campaigns
KettleConsent.ads

Granting consents

Defines what the data collected from the user can be used for.

Kettle.shared.grant(consents: [.surveys, .analytics, .campaigns, .ads])

Revoking consents

Removes previously granted user consent.

Kettle.shared.revoke(consents: [.surveys, .analytics, .campaigns, .ads])

Retrieve granted consents

Returns an array containing the consents granted to Kettle.

let consents: [KettleConsent] = Kettle.shared.grantedConsents

Start Kettle

Starts collecting data for given modules.

Kettle.shared.start(with: [.bluetooth, .location, .activity])

Stop Kettle

Stops collecting data from given modules.

Kettle.shared.stop(with: [.bluetooth, .location, .activity])

Retrieve SDK status

Returns true if Kettle is currently enabled and collecting data.

let kettleStarted: Bool = Kettle.shared.started

Assign push token

Forwards the users push token to Kettle, allowing it to send push notifications.

Kettle.shared.pushToken = "<PUSH-TOKEN>"

Assign external identifier

Forwards the users internal user ID to Kettle, allowing Kogenta to map your internal identifier with the users Kettle ID.

Kettle.shared.externalId = "<EXTERNAL-IDENTIFIER>"

Kettle Identifier

Returns the internal Kettle ID for the user.

let kettleId: String = Kettle.shared.identifier

Send custom data

This functions performs a POST request. It accepts a string dictionary of AnyHashable.

let type = "order"
var event: [String : AnyHashable] = [:]
event["orderId"] = 12

Kettle.shared.addCustomEvent(type: type, event: event)

Send metadata

This functions performs a PUT request. It accepts a string dictionary of AnyHashable.

let type = "name"
var metadata: [String : AnyHashable] = [:]
metadata["nick_name"] = "nick"

Kettle.shared.setMetadata(type: type, metadata: metadata)

Privacy terms URL

let privacyTermsUrl: String = Kettle.shared.privacyTermsUrl

Privacy dashboard URL

The URL for the Kogenta Privacy Dashboard. This site can be used to view all data collected by Kettle, exporting data and request deletion of data.

let privacyDashboardUrl: String = Kettle.shared.privacyDashboardUrl

Authenticated URL

Generates an authenticated URL by appending an authorization token to given URL. A 404 site is returned if the given URL is invalid.

let authenticatedSiteUrl: String = Kettle.shared.getAuthenticatedUrl(urlString: "https://kogenta.com")

Delete collected PII & Data

Calling this method will request deletion of all data collected by Kettle for the user. This method will delete all data currently residing on the device, as well as request deletion of data in cloud. It requires an active internet connection and accepts an optional closure that can be used to verify that the deletion request was successfully sent.

Kettle.shared.deleteCollectedData() { didRequestDeletion in
if didRequestDeletion {
...
}
}

Requesting bluetooth permission

Convenience method to trigget bluetooth permission dialog.

Kettle.shared.requestBluetoothPermission()