Landing Pages
Website Pages

Add code to the head or footer HTML of your pages

Last updated: July 15, 2020

Applies to:

Marketing Hub  Professional, Enterprise
CMS Hub  Professional, Enterprise
Legacy Marketing Hub Basic

You may want to add snippets of code to the header HTML or footer HTML of your website for custom styling or tracking purposes. HubSpot allows you to add code snippets to a specific page or blog post. You can also update your account settings to add code snippets to all pages and blog posts hosted on a specific domain. 

Please note: if you're embedding code from an external source, review the embed instructions to determine where the code should be added to your page header, footer, or in the body of your page. Learn how to add your Google Analytics code in your account settings.

Add code snippets to a specific page or blog post

  • In your HubSpot account, navigate to your blog, landing pages, or website pages.
  • Hover over the page and click Edit
  • In the page editor, click the Settings tab. 
  • Click Advanced Options to access the Advanced Code Snippets section and enter your code into the Head HTML or Footer HTML field.

    Please note: you'll only have access to the Head HTML field for individual blog posts.

add-head-footer-html-page.gif

  • Click Update to publish your changes.

Add code to the head or footer HTML of all pages and blogs hosted on a specific domain

Please note: if you add code to the head or footer HTML of a specific domain, code added to Default settings for all domains will not apply to the specific domain.

  • In your HubSpot account, click the settings icon settings in the main navigation bar.
  • In the left sidebar menu, navigate to Website > Pages.
  • In the upper left, click the Choose a domain to edit its settings dropdown menu to select the domain you want to update settings for. 
  • Add your code snippets to the header or footer HTML of all pages and blog posts hosted on the selected domains.
    1. Site header HTML 
    2. Site footer HTML

  • Click Save to apply your changes.
/cos-general/how-can-i-add-code-snippets-to-the-head-and-footer-html-of-my-pages