How to install HubSpot Tracking Code in your WordPress Website

Brian Bojan Dordevic
About The Author

Brian Decoded

President at Alpha Efficiency

Join me at the forefront of web design and digital marketing innovation. I am obsessed with web design, business philosophy and marketing performance.
I write Conversion Insider newsletter.

Are you looking to supercharge your WordPress website and boost inbound marketing capabilities with a HubSpot tracking code? This article will show you how to easily install HubSpot tracking code on your WordPress website, giving you access to powerful marketing and analytics tools to help grow your business. Whether a beginner or an experienced WordPress user, this step-by-step guide will help you successfully utilize the HubSpot WordPress combination.

From installing the Hubspot WordPress plugin to manually implementing tracking code, our digital marketing experts will help you choose the best approach. You’ll be able to boost business growth potential by gathering valuable data on your WordPress site visitors’ behavior. So let’s get started!

Table of Contents:

Adding Hubspot tracking code WordPress site is a great way to keep track of your website visitors' behaviors and gain valuable insights.

What is a HubSpot tracking code, and how can it help you improve your inbound marketing strategy?

HubSpot tracking code is a piece of JavaScript you can add to your website to enable tracking visitors’ activity. This tracking code allows HubSpot to collect information about how visitors interact with your website. Some of the valuable data you’ll be able to collect after you add the tracking code include the following:

  • Pages that people visit the most 
  • Amount of time visitors spend on each product landing page
  • Insight into the actions that people take while on your website
  • Locations of your website visitors
  • Demographics

You can then use this information to improve the user experience on your website and identify any potential problems hindering its performance. Additionally, you can use HubSpot tracking code to track the effectiveness of your marketing campaigns. And by learning more about visitors’ locations and demographics, you’ll be able to create targeted marketing campaigns that are more likely to succeed. 

The tracking code is typically installed on every page of a website, and it works by collecting data and sending it to the HubSpot platform, where it is analyzed and used to create reports, and other valuable information businesses need to polish their inbound marketing strategy and increase revenue growth. For example, it can help remove obstacles preventing you from getting more contact form submissions.

However, when choosing a content management system, many business owners face Hubspot CMS vs. WordPress dilemma. If you decide to host your pages on Hubspot, you’ll automatically gain access to this CMS’s page performance tool. You’ll get a unique tracking code for your Hubspot account, which you can then copy and implement within the HTML code for each page.

But those who opt for WordPress, due to the limitless opportunities for customization that this platform offers, also look for ways to oil their web marketing machine with some powerful Hubspot features. In the rest of this article, we’ll show you how to access HubSpot’s page performance tool if you are a WordPress user.

How to add HubSpot tracking code to the WordPress site?

There are two ways to add HubSpot tracking code to the WordPress website:

  • By using a HubSpot WordPress plugin
  • Manually, without using a plugin

Let’s explore both approaches to help you find the best solution for your situation.

A simple way to add tracking code by using a HubSpot WordPress plugin

The easiest way for Hubspot tracking code WordPress implementation is installing a HubSpot – CRM, Email Marketing, Live Chat WordPress plugin. This plugin will automatically install tracking code to your WordPress site.

Follow these steps if you want to install the plugin directly from your WordPress account:

  1. Access your WordPress admin dashboard
  2. Navigate to Plugins>Add New
  3. In the search bar, type in “Hubspot-CRM, Email Marketing, Live Chat, Forms & Analytics.”
  4. Click on the Install Now button
  5. Once the installation is complete, it’s time to click Activate Plugin
  6. Navigate to the HubSpot plugin that appeared in the left sidebar menu
  7. You can now log in to your HubSpot account; keep in mind that if you don’t have one yet, you’ll need to create it

Following the steps above, you’ll also integrate Hubspot marketing software with WordPress. You’ll be able to access other free tools by logging in to your HubSpot account on their official website.

However, to be able to install the Hubspot WordPress plugin, you’ll need to meet these requirements:

  • You must use a WordPress Business plan or WordPress.org install for your website. Other plans don’t allow you to install plugins or implement JavaScript, which is necessary for integrating Hubspot with WordPress.
  • Your WordPress version must match the plugin requirements listed on the plugin page.
  • Only super admins can install this plugin.
  • You’ll need to allow third-party cookies and remove any extensions that block them in your browser.

If you don’t meet any of these requirements, don’t despair. There is still hope to add a Hubspot tracking code to your WordPress site.

Manually adding Hubspot tracking code to the WordPress site is possible, and it's useful if you don't want to use any plugin.

Manual approach: Where do I put the HubSpot tracking code on my website?

We recommend entirely integrating HubSpot marketing software with WordPress, as the guide above allows you to add tracking code faster and gain access to other tools. However, we understand that some website owners want to keep the number of installed plugins on their WordPress site to a minimum. If you are one of them, or you ran into a problem while trying to install the HubSpot WordPress plugin, there is still a solution to adding tracking code. You’ll need to do it manually. So let’s see how to get the HubSpot tracking code and where to put it on your WordPress website.

First, you’ll need to copy the tracking code in your HubSpot account:

  1. Once you log in to your HubSpot account, navigate to Settings.
  2. Find Tracking & Analytics settings.
  3. Click on the Tracking Code option.
  4. Find the Embed Code section, and then click on Copy. Note that if you hire our web development company in Chicago, you can send the tracking code directly to us by clicking on the Email to my web developer button.

But the job is not done yet. Now you need to install the tracking code to your WordPress site manually:

  1. Upon logging in to our WordPress account, navigate to Appearance>Editor
  2. A list of theme files will appear on the right side; choose Footer
  3. Paste the tracking code that you copied earlier, and then click on the Update file option

That’s it! You’ve successfully installed the HubSpot tracking code in WordPress. However, remember that if you’re on HubSpot’s Marketing Hub plan, this marketing software won’t make the difference between your posts and pages when analyzing your website.

How do I check if my HubSpot tracking code is working?

After installing the HubSpot tracking code, it should start collecting helpful information for your business. However, if you don’t see any results, it is crucial to ensure that you have installed it correctly. Luckily, checking your HubSpot tracking code is relatively straightforward. You need to:

  1. Click on your HubSpot account name and verify your Hub ID
  2. Open your web page, and right-click anywhere on it
  3. Choose View page source
  4. Search for your Hub ID. You can use Ctrl + F / Cmd + F to make the process quicker.
  5. If the Hubspot tracking code appears there, it’s essential to check if it has been copied and pasted correctly. 
  6. If you can’t find your tracking code, follow the steps above to install it.

If everything looks good, you need to confirm your tracking code firing:

  1. Right-click anywhere on your web page, and then click Inspect Element
  2. Navigate to the Network tab
  3. Look for your Hub ID
  4. There should be a JavaScript element in the Name section
  5. In the Status column, you should be able to see 200 OK or 304 Not Modified

If you can’t find JavaScript code, you probably have a problem with tracking code firing. In this case, it is best to contact HubSpot directly or consult with your web development agency.

Need professional help?

Are you a business owner looking to unlock HubSpot’s and WordPress’s full potential? You can leave all the technical details to us. Alpha Efficiency’s experienced developers will ensure a smooth Hubspot to WordPress integration process, so you can start making data-driven decisions and connecting with our audience in yet unexplored ways.

Check our WordPress enterprise development services if you are looking for ways to secure a top-class performance for your website.

If you’re ready to take the next step, schedule a call and introduce us to your business.


Fresh inspiration is a fingertip away,
Download Our Portfolio.

Download Our Portfolio