Skip to content
Landing Pages

Add code to the head or footer HTML of HubSpot content

Last updated: June 15, 2022

Applies to:

All products and plans

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. 

Before you begin, review the embed instructions for any external code snippets to determine whether they should be added to the head, body, or footer HTML of your content. 

Please note: for CMS Hub Starter accounts, code snippets can only be added to the head and footer HTML of website pages, not landing pages. 

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. 


edit-head-and-footer-html-for-a-page

  • 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 settings icon 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. 

edit-site-header-html

Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.