How to install the tracking code on a WordPress website

Last updated: October 10, 2017

Available For:

Marketing: Basic, Pro, Enterprise
Sales: N/A

To install the HubSpot tracking code on a WordPress site, install the HubSpot Tracking Code for WordPress plugin within your WordPress instance.

This allows you to install the HubSpot tracking code on your WordPress site without having to manually copy and paste the tracking code into your website HTML. The plugin also sets the content type of your WordPress pages so that you can filter between pages and posts in the page performance tool.

The HubSpot Tracking Code for WordPress plugin replaces the HubSpot for WordPress plugin. Unlike the older plugin, this plugin does not include various deprecated features and improves the reliability of plugin. Forms and CTAs should now be embedded directly in the WordPress editor. WordPress no longer transmits meta information such as publish date, comment count to page performance. 


  • Your website or blog must be using a install. The tracking code cannot be installed on sites, as they do not allow you to add plugins or Javascript.
  • You must have WordPress version 3.0 or higher installed on your sever (the latest version is recommended).
  • The wp_footer function must be included in your WordPress theme’s footer file (footer.php). This function is required for our tracking code to be installed on every page of your site.
  • You must be a WordPress admin to be able to install plugins for your site. If you are not the admin, you can forward these instructions to the person who manages your WordPress install.


Follow these instructions to install the HubSpot Tracking Code for WordPress plugin to begin tracking your WordPress site analytics in HubSpot.

Log in to your WordPress account

Log in to your WordPress instance. You can generally access the login screen by adding /wp-admin to your URL. 


Add new plugin

Hover over the Plugins menu item in the WordPress side menu and then click the Add New option.

Add new plugin

Search for the HubSpot plugin

Type HubSpot Tracking Code into the search field and click the Search Plugins button to search for the HubSpot plugin.

Search plugins

Install the plugin

Click Install Now to install the latest version of the HubSpot Tracking Code for WordPress plugin into your WordPress website.

Install plugin

Activate the plugin

Click the Activate Plugin link to activate the plugin for your WordPress website.

Activate plugin

You'll see a Plugin activated message to confirm that the plugin is active. Next you'll configure the plugin to work with your HubSpot account.


Edit plugin settings

Hover over the Settings menu item in the WordPress side menu and click the HubSpot Settings option.

HubSpot Settings

Enter your Hub ID

Enter your Hub ID and click Save Settings

Save settings

Verify the tracking code

To verify that the tracking code is working, follow these steps

Was this article helpful?

Table of contents

    Previous article:

    Next article: