ArtaConsent SDK Documentation

Complete guide to implementing GDPR-compliant cookie consent management on your website

Quick Start
Get started in under 2 minutes

1. Get your Domain ID

Register your domain in the ArtaConsent Dashboard and copy your Domain ID.

2. Add the embed script

Place this script in the <head> section of your HTML:

<script
  src="https://artaconsent.artatol.net/embed/YOUR_DOMAIN_ID"
  async
></script>

Replace YOUR_DOMAIN_ID with your actual domain ID.

3. Configure tracking items ⚠️

The consent banner will automatically appear. For automatic deletion, you MUST configure all tracking items in the dashboard with correct names, categories, and storage types.

How It Works
1

Script loads your configuration

The embed script fetches your domain's configuration including banner settings, tracking items, and consent categories.

2

Consent banner appears

If user hasn't given consent yet, the banner shows up according to your configuration (blocking/non-blocking mode).

3

User makes choice

User can accept all, reject all, or customize their preferences by category (necessary, functional, analytics, marketing).

4

Automatic tracking item management

⚠️ ONLY if tracking items are configured: SDK automatically deletes cookies, localStorage, and sessionStorage items that user rejected. Consent is recorded and stored.

5

Google Consent Mode v2 integration

If enabled, SDK automatically updates Google's consent signals (ad_storage, analytics_storage, etc.) based on user choice.

What SDK Does Automatically
No additional code required for these features

Cookie & Storage Deletion

⚠️ ONLY if tracking items are properly configured in dashboard: Automatically deletes cookies, localStorage, and sessionStorage items when user revokes consent for a category.

Consent Banner Display

Shows banner on first visit or when user hasn't given consent. Remembers user's choice across visits.

Settings Button

Displays floating cookie settings button (if enabled) allowing users to change their preferences anytime.

Google Consent Mode v2

Updates GCM signals (ad_storage, analytics_storage, etc.) automatically based on user consent.

Consent Recording

Stores consent records with timestamp, visitor ID, and chosen preferences for compliance auditing.

Multi-language Support

Detects browser language and shows banner in configured languages (auto-fallback to default).

Blocking Mode

Prevents page scroll and interaction until user makes a choice (if enabled in configuration).

Developer Responsibilities
What you need to handle in your code

Conditional Script Loading

You must check consent before loading third-party scripts (analytics, ads, etc.):

// Listen for consent changes
window.addEventListener('artaconsent:change', (event) => {
  const consent = event.detail;

  // Load analytics only if user accepted
  if (consent.analytics) {
    loadGoogleAnalytics();
  }

  // Load ads only if user accepted
  if (consent.marketing) {
    loadGoogleAds();
  }
});

// Check initial consent state
const consent = window.ArtaConsent?.getConsent();
if (consent?.analytics) {
  loadGoogleAnalytics();
}

⚠️ CRITICAL: Tracking Item Configuration Required

Automatic deletion ONLY works if tracking items are properly configured:

  • Configure ALL tracking items in the dashboard
  • Assign correct category (necessary/functional/analytics/marketing)
  • Specify correct storage type (cookie/localStorage/sessionStorage)
  • Use EXACT names that match what your scripts create

✅ Properly configured → SDK deletes automatically, zero code needed
❌ Not configured → You MUST manually delete items based on consent

Testing Your Implementation

Before going live, verify:

  • Banner appears on first visit
  • Rejecting categories prevents scripts from loading
  • Cookies/storage items are deleted when consent revoked (only if configured in dashboard!)
  • Settings button allows changing preferences
  • Google Analytics/Ads respect consent signals
Cookie Scanner - Capabilities & Limitations
Understanding what the automated scanner can and cannot detect

✅ What Scanner Can Detect

  • Cookies set on public pages (before login)
  • LocalStorage and SessionStorage items
  • Cookies from embedded third-party scripts (analytics, ads, social media)
  • Items set by cookie consent dialogs (after clicking accept/reject)
  • Storage items created by JavaScript on page load

❌ What Scanner Cannot Detect

  • Tracking items behind login/authentication - Scanner cannot log into your site
  • Items set after user interaction - Forms, buttons, AJAX calls triggered by specific actions
  • Cookies with complex domain/path restrictions - May not match scanner's crawl pattern
  • Dynamically loaded scripts - Scripts loaded conditionally based on user behavior
  • Server-side only cookies - HttpOnly cookies not visible to JavaScript (but scanner sees them in browser)

Recommendation

Use scanner as a starting point, then manually review and add missing tracking items:

  1. Run automated scan to discover public tracking items
  2. Review detected items in dashboard
  3. Manually add items that scanner couldn't find (e.g., post-login cookies)
  4. Check browser DevTools → Application → Cookies/Storage while logged in
  5. Add authentication session cookies, user preference storage, etc.
  6. Test thoroughly before going live

⚠️ Important: Website owner is ultimately responsible for maintaining accurate tracking item inventory. ArtaConsent scanner is a tool to assist discovery, but cannot guarantee 100% detection due to the limitations above. Regular manual audits are recommended, especially after adding new features or third-party integrations.

SDK JavaScript API
Interact with consent state programmatically

Get current consent state

const consent = window.ArtaConsent?.getConsent();
// Returns: { necessary: true, functional: false, analytics: true, marketing: false }

Update consent programmatically

window.ArtaConsent?.updateConsent({
  necessary: true,
  functional: true,
  analytics: false,
  marketing: false
});

Listen for consent changes

window.addEventListener('artaconsent:change', (event) => {
  console.log('Consent updated:', event.detail);
  // event.detail = { necessary: true, functional: true, analytics: false, marketing: false }
});

Show settings dialog

// Open cookie settings dialog manually
window.ArtaConsent?.showSettings();