Skip to content
Landing Pages

Add code to the head or footer HTML of HubSpot content

Last updated: August 3, 2021

Applies to:

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

You can add code snippets to the head or footer HTML for a specific page or blog post in the content editor. 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 whether the code should be added to the head, body, or footer HTML of your site. 

Add code snippets to a specific page or post

  • Navigate to your content:

    • Website Pages: In your HubSpot account, navigate to Marketing > Website > Website Pages.
    • Landing Pages: In your HubSpot account, navigate to Marketing > Landing Pages.
    • Blog: In your HubSpot account, navigate to Marketing > Website > Blog.
  • Hover over your content and click Edit
  • In the content editor, click the Settings tab, then click Advanced options
  • In the Additional code snippets section, enter your code snippet into the Head HTML or Footer HTML field.

Please note: the footer HTML field is not available in the blog post editor. 


  • In the top right, click Update to publish your changes.

Add code snippets to all content hosted on a 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 and select a domain. To apply the same code to all HubSpot-hosted content, select Default settings for all domains
  • To edit the header or footer for a specific domain, click Override default settings in the Site Header HTML or Site Footer HTML section. Code added to the default settings will no longer apply to this domain's content. 
  • To revert a specific domain's header or footer HTML to the Default settings for all domains instead, click Apply default settings
  • Enter your code snippets
  • In the bottom left, click Save to apply your changes.