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 its 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.

Hierarchy

  • Consents

Constructors

  • Parameters

    • Optional json: {
          campaigns: ConsentsMap;
          features: ConsentsMap;
      }

      Optional data from JSON deserialization to assign.

      • campaigns: ConsentsMap
      • features: ConsentsMap

    Returns Consents

Properties

campaigns: {
    [key: string]: Consent;
} = {}

Type declaration

features: {
    [key: string]: Consent;
} = {}

Type declaration

Methods

  • Returns the consent for a given campaign, if any available.

    Parameters

    • campaignId: string

      The campaign ID to get the consent for.

    Returns null | CampaignConsent

    the CampaignConsent for the given campaign or null, if consent unknown.

  • Returns the consent for a given feature, if any available.

    Parameters

    • feature: string

      The feature to get the consent for.

    Returns null | FeatureConsent

    the FeatureConsent for the given feature or null, if consent unknown.

  • Checks the consent state of a campaign.

    Parameters

    • campaignId: string

      The campaign ID to check the consent state of.

    Returns ConsentState

    the current state of consent.

Generated using TypeDoc