Skip to content

Scan for and block cookies on HubSpot pages (BETA)

Last updated: November 30, 2022

In Beta

Applies to:

All products and plans

The cookie scanning feature uses a web scraper to locate all cookies on a specific domain or subdomain. Popular cookies will be automatically categorized and described, while all other cookies can be categorized and described manually. 

After a domain has been scanned, you can block specific cookies. This will stop these cookies from being dropped on a visitor's device until they consent to them via HubSpot's cookie banner

Please note: cookie scanning and blocking only works with the native HubSpot cookie banner. If you're using an external cookie banner, you'll need to manage HubSpot cookies with a custom solution, such as using the cookie banner API or custom CSS/JavaScript. Some cookie banners may also offer integrations through the App Marketplace, such as Cookiebot

Scan cookies

You can scan any domain that is either hosted on HubSpot or has the HubSpot tracking code installed. 

Please note: when scanning for cookies, each page of your website will be loaded once. To avoid a temporary spike in traffic tracking platforms like Google Analytics, you can allowlist the following IP range: CIDR :

  • In your HubSpot account, navigate to Marketing > Website > Cookie Scanning.
  • To scan an external domain for the first time:  
    • In the top right, click Add external domain
    • In the dialog box, enter the external subdomain and domain, then click Add domain.  
    • In the top right, click Scan now
    • In the dialog box, click Request scan. You will receive an email when the scan is complete. 
  • To scan an internal domain or an external domain that's been scanned previously:
    • Next to a connected subdomain, click Scan now to scan it for cookies. 
    • In the dialog box, click Request scan. You will receive an email when the scan is complete. 
  • Once the scan is complete, any cookies that appear on the scanned subdomain will be displayed, along with their provider, category, description, and time until expiration. 


  • To edit a cookie's description, click its name. In the right panel, enter a new description, then click Save
  • To export a list of all cookies for a domain, click Export [number of] cookies above the table. In the dialog box, click the File format dropdown menu and select a spreadsheet format, then click Export.  

If you receive a scanning error, please make sure the following requirements are met: 

  • The domain is connected to HubSpot OR has the HubSpot tracking code installed. 
  • The domain has a home page, i.e. there is a live page located at the domain's root URL. For example, if your domain is, then would need to be a live page. 
  • A substantial number of non-test pages are published on the domain. 

Analyze errors in the cookie scanner

You may encounter errors while scanning your domain for cookies. The table below explains the errors in detail and the steps needed to resolve:

Error description Steps to resolve

There was a problem crawling the domain "". The crawler couldn't find a homepage at "".

Add a homepage to your website and try again. 

There was a problem scanning the domain at "".  Scan your domain again. 
There was a problem scanning the domain because an external cookie banner was found on the site. The Cookie Scanner can’t scan domains with cookie banners created outside of HubSpot. Replace all cookie banners on your website created by an external tool, and scan your domain again. 
The crawler didn’t find any URLs at this domain “” to scan. The domain provided doesn’t have any URLs. Please contact HubSpot Support for help.
The crawler couldn’t verify your external domain.  The crawler couldn’t find the HubSpot tracking code on your external domain. Ensure it's been added and scan again.

Block cookies

Once you've scanned a domain, you can block some or all of its scanned cookies from dropping. This will stop the elements associated with those cookies from loading until the visitor has offered their consent through your HubSpot cookie banner, including: scripts, images, audio & video files, embedded content, and iframes. 

There are some limitations to the blocking process: 

  • Cookie scanning and blocking only works with the native HubSpot cookie banner. It is not compatible with an external or custom cookie banner. 
  • Anonymous page views will continue to be captured by the HubSpot tracking code
  • A single page element that contains cookies from different categories won't load unless the visitor has accepted all associated categories.
  • Uncategorized cookies will only drop if a visitor accepts all cookies.

Please note: you can add the HTML attribute data-hs-ignore to any necessary website elements that are being incorrectly blocked by the cookie scanner.

Block cookies across a HubSpot-hosted domain

  • In your HubSpot account, navigate to Marketing > Website > Cookie Scanning.
  • If you have multiple connected domains, click the dropdown menu in the top left and select a domain.
  • For unscanned subdomains, click Scan now next to the subdomain to scan it for cookies, then wait for the scan to finish.
  • With the scan complete, click the domain name. You'll then be brought to the cookie details page for that domain.
  • In the top right, click Manage cookie blocking.
  • In the dialog box, click Turn on cookie blocking. If cookie blocking has already been turned on, you can click Turn off cookie blocking to turn it off for this domain instead.


Block cookies on individual pages or external domains

  • In your HubSpot account, navigate to Marketing > Website > Cookie Scanning.
  • If you have multiple connected domains, click the dropdown menu in the top left and select a domain.
  • Scan the domain for cookies.
  • Copy the following blocking script:

<!-- Start of HubSpot Cookie Blocking Code -->
<script type="application/javascript" id="hs-cookie-banner-scan" data-hs-allowed="true" src="/_hcms/cookie-banner/auto-blocking.js?portalId={YOUR_PORTAL_ID}&domain={SCANNED_DOMAIN_AS_SEEN_IN_THE_UI}"></script>
<!-- End of HubSpot Cookie Blocking Code -->

  • Paste the script at the top of the head HTML of the content where you want to block cookies.
  • Replace YOUR_PORTAL_ID with the Hub ID of your account and SCANNED_DOMAIN_AS_SEEN_IN_THE_UI with the domain at the top of the cookie scanning page.
  • Save and publish your changes.

Understand cookie categories

Popular cookies are divided into categories automatically based on their function. All cookies can have a category manually set or changed, except those flagged as necessary.

The following cookie categories are available:

  • Necessary: these cookies are necessary for the website to function and cannot be switched off. Learn more about necessary cookies.
  • Analytics: these cookies collect information and report site usage statistics. Analytics cookies can also work with advertising cookies to show relevant ads and measure interactions. Learn more about analytics cookies.
  • Functionality: these cookies optimize the website's functioning. They can also be used to personalize the visitor's experience and store chat history. Learn more about functionality cookies.
  • Advertisement: these cookies use data from third-party ad providers like Facebook and Google to display relevant ads and report on ad campaign performance. Learn more about advertisement cookies.