Cookie Configuration
The Axitech Widget provides comprehensive cookie management capabilities, allowing you to control how cookies are handled within the widget. This is especially important for compliance with privacy regulations like GDPR, CCPA, and others.
Cookie Configuration Options
The cookie configuration object supports the following properties:
| Property | Type | Description |
|---|---|---|
enabled | boolean | Master switch for all third-party cookies (GA, Clarity, W3W). When false, no cookies will be set and no requests will be made to these services. |
gaId | string | Overrides the default Google Analytics ID. |
clarityId | string | Optional Microsoft Clarity tag ID. |
oneTrustDomainId | string | OneTrust domain ID for cookie banner integration. |
Implementation
Basic Usage
load('your-api-key', {
clientId: 'your-client-id',
contact: {
phone: '0330 058 4077',
email: 'claims@example.com',
},
cookie: {
enabled: true, // Allow cookies
oneTrustDomainId: 'your-domain-id', // OneTrust domain ID
},
});
Inheriting Consent from Parent Domain
If your widget is embedded on a page that already has cookie consent management, you can inherit those settings:
load('your-api-key', {
clientId: 'your-client-id',
// ...other settings
cookie: {
enabled: true,
},
});
Custom Analytics IDs
You can specify custom Google Analytics or Microsoft Clarity IDs:
load('your-api-key', {
clientId: 'your-client-id',
// ...other settings
cookie: {
enabled: true,
gaId: 'UA-CUSTOM-ID', // Custom GA ID
clarityId: 'YOUR-CLARITY-ID', // Custom Clarity ID
},
});
Passing Consent from Parent Application
The widget provides a function to update cookie consent settings from the parent application:
import { updateWidgetCookieConsent } from 'axitech-widget';
// Update analytics consent
updateWidgetCookieConsent({
analytics: true, // Allow analytics cookies
});
// Update multiple consent categories
updateWidgetCookieConsent({
analytics: true, // Allow analytics cookies
marketing: false, // Disallow marketing cookies
functional: true, // Allow functional cookies
});
This is useful when your main application has its own cookie consent management system, and you want to synchronize settings with the embedded widget.
Acceptance Criteria
The cookie configuration satisfies the following criteria:
- When
enabledis set tofalse, no third-party cookies are set, and no requests are made to GA/Clarity/W3W.