Blog/
What is Cookie Consent? Requirements, Best Practices & Implementation Guide

What is Cookie Consent? Requirements, Best Practices & Implementation Guide

By Mubeen KP , Performance Marketing Executive with around 2 years of experience in digital advertising and campaign optimization.
  • Published in Blog on March 23, 2025
  • Last Updated on March 24, 2025
  • 10 mins read
Essential Guide to Cookie Consent

Data privacy has become a crucial concern for businesses and individuals. The rise of data-driven marketing has led businesses to collect huge amounts of data to personalise their website experiences, optimise marketing campaigns, and improve website performance. However, as consumers are increasingly aware of how their data is being used, governments worldwide have enforced policies to protect user rights.

Laws such as GDPR (General Data Protection Regulation) in the EU, the California Consumer Privacy Act (CCPA/CPRA) in the US, and the ePrivacy directive mandate websites to ask for consent before storing or tracking customer data. Failure to comply can result in huge fines and reputational damage. For example, Google has faced a hefty €150M fine for failure to provide clear cookie consent options. Another survey revealed that a significant percentage of adult consumers in the US are taking careful steps to secure their personal information.

Proper cookie agreement implementation is essential not only for legal compliance but also for maintaining trust with customers. This blog will outline the key steps required for effective website cookie consent implementation, which ensures both compliance with regulations and seamless user experience. 

How Do Cookies Work?

Cookies are small text files used to store customer information when they visit the website. They play an important role in analysing website performance, tracking user behaviour, and personalising online experiences. They usually store login information, language preferences, and browsing activity.

There are two types of cookies.

1. First party cookie

This cookie is installed by the website, it helps to improve site functionality, remember preferences, and provide a seamless experience to a user. For e-commerce websites, these cookies may be used to retain add-to-cart information even if a user navigates away from the website. 

2. Third-party cookie 

These cookies are placed by external parties such as GA4 or Pixel, to track user activity on different websites. It provides insights for these platforms to create targeted audiences.

Cookies help enhance user experience, reduce load times, and serve relevant content. However, the role of third-party cookies has raised privacy concerns. This prompted stricter regulations following less accurate targeting on these platforms.  

Types of Cookies and Their Purposes

Cookies serve different purposes and understanding their types and uses helps businesses to implement privacy-compliant tracking on their websites. There are 4 main types of cookies.  

1. Essential cookies

Essential cookies are necessary for website functionality as they play key roles in user authentication, session management, and security. Without this cookie, users won't be able to log in, add to cart, or navigate the website efficiently. Since it doesn't track users for marketing purposes, most policies allow this cookie without consent.  

2. Analytical Cookies

Analytical cookies collect data on how each user interacts with the website. These data help businesses optimise their user experience. Tools such as Google Analytics, and Microsoft Clarity use this type of cookie to store data about the visitor such as session duration, bounce rate, and page views. While these cookies don't collect unique user data such as email addresses, they still require explicit user consent under laws like GDPR and CCPA/CPRA. 

3. Marketing Cookies

As the name suggests, marketing cookies are used primarily for tracking users across the websites. Platforms such as Meta ads & Google ads rely on these cookies to deliver targeted advertising based on history and preferences. Due to this tracking nature, it is heavily regulated under privacy laws and requires clear user opt-in consent from users before activation.  

4. Preference Cookies

Preference cookies store user preferences like currency, language, or theme preferences. They help users by remembering their previous choices, eliminating the need to set these personal preferences on each visit. While they improve user experience, they still require consent under strict privacy laws.  

Also read

How Different Industries Handle Cookies

Different industries handle consent cookies based on their unique data usage and policy requirements.  

E-commerce

Online shopping sites rely upon cookies to enhance user experience and drive sales. Essential cookies track cart activity, ensuring users don't lose shopping cart items even if they leave the website. Meta pixel and Google ads tag use marketing cookies to analyse browsing behaviour to deliver personalised product recommendations. Due to this intrusive behaviour, e-commerce websites must obtain clear consent before tracking a user.  

Banking

Financial institutions prioritise security and compliance when handling cookies. Essential cookies help to prevent fraud, authenticate users, and enable secure transactions. Due to strict financial regulations, banks limit the usage of marketing cookies and encrypt tracking. Privacy laws require the provision of detailed consent notices regarding their data collection practices.

Healthcare

Healthcare websites handle sensitive data such as patient data, so they must adhere to laws such as HIPAA (Health Insurance Portability Accountability Act) which restricts using healthcare data for marketing purposes. Many healthcare websites are limited to essential and analytical cookies only to ensure compliance.

Media & Advertising

Advertisers rely on third-party cookies to deliver targeted ads, with increasing privacy restrictions and browsers moving towards a privacy-first approach, many media companies are focusing on collecting their customer data instead of relying on third-party data.

gtag-consent.jsJavaScript
1<script> window.dataLayer = window.dataLayer || []; 2function gtag(){dataLayer.push(arguments);} 3gtag('consent', 'default', { 4'ad_storage': 'denied',5'analytics_storage': 'denied', 6'personalization_storage': 'denied', 7'ad_user_data': 'denied',8'ad_personalization': 'denied'9 }); 10</script>

