So you’ve just signed up for HubSpot and have a blog or website that’s hosted on WordPress, you want to make sure the two platforms are “talking” to each other. You want to be sure that HubSpot is accurately tracking your visitors so that you have access to all of HubSpot’s analytics, even when your site is hosted externally. Thankfully you don’t have to be a web guru to set this up.
If you’ve tried to set up tracking by installing a plugin, but you still can’t see page visits on any of your WordPress site pages within the HubSpot page performance tool, it’s likely due to one of two problems. Lucky for you, they’re easy to troubleshoot!
Fix #1: Make Sure You’ve Installed the Latest HubSpot Plugin
The most likely culprit is you’ve got an outdated version of the HubSpot for WordPress plugin installed. The plugin automatically installs your HubSpot tracking code on all of your WordPress pages without you having to dive into the code yourself. If you are using the “HubSpot for WordPress,” that is an old (no longer supported) plugin that may be causing your issue.
To get the most recent version, in your WordPress dashboard, navigate to Plugins >Add New, then Search Plugins for “HubSpot.”
The plugin you’ll want to install is HubSpot Tracking Code for WordPress, by HubSpotDev:
Once installed, this will appear in your Installed Plugins list. Go to this list and click “Activate” to start using the plugin:
Once activated, click on Settings under the plugin and enter your HubID on the next page:
That’s it! Now wait 24-48 hours to give HubSpot a chance to crawl these new pages. After a day or two, check your Page Performance report in HubSpot to confirm that HubSpot is finding your WordPress pages.
If these pages still aren’t coming up, it’s time for Plan B.
Fix #2: Add the HubSpot Tracking Code Manually to Your Site or Blog Template
If you have an older version of WordPress (4.3 or older), it’s possible the new HubSpot plugin won’t solve this problem (the plugin is not supported on older versions of WordPress). If that’s the case, you will have to manually enter in the HTML tracking code yourself.
Don’t panic; you don’t need a degree in computer science for this, all you’ll be doing is copying and pasting the code.
First, grab the tracking code from HubSpot.
Login to HubSpot and navigate to Reports > Report Settings. The first box up top contains your tracking code:
Copy all of this text.
Second, find the right template to paste this into WordPress.
Now comes the “tricky” part. Log into WordPress and go to the template editor by clicking Appearance > Editor. Here you’ll see all of the themes installed on your WordPress account (whether you’re currently using them on your live site or not).
Make sure you’re editing the theme that is currently live on your site (you can select which theme to edit in the right hand column):
Underneath Templates under “Select theme to edit” you’ll see the list of all of the templates that are used in your site. Find the template for the Footer, the bar or links that occur across the bottom of every page of your website (most likely called Footer (footer.php)). This is the easiest place to paste in the code so it automatically gets added to every site page.
Within the editor for the footer code, scroll down to the bottom until you see a </body> tag.
Paste the HubSpot tracking code right above the </body> tag. It should now look like this:
The only thing you need to watch out for is that you are pasting the entire tracking code, which starts with <!-- Start of Async HubSpot Analytics Code --> and ends with <!-- End of Async HubSpot Analytics Code -->. If you miss even one of the “<” characters at the beginning or the end, it will not work!
Click “Update File” at the bottom of the page to save the updated footer template.
And that’s all there is to it! Just a quick copy and paste, nothing scary. Again, you may have to wait up to 48 hours for HubSpot to recrawl your site and see the updated code. But after a day or two, you should be able to see some of your WordPress pages with data in the HubSpot page performance tool.
Now you are prepared to go forth and harness HubSpot’s analytical prowess for WordPress. Way to go you savvy HubSpot integrator, you.