CMS-General

Add code to the head or footer HTML of your pages

Last updated: January 24, 2019

Applies to:

Marketing Hub Professional, Enterprise
Legacy Marketing Hub Basic
HubSpot CMS

You may want to add snippets of code to the head or footer HTML of your pages for custom styling or tracking purposes. HubSpot allows you to add these custom HTML snippets, conversion or transaction tags, embed codes, and/or JavaScript tracking codes on specific pages or sitewide. Your code will be added within the head section and/or directly before the closing body tag of your page(s).

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

Add code to the head or footer HTML of a specific page

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

add-head-footer-html-page.gif

  • Click Update to apply your changes.

 

Add code to the head or footer HTML of all pages 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.
  • Click the Modifying dropdown menu and choose the domain you want to update.

Please note: when you add any code to the header or footer HTML for a specific domain, it will override code in header and footer HTML for All domains.

  • Enter your code into the Site header HTML or Site footer HTML section.

  • Click Save to apply your changes.