Easy Guide to Installing a Free Cookie Consent Banner via Google Tag Manager
8 min read

Easy Guide to Installing a Free Cookie Consent Banner via Google Tag Manager

Marcin Pastuszek

Website owners need an affordable way to follow data protection rules. Cookie consent banners are necessary to tell visitors about the site's cookies and get their permission.

While there are paid services like CookieBot and CookieYes, you can also use a free option. This guide shows how to set up a free cookie consent banner using Google Tag Manager. It's based on an open-source solution from GitHub, making your website legally compliant for free. Just follow our easy steps, and in about five minutes, your site will have a working cookie consent banner, ensuring compliance and giving you peace of mind.


To install a free cookie consent banner with GTM, make sure you have everything you need, which is mainly an active GTM account. GTM is a free tool that makes it easy to add code, like tracking and marketing scripts, to your website without changing its code. This makes GTM great for setting up a cookie consent banner quickly.

If you haven't already set up an account, visit the Google Tag Manager website to create one. You'll need a Google account to proceed, which you can set up for free if you don't already have one. After setting up your GTM account, ensure that you have access to your website's backend, or have permission to request the necessary changes from someone who does, as you'll need to add the GTM container code to your site. Preparing these components will streamline the subsequent steps, making the installation process smooth and straightforward.

Step-by-Step Guide

Accessing Google Tag Manager

Navigating to Google Tag Manager's website and logging in with your Google account will grant you access to the platform. Once logged in, you will be presented with the dashboard of your GTM account. Here, an important step involves selecting the proper container for your website. Containers hold tags, triggers, variables, and related configurations for a specific website or app. If you're new to GTM, think of a container as a box where all your tracking and marketing tools are stored and managed in one place.

To begin, navigate to the Templates section within the GTM dashboard. Here, you'll find the option to import a new template. The resource for our cookie consent banner is freely available on GitHub, specifically under the repository 68publishers/cookie-consent. You'll need to download the gtm_template.tpl file from this repository. Once downloaded, return to the GTM Template Editor and select the option to import a template.

Upload the gtm_template.tpl file you've just downloaded.

Once the import is done, you'll be asked to save your work. Click 'Save' to leave the template editor and set up the imported template to show the cookie consent banner. This simple method, using a free template from GitHub, makes adding cookie consent banners much quicker and easier, moving you faster to the next setup step.

To begin, navigate to the Tags section of your GTM dashboard and click on the New button to create a new tag. Here, you will choose the cookie consent template you've imported as the tag type. For the configuration, the template you imported from GitHub offers straightforward options that can be adjusted to match your website's needs and compliance requirements. Most importantly, you need to set a trigger that determines when the banner is displayed to users.

Typically, this would be the Consent Initialization - All Page trigger, set to fire on 'All Pages' to ensure that every visitor encounters the consent prompt upon arrival at your site.

Finalizing and Testing

After setting up the cookie consent feature, make sure to carefully test it to ensure it works properly. This means checking that the consent banner shows up correctly on various browsers and devices for all visitors. Confirm that the banner prompts users for their consent as it should, and accurately records their choices following privacy laws.

To start testing, use Google Tag Manager's built-in preview mode. This feature lets you see how the consent banner will appear to your visitors before the changes go live on your site. Navigate to your GTM dashboard, select your workspace, and click the “Preview” button. After activating preview mode, visit your site to observe how the cookie consent banner is triggered. It's essential to test various scenarios, such as first-time visits and how the site behaves after consent is given or refused, to ensure the banner's functionality aligns with legal requirements and user expectations.

Check how the banner looks and ensure it's easy to use, making sure it fits well with your website and complies with the rules. Aim for a design that's both attractive and respects privacy. If it's not quite right, use Google Tag Manager to make the necessary changes.

In this repository, you can find all of the information about the configuration of the Cookie Consent Banner, https://github.com/68publishers/cookie-consent/tree/main

Once satisfied with the testing results, you can publish the changes through GTM, making the cookie consent banner live on your site. Click the Publish button.


Is Google Tag Manager for Free?

Google Tag Manager (GTM) is a free tool that makes it easy for website owners, marketers, and developers to manage their site's tags without any extra cost. This makes GTM a budget-friendly option for adding features like cookie consent banners to a website. It's especially good for small and medium-sized businesses that need to follow data protection laws without spending a lot of money. GTM is useful for enhancing your site with tracking, analytics (google analytics), or compliance features at no cost, offering a big advantage for improving your website's functionality and compliance without paying for premium services.

You can easily add a cookie consent banner to your website by using Google Tag Manager (GTM). Just import the free cookie consent template into your GTM account. Then, create a new tag in GTM using this template. Set it to trigger on a 'Page View' event so it shows up on every page, giving visitors the option to consent to cookies the first time they visit your site.

After setting up the tag and trigger, double-check they meet your site’s privacy and legal rules about data protection. Make sure to explain which cookies your site uses and why, so users can give informed consent. Once everything looks good, test the banner with GTM's preview mode to make sure it works well and doesn't mess up your site’s look or accessibility. Test on different devices and conditions to ensure your consent banner works properly and follows the law. A well-implemented cookie consent banner not only meets legal requirements but also builds user trust and openness.

Website owners need to know the rules about cookie consent to comply with digital privacy laws. In many places, especially in the European Union with its GDPR law, and in areas with similar laws like California's CCPA in the US, having a cookie consent banner is a must, not just a suggestion. These laws require websites to get clear permission from visitors before using cookies for tracking or customization.

Not having a cookie consent banner can result in big fines, legal issues, and losing customers' trust. It also shows a lack of commitment to privacy and data protection, which can hurt a company's reputation and relationships with customers. Even though adding a cookie consent banner might seem small, it's crucial for following the law, respecting privacy, and creating a trustworthy online space.

Discussing how to circumvent cookie consent notices involves navigating complicated topics regarding online privacy and legal compliance. It's key to remember that laws like the GDPR in Europe and the CCPA in California are made to protect user privacy. They require users to agree before websites can track them with cookies or keep their data.

Skipping cookie consent can violate privacy rules, risk legal trouble, and hurt a website's reputation with privacy-focused users. Due to possible legal and ethical issues, using tricks to avoid consent banners or track users without permission is not recommended.

Website owners should aim for transparency and make it easy for users to give consent. They should clearly explain why they collect data and let users easily accept or reject cookies. This approach builds trust with visitors and ensures websites follow privacy laws.

For people worried about how asking for permission affects their website's user experience or how it works, it's a good idea to look into consent management platforms. These platforms offer flexible and user-friendly options. They help ensure websites follow laws while also providing a smooth user experience, showing that privacy and easy website use can work together well.

If your website gets visitors from places with strict data privacy laws like the European Union (GDPR compliance) or California, you need to show a cookie consent banner. These laws require you to tell users clearly about the data you collect and get their permission before placing cookies on their devices. This means having a cookie banner is a must if you're under these laws. The banner should explain the cookies' purpose and let users accept or reject them. Following these rules helps you stay legal and builds trust with your visitors by respecting their privacy.

Not adding a cookie consent banner when needed could lead to big fines, legal issues, and harm to your website's reputation. It's important and necessary for most international websites to spend time and resources on creating a compliant cookie consent system, like the one we've explained here. This helps build user trust and keeps you legally safe. A well-set-up cookie consent banner is a key step forward.

Marcin Pastuszek

Marcin is co-founder of Seodity

Seodity - AI Content Generator fueled by Real SEO data. | Product Hunt