Connecting Google Analytics to your website in HubSpot CMS is all about generating a small piece of code in Google Analytics first, and then use this code in your HubSpot account. So you'll able to track your website performance easily. Let's handle this in two parts to make it easier to follow.
Part I: Get your Google Analytics code
- Login your Google Analytics console and click Admin to go to your administration panel.
- There you'll see a blue Create Property button. Just click it to start creating your property. At the end of this process, you'll have a single line of code in your hand. We'll use this code in our HubSpot account to make the connection between Google Analytics and our website in HubSpot.
- Now we're in Create property screen. Write a name for your property and click Next.
- In the second step, you'll see a couple of information fields to fill. These are optional. You can leave them blank if you wish, but filling them helps you to compare your website's performance with other websites in the same industry. You can click the Create button to complete this step.
- Now we need to choose our platform. Select Web here.
- Finally, we add our website's URL in the following screen and give it a name. Now click the Create stream button to get your Google Analytics code.
- A window including some information will appear. All you need to do is copying the measurement ID by clicking the copy icon right next to it. This code is the one that we'll use in our HubSpot account.
Now we have our Google Analytics code (measurement ID) in our hand. All we need to do is inserting this code into a text field in HubSpot.
Part II: Use your code in HubSpot
- Now login to your HubSpot account and click the gear icon at the top right menu. This will take you to the Settings page.
- Navigate to Website > Pages from the left hand panel.
- Choose your domain that you want to connect with Google Analytics from the top part of the page. This must be the same URL with the one you wrote while creating the property in Part I, step 6.
- Next, switch to Integrations tab and check the Integrate with Google Analytics 4 box. A text field will appear. Paste the Google Analytics code (measurement ID) you've copied before into this field.
- Once you edit this text field, you'll see that a bar will appear from the bottom of your screen. Hit Save button over there to make your changes take affect.
Congratulations! You have succesfully connected Google Analytics to your website in HubSpot now and soon you'll view your website statistics in Google Analytics console. Keep in mind that Google may require a couple of hours to start collecting data from your website.
Don't hesitate to use the comments section below for your questions!