Shared Options
export interface CookiesConsentParams {
expirationDays: number
path?: string
sameSite?: 'strict' | 'lax' | 'none'
position?: PositionType
btnDismissPosition?: ButtonDismissPositionType
buttons?: ButtonType[]
ignorePages?: string[]
hideDescription?: boolean
mainWindowSettings?: boolean
animation?: boolean
content: Content
cookies?: Cookie[]
callback?: Callback
theme?: Theme
}
expirationDays
- Type:
number
Specifies the number of days the cookie will be valid. If not specified, the cookie is deleted when the browser is closed.
path
- Type:
string
- Default:
"/"
Tells the browser what path to the directory the cookie belongs to.
sameSite
- Type:
'strict' | 'lax' | 'none'
- Default:
'lax'
- Reference: SameSite cookies – HTTP - MDN
Allows you to declare if your cookie should be restricted to a first-party or same-site context.
position
- Type:
PositionType
- Values:
top
,top-left
,top-right
,top-center
,bottom
,bottom-left
,bottom-right
,bottom-center
. - Default:
bottom-left
Position where the cookies message will be placed.
btnDismissPosition
- Type:
ButtonDismissPositionType
- Values:
top-left
,top-right
,bottom-left
,bottom-right
. - Default:
bottom-left
Position where the dismiss button will be placed.
buttons
- Type:
ButtonType[]
- Values:
accept
,reject
,settings
,info
,dismiss
. - Default:
['accept']
List of buttons that will be shown. The order in the array determines the order in which the buttons will be displayed.
ignorePages
- Type:
string[]
List of pages that will be excluded from showing the cookies message.
hideDescription
- Type:
boolean
- Default:
true
Determines if the description of the cookies in the settings window appears collapsed or visible.
mainWindowSettings
- Type:
boolean
- Default:
false
Set the settings window as the main. This window will be displayed when the page is accessed for the first time or when we click on the dismiss button to configure cookies.
animation
- Type:
boolean
- Default:
true
Determines if the window will be shown with an animation. This does not affect the information and settings windows.
content
- Type:
Content
- Reference: Content Options
- Example:
content: {
title: 'This website is using Cookies!',
message: `
<p>
This site uses cookies (or similar) to measure traffic to this website. By clicking ACCEPT ALL, you are agreeing to our and our partners' use of cookies. You can change your cookie preferences at any time. For more information, please visit, our Cookie Notice.
</p>
`,
settingsFooter: `
<p>
However, if you use your browser settings to block all cookies (including essential cookies) you may not be able to access all or parts of our website.
<br />
Except for essential cookies, all cookies will expire after the expiry periods as set out in the Gecko Hospitality Cookie Notice.
</p>
`,
},
Parameters that define the message content.
cookies
- Type:
Cookie[]
- Reference: Cookies Options
- Example:
cookies: [
{
name: 'essential_cookie',
title: 'Essential Cookies',
description: `
<p>
These cookies are required to enable core functionality of the Site. Without these cookies, services you have asked for cannot be provided. If you disable these cookies certain parts of the Site will not function for you
</p>
`,
},
{
name: 'analytics',
title: 'Analytics',
description: '<p>Analytics Cookies 🍪.</p>',
cookies: [
{
name: 'cc_ga',
code: 'G-XXXXXXXXXX',
manageFunction: manageGoogleAnalytics,
},
{
name: 'cc_gtm',
code: 'GTM-PVJH7S4',
manageFunction: manageGoogleTagManager,
},
],
},
],
Parameters that define the custom cookies.
callback
- Type:
Callback
- Reference: Callback Functions
Functions that will be invoked after some events: first load, every load, after accepting cookies, and after rejecting cookies. Callback functions allow us to control the actions that must be executed depending on the state of the cookies.
theme
- Type:
darkTheme | contrastTheme | smoothTheme | undefined
- Default:
undefined
Theme that will be applied to the cookies consent. Need to import module and add to the configuration.