Add code to the head or footer HTML of HubSpot content
Last updated: November 4, 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: not all accounts will be able to edit the head and footer HTML for individual pages and posts or across domains. The specific editing options for different types of content available depend on your HubSpot subscription.
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
Please note: code snippets added at the domain level will not affect knowledge base articles.
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.
Related content
-
Set up single sign-on (SSO) to access private content
Single sign-on (SSO) is a way to log into different applications securely with one username and password. ...
Knowledge Base -
Understand the source of a page's styling
There are multiple places where content styling can be added in HubSpot, and it is applied in a specific...
Knowledge Base -
Insert and manage anchor links
By creating an anchor on a specific part of a page, blog post, or knowledge base article, you can add a link...
Knowledge Base