Step 3: Sync CMP with Consent Mode

Once the user allows the cookies, update it through the Google Consent mode 

gtag.jsJavaScript
1 gtag('consent', 'update', {2  'ad_storage': 'granted',3  'analytics_storage': 'granted'4});

Step 4: Test consent mode in Google Tag Assistant

Open the tag assistant and verify if tags are only triggering when the user consents.  

Method 2: Manual Implementation

For businesses that prefer full control over cookies and allow compliance for a unique set of policies.

Enable consent mode in GTM.

  • Go to Tag Manager → Admin → container settings. 
  • Enable consent overview and configure default consent settings.  
     

screenshot 1

 2. Define default consent states

  • Use the tag manager’s consent initialisation trigger to set default consent states. 
    screenshot 2
  • Insert the following script with a custom HTML tag. 
gtag-consent.jsJavaScript
1window.dataLayer = window.dataLayer || [];2function gtag() {3	dataLayer.push(arguments);4}5
6gtag("consent", "default", {7	ad_storage: "denied",8	analytics_storage: "denied",9	ad_user_data: "denied",10	ad_personalization: "denied",11	personalization_storage: "denied"12});

This makes sure that tags are not triggered until consent is given.    
screenshot 3  
 3. Capture & retain user consent choices

To prevent users from having to accept cookie banners every time they visit, their consent choice is stored in a cookie for 30 days. 

  • When a user selects the consent option, their choice is stored in a cookie. 
  • On future visits, stored consent settings are automatically applied without requiring the user to reselect their preferences.  
     
screenshot 4

4. Update consent when the user grants specific consent

By default, essential cookies like security & functionality are enabled as they are required for the website's smooth operation. No tracking for advertising, analytics, or personalisation occurs until the user is specifically allowed to do so.

Essential cookies are enabled by default.  

  • If a user clicks “accept all”, all tracking categories (Ads, analytics, and personalisation) are enabled. 
  • If a user clicks preferences, only personalisation is enabled. 
  • If a user clicks the marketing only ad-related tracking is enabled. 
screenshot 5

5. Modify tags to respect the consent

Navigate to each tag and under advanced settings adjust the tag to fire only when the respective consent is given.  

screenshot 6

While manual implementation offers flexibility, it requires technical expertise and ongoing maintenance to make sure it remains compliant with updated data privacy laws.

Not Sure Whether to Use Google CMPs or Go Manual?

Reach out to us

Loading...

Common Mistakes to Avoid

1. Not Blocking Cookies Before Consent

Cookies must not load until the user gives explicit consent, failing to do this will violate GDPR and other privacy laws.  

2. Using Pre-Checked Consent Options

Consent must be freely given, meaning the user should have to actively opt-in, including pre-checked boxes & implied consent is not compliant.   

3. Failing to Offer Granular Consent Options

Some businesses bundle all into a single “Accept” button which doesn’t align with consent mode V2. Ensure there are granular options for different consent types allowing users to choose.  

4. Forgetting to Store or Track Consent Logs

Businesses must be able to prove users have consented to data collection, without logs, compliance audits can be a problem. Implement a consent log with timestamped user choices in a database.  

5. Not Allowing Users to Withdraw Consent

Privacy laws require that users must be able to withdraw or modify their consent at any time. Include a change preferences option on the footer of the website.  

6. Failing to Apply Consent Mode to Marketing Tags

Enabling cookie banners is not enough, tags should only fire according to user consent. Go to tag settings and make sure tags are only fired if the user has given consent.  

7. Ignoring Country-Specific Laws

Different regions have different privacy laws, and implementing a one-size-fits-all approach will lead to non-compliance.    

8. Not Testing the Implementation

Assuming consent settings are working properly and failing to test them. This results in tracking data before consent is given. Use Google tag preview mode to check tags are not triggered before user consent is given.  

9. Not Updating Policies & Consent Management Systems Regularly 

Privacy policies are getting updated regularly; failing to catch up with them will make the consent management system non-compliant. Perform regular audits to ensure compliance with the latest privacy laws and browser cookie policies.   

Conclusion

With increasing data privacy regulations, implementing a proper cookie consent management system is essential to stay compliant and gain user trust. By following best practices and consent mode V2 businesses can continue to collect data while remaining compliant with the laws and browser policies.

While CMPs provide an easier way to implement consent mode, they always come with a cost over manual implementation. However, both methods require careful setup and regular audits to remain compliant with evolving privacy laws.

Webandcrafts specialises in privacy-compliant analytics solutions, helping businesses implement privacy-compliant cookie consent management. Learn more about how Webandcrafts can help implement privacy-first analytics with our analytics services.

Ready to Implement Cookie Consent the Right Way?

Let's talk

Loading...

Discover Digital Transformation

Please feel free to share your thoughts and we can discuss it over a cup of tea.