How to Install the HubSpot Tracking Code in WordPress
Back to articles

How to Install the HubSpot Tracking Code in WordPress

Sam Banks, Fuelius' Technical Digital Strategist, runs through how to add a HubSpot tracking code in WordPress. Watch the video or follow the guide below...

Hub: All
Difficulty: Easy
Tier: Free/Starter+

HubSpot Tracking Code and CMS

This guide will run through the process of how to install the HotSpot tracking code onto an external CMS, in this instance, WordPress, although the overall process is very much the same for most CMS that are out there.

If you need to find out how to install the tracking code on other CMS, you can visit HubSpot's Knowledge Base for additional support.

N.B. It's important to note - if you're using the HubSpot CMS or you're creating landing pages, website pages, or blog posts with the HubSpot tool, the tracking code is automatically applied. This guide is only relevant if you're creating content in any external systems or tools. 

Adding the Tracking Code

To start, load up your HubSpot instance and head to the top right where there is a Settings icon.

From here, what we want to do is head down the left-hand side down to Tracking Analytics and then the Tracking Code section.

Here you will be presented with the embed code for copying or, alternatively, for emailing it to a Web Developer so that they can install it for you.

1-2

Once you've got your tracking code copied, you can then copy your Hub ID to be used with the WordPress plugin which we’ll come to later.

Once you've got your code copied, simply head over to your CMS to input it. Within WordPress, head down to Plugins and Add New and then search for HubSpot in the directory and then press Install. Once this is installed, you can then Activate it in the CMS.

Now that the plugin is active within the account, you can head over to Install Plugins where you will head to the settings of his plugin. We can then connect the HubSpot portal with WordPress.

2-2

If for whatever reason the HubSpot plugin is not working, there is an alternative route for installing the tracking code, and to start this process, you will head over to Appearance.

Within Appearance, head down to the Theme Editor which will take you into the Theme Section.

Depending on how your WordPress is built, you should have a footer file that sits on this right-hand side. Simply select that and then paste this code in between the closing tags within the footer as well. 

3-2

Once the tracking code has been placed within the footer, simply update your footer file. Either process is fine for setting up the tracking code - there is no right or wrong way of doing it, you may just find that the plugin process is easier.

If you're looking for further HubSpot support, our team would ❤️ to help you out! Book a call with us today.