Analytics, Insert Menu

How to add a Cookie Banner to your Framer website

How to add a Cookie Banner to your Framer website

How to add a Cookie Banner to your Framer website

·

9:43

·

33K views

·

About this lesson

We’ve added the Cookie Banner Component to the insert menu. The component allows you to set up a complete cookie consent system through Google Tag Manager. It is fully integrated with Google’s Consent Mode, which allows you to activate Google services, third-party integrations, or custom scripts only when the appropriate consent has been obtained. You can customize every piece of text and adjust the appearance to ensure it blends seamlessly with your website. Learn more here: https://www.framer.com/academy/lessons/cookie-banner-component

https://www.youtube.com/watch?v=0XZRVjInsXY&t=3s Setting up a fully working cookie consent banner connected to Google Tag Manager

https://www.youtube.com/watch?v=0XZRVjInsXY&t=11s Choosing a component for the banner

https://www.youtube.com/watch?v=0XZRVjInsXY&t=33s Adding the component from the insert menu

https://www.youtube.com/watch?v=0XZRVjInsXY&t=47s Customizing the trigger and appearance of the banner

https://www.youtube.com/watch?v=0XZRVjInsXY&t=99s Setting the trigger type to "none" for showing the banner only to first-time visitors

https://www.youtube.com/watch?v=0XZRVjInsXY&t=137s Enabling preview mode and customizing the banner options

https://www.youtube.com/watch?v=0XZRVjInsXY&t=275s Tweaking the style and design of the banner

https://www.youtube.com/watch?v=0XZRVjInsXY&t=427s Setting up Google Tag Manager for the site

https://www.youtube.com/watch?v=0XZRVjInsXY&t=563s Connecting the container ID to the component

🌞 Try Framer for free: https://framer.com

🎉 Follow on Twitter: https://twitter.com/framer

💎 Join Community: https://www.framer.community

MB01S5ZYXOY8TO8

