CMS-General

Add code to the head or footer HTML of your pages

Last updated: September 11, 2018

Applies to:

Marketing Hub
marketing-basic-pro-enterprise
Basic, Professional, Enterprise

Sometimes, 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 Javacript 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).

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

  • In your HubSpot account, navigate to landing pages or website pages.
  • Hover over the page you'd like to edit, then click Edit
  • Within 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.
  • On the left sidebar menu, navigate to Website > Pages.
  • Use the Modifying dropdown menu to choose the domain you'd to update.

Please note: you can choose specific domains if you want to add code to one domain but not another you have in HubSpot. If you do add any code within the header or footer HTML for a specific domain, it will override any code you have placed 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.

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 to your HubSpot pages.

Was this article helpful?

If you still need help you can get answers from the , or to contact support.