Reporting & Analytics

edjusten
HubSpot Employee
HubSpot Employee

Grab the Google UA code in the new GA4 format

While tooling around my HubSpot account over the weekend, I realized I had never added the Google Analytics (GA) integration to my account.  It’s a straight-forward process:

  • Set up a Google Analytics account
  • Create a web property in the account
  • Copy the UA code from the newly created property into HubSpot at the appropriate place

However, when I did this for my own account, the code looked something like G-XXXXXXXX rather than the more familiar UA-XXXXXXX. Further, when I plugged the code into my HubSpot page integration section, I was greeted with the ever-frustrating Invalid tracking ID error message.

 

Reaching back into GA, I looked in vain for anything that looked like the old familiar UA code, clicking in every link I could find in the interface, but came up empty-handed. 

 

What gives?

 

As it turns out, Google has updated the GA script, retooling it for apps as well as web pages. The process is now known as Google Analytics 4 (GA4), while the new tracking code format is called Measurement ID. This is the code that looks like this: G-XXXXXXX. 

 

Beginning in October 2020, all new web properties created in GA are created with the Measurement ID. The familiar UA-XXXXXXX code is not generated by default. But, as you might have surmised, HubSpot still requires the legacy UA-XXXXXXX format for integration. Has Google done away with the legacy UA code? 

 

Fear not fellow HubSpotters, it's still possible to access a UA code for use with HubSpot.

 

In order to generate a UA code, users will need to open the Advanced Options of the creation wizard when creating a new web property. The Advanced Options will include choices to create a UA code in addition to the new Measurement ID, or in lieu of the new code.

Screen Shot 2020-12-06 at 7.01.34 PM.png

Once the web property is created, the UA code will be available for copy-and-paste into HubSpot, same as before. 

 

FAQs

Can I add a UA code if the property was created after October 2020 without a UA code?

Once a property is created without a UA code, one can not be added. Instead, a new property must be created, accessing the Advanced Options during the process.

 

My customer added the UA code years ago. Will this update affect current GA tracking.

It will not. Any UA codes added prior to October 2020 remain functional in the same way.

 

Where can I find out more about this?

Check out the response from Carol Hill on this analyticshelp.io blog post.


Did my post help answer your query? Help the Community by marking it as a solution
4 Replies 4
fthemes
Contributor

Grab the Google UA code in the new GA4 format

Hi @donrua,

 

You need to paste the new GA4 code in the header or use GTM, to measure user activity.

 

FYI UA code will no longer process new data in standard properties beginning July 1, 2023. So switching over to a Google Analytics 4 property will be the best option.

 

For more details read here to learn how to GA4 on HubSpot website.

 

Hope this helps. Thanks.

donrua
Top Contributor

Grab the Google UA code in the new GA4 format

edjusten 
Thanks for the explanation, but I still have a question.
You describe how to create an additional UA based code during the GA4 property creation, as I understand it.

But if you then use a UA, a tracking code, in HS, rather than copy/paste the GA4 Measurement code in header, then will GA get the stream and info it needs to provide the enhanced measurement, or will you just be keeping the same analytics you already had with the original UA code?
I'm fearful of replacing the existing UA code with something new that breaks our continuity to previous tracking and views.



KamiSteven
Participant

Grab the Google UA code in the new GA4 format

Hey @FilipSoSe can you go over the steps you took to add the tracking via Google Tag Manager? We have the same challenge.

FilipSoSe
Participant

Grab the Google UA code in the new GA4 format

Thanks for this. Sadly we created a GA4 property already and cannot add UA now. I think the question would be, does Hubspot plan to add the integration via the G-XXXXXXXX soon? Also are we missing out on much by not connecting this? Thanks!

 

EDIT: We just added the tracking via Google Tag Manager so we're set although this would long term be nice to have 🙂