GDPR

cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

***The method described in this article will only work on HubSpot-hosted subdomains. External domains do not have authorization to access the Header/Footer in Settings from within HubSpot. However, the actual code from the article can be used on externally hosted domains. The styles would just need to be placed in the Headers/Footers of your templates in whichever CMS you use, or within the stylesheet there.***

 

With GDPR looming right around the corner, companies are all working toward getting everything in order. That means updating the Privacy Policy banner that will need to appear at the top of your site in order to notify visitors that your site uses cookies.

 

Where can you find the settings for this banner?

 

To get to the Privacy Policy section in your Settings go to your Avatar in the top right corner > Settings

 

SettingsSettings

Then go down to Reports and Analytics Tracking

 

If you have the New Navigation enabled go ahead to the Settings Icon, then to Reports and Analytics Tracking

 

New NavNew Nav

 

Once there, head over to the Cookie Policy tab. Here is where you’ll find all settings on cookies. You can change the banner text, the button text to accept the terms, and the disclaimer text, but there’s no place to change the actual style!

 

new cookies settingsnew cookies settings

 

 

UPDATE: With the new Reports Settings beta we can change the location of the banner as well as the colors, but not much more than this. The code below can still help customize your banner further.

 

Here is a screenshot of the new styling tab of the Reports Settings:

 

styling colors and position of bannerstyling colors and position of banner

 

Hubspot’s default styling for the banner is great, but what if you want to customize its appearance to match your brand? Well, it’s not super obvious, but we can get around it using some CSS.

 

Here’s the default:

 

Default Privacy Policy BannerDefault Privacy Policy BannerThe styling of this cookie banner automatically gets injected into the Head HTML (we can’t access this, however Smiley triste), so what we can do is place it in the Footer.

 

But why the Footer, you say?

 

If you’re familiar with CSS and the cascade, if there are two identical declarations with the same specificity (which is what will happen in our case since we are going to overwrite the default), the declaration that comes last will “win out”.

 

So for this, we’d want to do this globally. So let's head over to the Marketing section of the Settings and go to Web Pages.

 

To modify the styling for All Domains, we should have All Domains setting selected:

 

All DomainsAll Domains

NOTE: IF YOU HAVE ANYTHING IN THE FOOTER OR HEADER WHEN MODIFYING A SPECIFIC DOMAIN (instead of “All Domains”) THOSE SETTINGS WILL OVERWRITE THE DECLARATIONS WE PLACE IN THE FOOTER OF ALL DOMAINS.

 

So to style the banner, here’s the boilerplate you’d need:

 

<style>
/* Edit this section to change the main container of the banner */ div#hs-eu-cookie-confirmation.can-use-gradients { code in here }
/* Edit this section to change the inner wrapper of the banner i.e. add more padding */ div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner { code in here }
/* Edit this section to change the style of the text */ div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner p { code in here } /* Edit this section to change the style of the CONFIRM button */ div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-confirmation-button { code in here }
/* Edit this section to change the style of the DECLINE button */
div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-decline-button { code in here }
/* Edit this section to change the style of the CONFIRM button when hovering */ div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-confirmation-button:hover { code in here }

/* Edit this section to change the style of the DECLINE button when hovering */
div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-decline-button:hover { code in here } </style>

 

 

Be aware, most of the declarations you make here are going to require CSS !important tags and will need to be placed inside of <style>code here</style> tags.

For my site, I’m going to go with the following:

 

div#hs-eu-cookie-confirmation.can-use-gradients {
   background: #778899;
   border-bottom: none;
   box-shadow: 2px 2px 2px black;
   border-radius: 5px;
}

