How do I install the HubSpot tracking code on a WordPress site without the plugin?

Last updated: May 15, 2017

Available For:

Marketing: Free, Starter, Basic, Pro, Enterprise
Sales: Free, Professional

While it is recommended that you use the HubSpot tracking code for WordPress plugin, you can alternatively install the tracking code manually. If you manually add the tracking code and are a HubSpot Marketing Basic, Pro, or Enterprise user, HubSpot will not be able to differentiate posts versus pages in its reporting.

For websites hosted on

If your website is hosted on, you will not be able to add the HubSpot tracking code to your website. WordPress does not allow users to add any JavaScript code to sites because it is a shared environment.


For websites hosted on

1. Copy the HubSpot tracking code

  • Copy your HubSpot tracking code by following the instructions here.

2. Install the tracking code on your WordPress site

  • Log into your WordPress account, navigate to Appearance > Editor in the left sidebar.
Wordpress Editor
Click on the Footer (footer.php) file in the right sidebar.
Wordpress footer file
Paste your HubSpot tracking code immediately above the </body> tag.
Tracking Code in Wordpress
Click Update File.

Was this article helpful?