Please follow the directions noted below to integrate Google Analytics with your HubSpot Marketing account. Following the steps below will add your Google Analytics code to your HubSpot pages.
First, you will need to obtain your Google Analytics Tracking ID.
- Log into your Google Analytics account.
- Click the admin gear in the bottom left corner > select the desired domain to track under the Property dropdown > click on Tracking Code.
- On the following page, copy your Tracking ID.
After you have obtained your Google Analytics Tracking ID, return to HubSpot.
To apply your Google Analytics tracking code to all pages on all domains or all pages on a specific domain:
- Navigate in HubSpot Marketing to Content > Content Settings.
- Under Select a Domain to Edit, you can either select Default for All Domains to apply the Google Analytics code to all pages or select a particular domain so the code only applies to HubSpot pages using that domain.
- Scroll down to Google Analytics, and check off the box to Integrate with Google Analytics.
- Next, paste your Google Analytics Tracking ID.
In some instances, users have customized Google Analytics codes for other purposes. In the case you have a customized Google Analytics account, do not use the Tracking ID. Simply copy your Google Analytics Tracking Code instead and insert it in the the Site Header HTML section.
- Locate the Site Header HTML code box and paste the Google Analytics code into the box. Scroll down and click the Save changes button to finish.
Please note: if you've applied your code to all domains or your specific blog domain using the instructions above, your code will be applied to your blogs automatically. Only follow these instructions if you want your code to be applied only to a particular one of your blogs.
- Navigate to Content > Content Settings.
- Select Blog from the left-hand menu.
- Choose the blog to which you'd like to apply the Google Analytics tracking code from the Select a blog to modify dropdown.
- Scroll down to the Header HTML for Blog Listing Pages field and paste your Google Analytics tracking code into the box.
- To apply the code to your blog posts as well, check the Use same header HTML for blog posts box. If you use different code snippets for your listing pages and blog posts, leave the Use same header HTML for blog posts box unchecked, and paste the Google Analytics tracking code into the editor below labeled Header HTML for Blog Posts.
- Scroll down and click the Save changes button.
- Content > Landing Pages or Website Pages, locate the page in question and access it for editing.
- Under the Settings tab, paste the Tracking Code (not the Tracking ID) in the Head Section HTML section under Advanced Options. When ready, click on Publish/Update Page button to finish.