0:00foreign0:01I'm Flo0:03and in this video I'll show you how to0:06set up a fully functioning cookie0:08consent Banner powered by Google tag0:10manager0:11let's take a look at our project0:13here we have a documentation website0:16with the sidebar on the left and a0:18Content section on the right0:20we want our cookie Banner to show up on0:23the entire website so it's smart to pick0:25a component that is already set up on0:28every page0:29in our case that is the sidebar0:31component0:33let's add the component from the insert0:35menu0:37we'll first drop it on the canvas so0:39that we can customize it0:41to make it work with Google tag manager0:43we need a container ID0:45but we'll set that up later0:47here you can see that preview is enabled0:50by default0:51this makes it easy to tweak the look and0:53feel of the banner0:54turning off preview will show what the0:56component will actually look like on0:58your page0:59currently it will show as a trigger that1:02allows your users to open up the banner1:04let's tweak the way the trigger looks1:06that it feels at home in the sidebar1:09we'll give it a different font family1:14update the weight1:16we'll use the same size as the sidebar1:18and now we can pick a color1:21that's better now we'll drop it into the1:23sidebar so that it's part of our page1:26and let's publish this so that we can1:28check it out in the browser1:32now when we load our page the cookie1:34Banner automatically shows up because we1:36haven't given any consent yet1:39and when we switch to another page it1:42will stay put until we dismiss it1:47there are times where you don't want to1:49trigger at all and only want to show the1:51cookie Banner when the visitor visits1:53your site for the first time1:55for those cases you can set the trigger1:58type to none2:00and then if we take a look in the2:02preview you can see that it is2:03completely hidden you can even set the2:06opacity to zero and it would still work2:09for this demo we do want to trigger so2:11let's revert the trigger type to text2:17I'll drag the component out to the2:19sidebar and enable preview so that we2:21can customize it further2:23we can control the component's behavior2:24for the EU and the rest of the world2:26specifically2:28for most of the world a simple Banner2:30that lets users know you're using2:31cookies is enough2:33for the EU you might want to go for2:35something more elaborate2:37toggling between EU and world will show2:39the corresponding Banner on the campus2:42for each region we can control the types2:44of choices a user has we can use a2:46different copy we can add a link to our2:48cookie policy set the default consent or2:51render a blocking backdrop behind our2:53Banner2:54there are three different types of2:55choices you can give users none which2:58will render is simple notice Banner with3:00the confirmation button and will Auto3:02accept cookies3:04accept reject3:06giving an All or Nothing choice or3:08customizable3:09offering four different consent options3:12with customizable selected we can see an3:15additional options prop3:17if we open this up we can control the3:20text or the look and feel of the options3:23that you see when you click the3:24customize button3:26let's click preview so we can see it on3:28the canvas3:30you can tweak the copy of each option so3:32you can be as explicit as you want3:34let's first tweak the general look and3:36feel of the banner so let's close this3:37up for a bit and focus on the banner and3:39buttons props3:41here you can see that we have full3:43control over positioning with batting3:45and layout3:47but let's first focus on tweaking our3:49style3:52I'll speed it up for a bit so you can3:53see in real time how I'm tweaking this3:55component3:58I'm trying to use color variables as4:00much as possible so that we have4:02automatic support for dark mode4:05and here I'm replacing the border with a4:08shadow to make it pop a little bit4:11next we're opening up our buttons prop4:13where we control the primary button and4:16the secondary button and we also have4:18full control over all the labels that4:20are being used in the banner4:24and finally we enable preview for our4:27options so that we can tweak them and4:29also make them fit into our design4:31[Music]4:33I think we're done4:35so let's disable preview mode drop it4:38back into our sidebar and hit publish4:41when we open up the browser you can see4:43that the banana perfectly fits our4:45design4:46and we can set four different levels of4:48consent with the customize button4:53now let's switch over to Google tag4:54manager so that we can set it up on that4:56side4:57I have a brand new container so let's4:59first enable consent mode5:03if we go into the admin settings and5:05then container settings we can simply5:07enable consent overview5:10done5:12next5:16let's set up our first tag5:19we'll set up a tag for Google analytics5:21because the Google tags are the easiest5:23to set up5:24I'll paste in my analytics ID5:27then I'll go into consent settings and5:31you can see that automatically the5:34Google tag looks for certain consent5:37and without it it will only send5:39anonymous Bings to Google Analytics5:42we'll finish up this tag by making it5:45trigger on every page5:47then we'll hit save and we're done5:52we can also Fire custom tags based on5:55consent5:57to do this we can simply create a new5:59tag6:01we can select any service that we want6:04or in this case we can fire some custom6:06HTML6:10then we open up the consent settings6:13again6:19and now we can simply say what kind of6:21consent we need before we want to fire6:23this tag6:25in this case I'm only looking for6:27consent for ad storage6:29but you can also select multiple so that6:32they all have to be true before this6:33stack fires6:35and again we'll make this one trigger on6:38all pages6:39[Music]6:42we'll save this one as well6:45and let's take a look at what we have6:47there is a Google analytics tag which6:49will always fire but will adjust Its6:52Behavior based on given consent and we6:55have a custom tag that will only fire if6:58ad storage consent has been given7:00we're good to go7:03let's publish this container so that we7:04can use it in our site7:07[Music]7:11the last thing we need to connect it to7:13our component is the container ID7:16let's copy it over7:18we can simply paste it in the properties7:20panel7:21and we're done7:23now let's update our site so that we can7:25check if everything is wired up7:27correctly7:29Google tag manager offers some great7:30tools to track what's happening on your7:33site if you go into tag manager and then7:35click the preview button this will open7:37up the tag assistant7:39the tag assistant shows you everything7:41that Google tag manager is doing on your7:43site and everything that is not7:46for example in the summary here we can7:49see that the Google analytics tag has7:51been fired and our custom marketing tag7:54has not been fired because we haven't7:56given the proper consent yet in the7:58sidebar we can see all the events that8:00Google tag manages firing8:03the one that we need to keep track of is8:05consent which is the first one in this8:07case8:09as this is the first step you can see8:11that none of the tags have been fired8:13yet8:14we're first setting the default consent8:16and then tag manager will figure out8:18which tags need to be fired8:21let's check out what happens when we8:23update the consent in the cookie Banner8:28hit customize8:30and we'll just enable Analytics8:33we'll hit save8:35and on the right you can see that a new8:37consent event has been fired8:40and in this event you can see that we8:42have given consent for analytics storage8:45that means that the Google analytics tag8:47will go back to its default behavior and8:50will track everything8:52now let's make our custom tag fire we'll8:55open up the cookie Banner again8:57and will enable marketing9:00under the hood this maps to the add9:02storage consent in Google9:05and you can see that that is now granted9:08if we now reload the page our marketing9:11tag fires and you can see the alert that9:13we have just added to Google tag manager9:17the cookie Banner component allows you9:19to connect framer to Google tag manager9:21and this is a powerful setup in framer9:25you can set up a beautiful cookie Banner9:27to collect and send from your visitors9:29an attack manager you can fully control9:32the behavior of your site9:33we hope that this will make dealing with9:35cookies a lot easier9:37thank you for watching

Watch on YouTube ↗

More in this topic

Framer Convert: Understand, Test, and Optimize.0:37
Framer Convert: Understand, Test, and Optimize.
Announcement7.2M views · 3 months ago
Framer Convert5:42
Framer Convert
Framer Update13K views · 3 months ago
How to get the most out of Framer for Free4:05
How to get the most out of Framer for Free
Animations15K views · 8 months ago
Advanced Analytics: Track clicks, build funnels, and run A/B tests1:49
Advanced Analytics: Track clicks, build funnels, and run A/B tests
Analytics7K views · 1 year ago
Workshop: Turn prompts into powerful components with AI2:20
Workshop: Turn prompts into powerful components with AI
AI9K views · 1 year ago
Using the Insert Panel in Framer (Fundamentals Lesson 13)5:14
Using the Insert Panel in Framer (Fundamentals Lesson 13)
Insert Menu25K views · 1 year ago
Analytics in Framer (Fundamentals Lesson 30)2:54
Analytics in Framer (Fundamentals Lesson 30)
Analytics19K views · 1 year ago
All-new Framer Analytics0:39
All-new Framer Analytics
Framer Update6K views · 1 year ago

Create a free website with Framer, the website builder loved by startups, designers and agencies.