General instructions for a non-HubSpot hosted website
If you don't use a content management system, like WordPress or Joomla, follow these steps to install the tracking code on your website.
1. Assign this task to someone on your team
- If you DO have access to the HTML of your website (or to your content management system) you can complete the steps below yourself.
- If you DO NOT have access to your website's HTML, email the URL of this article to your IT department or web developer.
2. Go to your Reports Settings
In your HubSpot Marketing account, navigate to Reports > Reports Settings.
Copy the tracking code provided in your account by using the Copy to clipboard button, or by highlighting the code and using the copy function of your keyboard.
Paste the code immediately before the
</body> tag in the HTML code of each page of your site. Here's what the code would look just before the tag in an HTML code view of a page:
Most content management systems and IT departments have a way to batch-upload a piece of code to all pages of your site. Sometimes this comes in the form of a footer file that is referenced across all pages. If you don’t have access to your content management system, send these instructions to the person who does.
5. Verify that the code installation worked
To verify your tracking code is working, please follow the instructions listed here.
How to install the tracking code on a WordPress website
To install the HubSpot tracking code on a WordPress site, install the HubSpot Tracking Code for WordPress plugin, within your WordPress instance.
What does the plugin do?
- Installs the HubSpot tracking code on your WordPress site.
- Sets content type for filtering between pages and posts in the Page Performance tool.
- Creates contacts with Lifecycle Stage of Subscriber when non-HubSpot forms are filled out on the site.
- 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.
1. 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.
2. Add new plugin
Hover over the Plugins menu item in the WordPress side menu and then click on the Add New option.
3. 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.
4. Install the plugin
Click on the Install Now link to install the latest version of the HubSpot Tracking Code for WordPress plugin into your WordPress website.
5. Activate the plugin
Click the Activate Plugin link to activate the plugin for your WordPress website.
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.
6. Edit plugin settings
Hover over the Settings menu item in the WordPress side menu and click the HubSpot Settings option.
7. Enter your Hub ID
Enter your Hub ID and click Save Settings.
8. Verify the tracking code
To verify that the tracking code is working, follow these steps.