Cookies management

This page provides an overview and usage guidelines for the privacy API related to cookies consent management - more specifically cookies, local and session storages consent and access.

This page covers:

  • _fwn.cookies Cookies consent API callbacks

  • cookies_opt_in configuration to prevent any storage access until consent is given

  • cookies_root configuration to prevent cookies being created at root domain


Firework widgets distinguish several cookie (local/session storage) categories.

  • essential

  • functional

  • performance

  • targeting

Configuration

There are two implicit behaviors in which widgets can be configured - opt-in and opt-out (default).

Opt-out

Widget and Player uses cookies, local and session storages directly. This is a default behavior.

Opt-in

Widget and Player awaits for a consent to be given for each category to access user’s browser storages. Until then all storage data are kept in memory. Reloading page will cause storage data loss and user will refresh its identifiers.

To integrate widgets with opt-in strategy, integration must include cookies_opt_in="true" param on a script tag via data attribute data-fwparam_cookies_opt_in.

Example:

<script
    src="//asset.fwcdn3.com/js/fwn.js" 
    data-fwparam_cookies_opt_in="true" 
    async
></script>

Root domain

Some cookies might be set on root domain to be accessible across subdomains. For example widget placed on www.example.com will attempt to set the same cookie to .example.com as well as www.example.com

The goal here is to be able to attribute purchase on shop.example.com to a video which was consumed on live.example.com. We understand such behavior might be undesired and can be disabled by add cookies_root="false" param to a global page configuration.

Example of a script tag with global configuration:

<script
    src="//asset.fwcdn3.com/js/fwn.js"
    data-fwparam_cookies_root="false"
    async
></script>

To grant or revoke particular consent at any time, _fwn web SDK provides several options:

  • _fwn.cookies.enableCookies to grant consent for each given category

  • _fwn.cookies.disableCookies to revoke consent for each given category

  • _fwn.cookies.setConsent revokes all consents, then grants consent to each given category

All functions above accept comma separated list of consent categories or empty string to indicate all categories.

Example:

// Grant consent to `essential` and `functional` categories 
_fwn.cookies.enableCookies('essential, functional') 

// Grant consent to all categories 
_fwn.cookies.enableCookies('') 

// Revoke all consents 
_fwn.cookies.disableCookies('') 

// Revoke all previously set consents, then set grant for new consent categories 
_fwn.cookies.setConsent('essential') 

Last updated