Set up Squarespace to obtain user consent

To capture valuable insights while protecting user privacy, you need to collect consent from your website users. We recommend you use a Consent Management Platform (CMP) or work with your Content Management System (CMS) to collect consent and send it to Google.
 

Set up a consent banner

Follow the instructions below if you are using the built-in Google Analytics integration. If you are using Google Ads through code injection, there is an additional step that requires consent mode. Scroll down to learn more.

Enter your Google Analytics ID

  1. In your Squarespace site home panel, click Settings.
  2. Click Developer Tools.
  3. Click External API Keys.
  4. In the Google Analytics field, enter your measurement ID.
  5. Click Save.

Enable the cookie banner

  1. In your Squarespace site home panel, click Website.
  2. Click Website Tools.
  3. Click Cookies & Visitor Data.
  4. Toggle “Cookie Banner” to On.

Configure cookie banner settings

  1. In your Squarespace site home panel, select the Opt In and Out banner style under “Cookie Banner Type”. This gives your website visitors the choice to either accept or decline.Note: When you select this banner style, the “Disable Analytics Cookies” toggle will always be switched to “On”. This prevents non-essential Squarespace Analytics or Google Analytics cookies from dropping until your visitor accepts cookies.
  2. Click Save.

Edit your cookie banner text (optional)

  1. In your Squarespace site home panel, click Website.
  2. Click Website Tools.
  3. Click Cookies & Visitor Data
  4. In the “Cookies & Visitor Data” panel, click Customize. Under the “Disclaimer Text”, you may want to customize the text to describe your use of Google Ads.
  5. Click Save in the top panel.

Set up consent mode

If you are using Google Ads through code injection, please follow this additional step to enable consent mode.

Read and set consent in the injected code 

  1. In your Squarespace site home panel, click Website.
  2. Click Website Tools.
  3. Click Code Injection. If you have an existing Google Ads code snippet in this field, insert the following code snippet before the Google Ads snippet.
  4. In the header section, enter the following code:

<script>

// Consent mode default

window.dataLayer = window.dataLayer || [];

function gtag() { dataLayer.push(arguments); }

gtag('consent', 'default', {

  'ad_storage': 'denied',

  'ad_user_data': 'denied',

  'ad_personalization': 'denied'

});

 

let squarespaceCookies = {};

if (window.getSquarespaceCookies) {

  squarespaceCookies = window.getSquarespaceCookies();

}

const consentValue = squarespaceCookies.marketing === 'accepted' ? 'granted' : 'denied';

const consentObj = {

  'ad_storage': consentValue,

  'ad_user_data': consentValue,

  'ad_personalization': consentValue

};

gtag('consent', 'update', consentObj);

 

window.onCookieBannerInteraction = () => {

  let squarespaceCookies = {};

  if (window.getSquarespaceCookies) {

    squarespaceCookies = window.getSquarespaceCookies();

  }

  const consentValue = squarespaceCookies.marketing === 'accepted' ? 'granted' : 'denied';

  const consentObj = {

    'ad_storage': consentValue,

    'ad_user_data': consentValue,

    'ad_personalization': consentValue

  };

  gtag('consent', 'update', consentObj);

}

</script>

<!--Include your Google Ads snippet code below this line. It should look similar to the snippet below.-->

<script async src="https://googletagmanager.com/gtag/js?id=AW-{AW-ID}"></script>

Was this helpful?

How can we improve it?
true
Achieve your advertising goals today!

Attend our Performance Max Masterclass, a livestream workshop session bringing together industry and Google ads PMax experts.

Register now

Search
Clear search
Close search
Google apps
Main menu
6581202509538654748
true
Search Help Center
true
true
true
true
true
73067
false
false
false