div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner p { font-family: sans-serif!important; } div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-confirmation-button {    background: #2d3e50!important;    border: none!important;    box-shadow: 2px 2px 1px black;    font-family: sans-serif!important;    transition: 0.2s ease;    -webkit-transition: 0.2s ease;    -moz-transition: 0.2s ease;    -o-transition: 0.2s ease;    -ms-transition: 0.2s ease; } div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-confirmation-button:hover {    box-shadow: 3px 3px 1px black;    transition: 0.2s ease;    -webkit-transition: 0.2s ease;    -moz-transition: 0.2s ease;    -o-transition: 0.2s ease;    -ms-transition: 0.2s ease; }

 

Screenshot 2018-05-08 11.56.48.png

 

And that’s it! Good luck

 

Useful Links

 

GDPR: https://www.hubspot.com/data-privacy/gdpr

 

CSS: 

https://developer.mozilla.org/en-US/docs/Web/CSS

https://css-tricks.com/ 

https://www.w3schools.com/

2 Solução aceitas
cbarley
Solução
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hi all,

 

Privacy policy customization won't need to be done through CSS soon! The beta for customization is out now. If you don't have it in your portal now, just keep an eye out for it. Here's a sneak peek of how it'll look: https://knowledge.hubspot.com/getting-started-with-hubspot-v2/how-to-customize-cookie-tracking-and-y...

Exibir solução no post original

cbarley
Solução
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hi @MartinSherv1 , welcome!

 

1. I don't have any examples, but you could certainly use some CSS to position it in the middle of the screen when visitors come to your site.

- Something like this should position it in the middle of the screen:

body div#hs-eu-cookie-confirmation {
    max-width: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%); 
    -ms-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    box-shadow: 4px 4px 15px black;
}

2. No examples here. The only fields that exist are the ones built into your Tracking Code Settings where you edit the copy and options for your privacy policy banner. We don't give flexible customization on this front.

Screenshot 2019-02-19 10.20.11.png

 

3. Yes. If you implement the tracking code into your own website via these instructions, contacts that opt to be tracked or not tracked based on what they click. There isn't a contact property that holds this information, but you'll see page views on that contact if they did opt in. Here are more in depth instructions: https://knowledge.hubspot.com/articles/kcs_article/reports/customize-your-cookie-tracking-settings-a...

 

Exibir solução no post original

39 Respostas 39
gil1001
Top colaborador(a)

HOW TO: Customize Your Privacy Policy Banner

resolver

@cbarley just tried the new feature and it messes up the banner design completely.

Ours now work fine, other than in IE (and yes, some of our customers still use IE).

0 Avaliação positiva
Siddall
Top colaborador(a)

HOW TO: Customize Your Privacy Policy Banner

resolver

 @cbarley - Is there any way to 'opt-in' to the beta?

0 Avaliação positiva
ShariM
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

HOW TO: Customize Your Privacy Policy Banner

resolver

@cbarley  

 

The description you linked to says that the notification can be "styled". However the options allow styling of the accent color. How do we change the BACKGROUND color of the pop up? It's currently white. We'd like to make it darker. 

 

Also, is there a way to show only the "accept" button and not the "decline" button? I tried to set it up with only accept but the system wasn't allowing that.

0 Avaliação positiva
cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hi @ShariM, as stated in the article you should be able to change the background color of the main container using the following code. For example, you can change the background of the banner to be pink by using:

 

<style> 
   /* Edit this section to change the main container of the banner including the background color */
   div#hs-eu-cookie-confirmation.can-use-gradients { 
      background: pink!important 
   }
</style>

 

The code will still work regardless of what you're trying to do. Almost anything can be styled using CSS - you'll just need to look at the boilerplate I've provided and apply the necessary styles there. If you don't want a decline button, that can be done in the settings by disabling "require opt in".

 

Hope this helps!

0 Avaliação positiva
ShariM
Colaborador(a) | Parceiro Platinum
Colaborador(a) | Parceiro Platinum

HOW TO: Customize Your Privacy Policy Banner

resolver

@cbarley Thanks. I can't seem to get it to work.

 

Question: does the cookies tool only work for COS hosted domains? The main part of the website is not hosted on Hubspot, only the landing pages and blog are, but I thought it would work like lead-flows does? It doesn't seem to be adding the cookies notification on the main domain.

0 Avaliação positiva
cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hi @ShariM, yes this styling would only work on your HubSpot hosted domains. The default styling is loaded in via JavaScript that loads on externally hosted domains, but those external domains to do not have permissions access to the site footers/headers from the HubSpot platform. You can still place your styles you've declared in your footer into the styelsheet or site footer that your external domain uses and your alterations should still work.

0 Avaliação positiva
Siddall
Top colaborador(a)

HOW TO: Customize Your Privacy Policy Banner

