CleanInsightsSDK Documentation Beta

Class Consents

open class Consents: NSObject, Codable

This class keeps track of all granted or denied consents of a user.

There are two different types of consents:

  • Consents for common features like if we're allowed to evaluate the locale or a user agent.

  • Consents per measurement campaign.

The time of the consent is recorded along with it's state: If it was actually granted or denied.

Consents for common features are given indefinitely, since they are only ever recorded along with running campaigns.

Consents for campaigns only last for a certain amount of days.

Consents Consents Codable Codable Consents->Codable NSObject NSObject Consents->NSObject

Conforms To

Codable
NSObject

Properties

description

var description: String

Methods

grant(feature:​)

@discardableResult public func grant(feature: Feature) -> FeatureConsent

User consents to evaluate a Feature.

deny(feature:​)

@discardableResult public func deny(feature: Feature) -> FeatureConsent

User denies consent to evaluate a Feature.

has​Been​Granted(for​Feature:​)

public func hasBeenGranted(forFeature feature: Feature) -> Bool

Returns

if consent to a Feature was given.

grant(campaign:​_:​)

@discardableResult public func grant(campaign campaignId: String, _ campaign: Campaign) -> CampaignConsent

User consents to run a specific campaign.

Parameters

campaign​Id String

The campaign ID.

campaign String

The campaign.

deny(campaign:​)

@discardableResult public func deny(campaign campaignId: String) -> CampaignConsent

User denies consent to run a specific campaign.

is​Campaign​Granted(_:​for​Period:​_:​)

public func isCampaignGranted(_ campaignId: String, forPeriod start: Date, _ end: Date) -> Bool

Returns

if consent to run a campaign was given and is valid for the given period.

is​Campaign​Currently​Granted(_:​)

public func isCampaignCurrentlyGranted(_ campaignId: String) -> Bool

Returns

if consent to run a campaign was given and is now valid.