Installing Your HubSpot Tracking Code & Page Testing

In this video, we're going to talk about the HubSpot tracking code, adding it to your site, testing it to make sure it's working and other little tech tidbits that you need to know. Are you ready to get nerdy with all the data and lead intelligence that you ever wanted or needed? Then hey, you know what time it is.

About the Expert

George B. Thomas

George B. Thomas is an Inbound Marketing Marketer, Video Jedi and HubSpot Certified Trainer with more than 25 years of sales and marketing experience. He leads the Impulse Creative crew in HubSpot certifications with 19 including Inbound, Email, Contextual, and Content Marketing.

George utilizes his love of teaching and learning to help companies find their way to growth via workshops, speaking engagements, business audits, and of course, Sprocket Talk.


Full Transcript

In this video, we're going to talk about the HubSpot tracking code, adding it to your site, testing it to make sure it's working and other little tech tidbits that you need to know. Are you ready to get nerdy with all the data and lead intelligence that you ever wanted or needed? Then hey, you know what time it is.

Are you a HubSpot user looking for fun and interactive education that helps you be better at HubSpot? Then Welcome to Sprocket Talk.,

That's right; it's your boy George B. Thomas from bring you yet another HubSpot educational video brought to you by the amazing team over at Impulse Creative.

If you're a sales, marketing, or service professional looking to learn more about HubSpot and those inbound strategies to grow your business, guess what? You're in the right spot. Make sure you subscribe, keep learning more, and use the comment section below to ask us all the inbound and HubSpot questions you may have. Now let's get into the good stuff.

The HubSpot tracking code is a unique code for each HubSpot account. Allows HubSpot to monitor your website traffic as well as hooking into tools like HubSpot CTAs, forms, and HubSpot conversations. Your HubSpot tracking code is automatically included on HubSpot blog posts, landing pages, and CMS Hub website pages. In other words, if you use the HubSpot tools, tracking is already in place for you.

Thanks, HubSpot.

However, if you have any externally hosted pages, i.e., pages not on HubSpot, CMS blog tool, or landing pages tool, you must I mean you must install the HubSpot tracking code manually to capture analytics for those pages. And listen, we all want analytics for those pages.

Now there are two ways that you can do this. First, let's talk to all of you out there who are not WordPress users for you. It's all about copying your HubSpot tracking code and getting it in the right place for your website. Now don't worry, it's not too technically challenging, but let's get into it in your HubSpot account. Click the Settings icon settings In the main navigation bar, then navigate to your reports and analytics and tracking settings.

Only accounts and free CRM accounts navigate the tracking code in the left sidebar menu in the marketing starter. In the embed code section, click copy or click the email to my web developer to send the tracking code to the team member who will be installing it on your site. Or, if that's you, then continue to your website for the installation process.

Now don't break out into a sweat because to install the tracking code, paste the code before the closing body tag in HTML code for each page of your site. Now with most content management systems, you or your developer can install the code to all pages on your website, such as a footer file or a header file. This file is typically referenced across all your site pages. Check with your developers on how you can help you, or you may need to dig into more in-depth documentation. Now once you've installed the tracking code, it's time to test to make sure it's working on all your pages. We'll talk about that in a few minutes.

But first, Let's get all those WordPress users up to speed with their HubSpot tracking code. To install the HubSpot tracking code on WordPress, we're going to install the HubSpot plugin. Yep, it's that easy peasy. Let's take a look.

Alright, so once you're in your WordPress admin area, you're going to go to plugins, and once in plugins, you can hit add new.

Now here you can search for HubSpot. And you're going to see the HubSpot CRM, email marketing, live chat forms, and analytics plugin by HubSpot. And we're going to go and hit install now. Once it's installed, we can hit activate. If you're not logged in, it is going to ask you to log in with your suggested account. And there you go, your tracking code is installed with your plugin, and you can see all the different tools that you now have access to right inside your WordPress portal as well as the analytics being pulled into your HubSpot accounts.

Pretty simple right now if you're using another CMS like Shopify, Drupal, Magento, Joomla, Or Wix, we have links below to help you in your specific scenarios, check the links below. Once you get your tracking code in place, It is now time to test it. Let's take a look at how easy that is, and while it's easy, make sure you test your code. Test your code.

So to test your code, we're going to go ahead and head over to the website. Once you're at the website, we're going to right-click, and we're going to go ahead and view page source. Now don't freak out or break out into a cold sweat. You don't need 90% of this; you're going to hit Command or Ctrl F, and then you're going to search your portal ID. So you will need to know your portal ID. Once you type that in, you're going to see this JS.HubSpot or HS scripts your portal ID, and you know that it is working on this page. Now I would suggest that you test several pages. Once you've tested several pages and know that it's working across the board, you are good to go with your HubSpot tracking code.

A couple of pro tips to pay attention to along the way. You should not, and I repeat, you should not install multiple HubSpot tracking codes on one page. If there are multiple HubSpot tracking codes installed, the first one to load on the page will fire any subsequent In other words; secondary HubSpot tracking codes will not be loaded, so it doesn't work. Please don't do it; only use one tracking code.

If you're using a single page application, check out the developer's documentation over at to set up tracking again. The link is listed below for you. And finally, the tracking code is not supported on amp sites, so it doesn't work on amp sites.

Now that you have the tracking code in place enjoy all the lead intelligence data and HubSpot tools, now your sales, marketing, and service fingertips.

Hey, Sprocketeer did you like this video then make sure you subscribe to the channel and hit that bell for instant notifications so that we know that you're part of the Sprocket Talk community. Head over to sprockettalk.comm for more actionable and tactical HubSpot user resources. It's been an absolute pleasure, but until next time when we meet in the next video, make sure you're focused on being a happy, helpful, humble, human. And as always, make sure you're doing some happy HubSpotting.