resolver

How do you add a hyperlink to your Privacy Policy in the banner?

cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hi @Siddall, you should be able to go to the cookies section when you're editing the text and click the little link icon in the editor. This should allow you to hyperlink.

 

I'm not aware of an active way to opt in, but many people already have this feature and I'd expect almost all portals to have this very soon, if not already.

Stewartbennett
Participante

HOW TO: Customize Your Privacy Policy Banner

resolver

Thanks @cbarley

 

I'm trying to work through this but no changes are happening to the cookie confirm button. 

 

I may have mis understood your instructions. This is what I've done. This code is pretty much what you have given me but the background is now #f0069b (pink).

 

Can you see where I may have gone wrong here:

Thanks,Stewart.Footer Cookie Style.PNG

0 Avaliação positiva
cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hi @Stewartbennett, if you can send over a page on which this cookie banner should show up, and your HubID, I can look into this a bit further for you 🙂

 

Connor

0 Avaliação positiva
Stewartbennett
Participante

HOW TO: Customize Your Privacy Policy Banner

resolver

The banner is showing throughout the site:http://www.activeprofile.co.uk/

HUB ID: 2498665

 

Thanks @cbarley

0 Avaliação positiva
MartinSherv1
Colaborador(a) | Parceiro Elite
Colaborador(a) | Parceiro Elite

HOW TO: Customize Your Privacy Policy Banner

resolver

Hey Stewart!

I am very new, and very much learning here.

As such, I'm checking out various approaches to cookie/privacy approaches and noticed your question. 
Please treat me as a (dumb) novice when I ask this, but I tested your website using an incognito window, declined your cookie policy, then looked at 'Inspect' - this is what I see: https://www.screencast.com/t/yLMsPJNngp i.e. there seems to be a Facebook cookie placed on my computer.  Should that be there? And if yes, could you let me know the nature of that cookie; and if no, do you know the reason it got triggered? 
As I say, keen to learn (myself and my wife are a new Hubspot partner).

Thanks, Martin (&Elisa)

0 Avaliação positiva
cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Ah @Stewartbennett - so in my example, I did not give the option to click the decline button, so the CSS IDs used for the decline and accept buttons are a little bit different. To target the background of that button, you'll just need this code :

<style>
div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-confirmation-button { background: #f0069b!important; }
</style>

That said, hopping into your portal it looks like your www. subdomain is not hosted on HubSpot. In order to change the banner for that domain, you'd need to place the code in the footer of whichever CMS you use. This styling I provided in this post would only apply to HubSpot hosted domains, but the general principals still apply.

0 Avaliação positiva
Stewartbennett
Participante

HOW TO: Customize Your Privacy Policy Banner

resolver

Just looked at one of my HS LPs and the style has changed. Either you did something or what I already had was working. Either way, thanks. 

 

I'll now need to populate this in WordPress and I should be good to go 🙂 

0 Avaliação positiva
cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hey @Stewartbennett, yup - I edited that code for you already so it was me haha! Good luck with implementing it on Wordpress too! 

0 Avaliação positiva
roisinkirby
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

This is terrific - thanks for sharing @cbarley!


@Grovewilks@djackouk@AlisonRenwick@Mela@GrandLedge@shearn I thought you might find this interesting!

0 Avaliação positiva
AlisonRenwick
Participante

HOW TO: Customize Your Privacy Policy Banner

resolver

Thanks @roisinkirby, I had already activated the banner, but my question was how can I create a list to record those who enter the website and click on the accept button of the banner?

0 Avaliação positiva
JillMalone
Membro

HOW TO: Customize Your Privacy Policy Banner

resolver

It would be awesome to be able to only show this visitors with an IP in the EU. Can you add this to the development list?

0 Avaliação positiva
cbarley
Alunos da HubSpot
Alunos da HubSpot

HOW TO: Customize Your Privacy Policy Banner

resolver

Hey Jill!

 

Thanks for the comment. I agree that could be a useful feature for some. The best way to get this in front of our Product Team's eyes is to create or upvote an idea in the Ideas Forum: https://community.hubspot.com/t5/HubSpot-Ideas/idb-p/HubSpot_Ideas/tab/most-kudoed

 

Thanks!

 

Connor