Manage User Cookie Consent With Gtag.js

If you’re using gtag.js for tracking, you can ensure that no cookies are set without user consent. The process is very straightforward.

Pre-Built Integration With gtag.js

The WebsitePolicies cookie consent banner handles everything automatically. You don’t need to manually configure gtag.js consent updates or tracking as it is able to handle this by pushing consent parameters to gtag.js.

Once the user interacts with the consent banner, the gtag settings for ad storage, analytics storage, and other categories are automatically updated based on their preferences.

Here’s what happens automatically:

  • Consent Handling: The script blocks cookies for categories like analytics and marketing until the user provides explicit consent.
  • Consent Updates: If the user accepts cookies, the script automatically updates gtag.js by granting consent for ad storage and analytics storage. If the user rejects cookies, it ensures those categories remain denied.
  • Tracking Consent: After the user makes their choice, the script pushes the event wpcc_consent_updated to the dataLayer, allowing you to track when consent is updated.

With the WebsitePolicies cookie consent banner handling everything, managing cookie consent via gtag.js is seamless. It ensures your site is compliant with privacy regulations while respecting user preferences, making the entire process hands-free for you.