Account Settings

Winkelwagen

De winkelwagen is nog leeg

Website Settings

Dondere modus
Hoog contrast
Font grootte
Lees pagina-inhoud
Afdrukken
Realtime
  • Datum: 19-02-2026
  • Week: 08
  • Weer:
  • Seizoen: Winter

Set the default consent state

Bekijk website

Omschrijving

This script is part of Google’s Global Site Tag (gtag.js) framework, specifically handling user consent settings for various types of data storage and processing. Here’s a breakdown of its functions:

  1. Data Layer Initialization:
    • window.dataLayer = window.dataLayer || []; This line ensures that the dataLayer variable exists. It’s a global array used by Google Tag Manager to store and manage data. If dataLayer already exists, it’s left unchanged; if not, it’s initialized as an empty array.
  2. gtag Function:
    • function gtag(){dataLayer.push(arguments);} Defines the gtag function, which is used to send data to Google Analytics and related services. It works by pushing the arguments it receives into the dataLayer.
  3. Consent Configuration:
    • gtag('consent', 'default', {...}); Sets default consent settings for various purposes. These settings dictate how different types of data can be used or stored based on user consent. The parameters specified include:
      • ad_storage: Ad-related data storage (e.g., cookies for ad targeting). Here, it’s set to 'denied', meaning this type of storage won’t occur unless consent changes.
      • analytics_storage: Data storage for analytics purposes. Set to 'granted', allowing analytics tools like Google Analytics to store data by default.
      • ad_user_data: Personal data collected from advertisements. Also denied.
      • ad_personalization: Use of personal data for ad personalization. Denied as well.

This script essentially configures how the website should handle user data based on their consent, aligning data usage with privacy preferences and legal requirements like GDPR. It is crucial for managing user data responsibly and respecting user privacy.

  <script>
        // Define dataLayer and the gtag function.
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}

        gtag('consent', 'default', {
            'ad_storage': 'denied',
            'ad_user_data': 'denied',
            'ad_personalization': 'denied',
            'analytics_storage': 'granted'
        });
    </script>

Snippet

FieldValue
Snippet Status
Snippet Description
Snippet Type Code
Snippet URL
Snippet Content
Snippet Content CSS
Snippet Content HTML
Snippet Content JS
Snippet Content PHP
Particle Snippet in Software1
Particle Snippet in Boilerplate0

Relations

ItemType

Pointing items

ItemTypeCategoryTags

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Home