Support for Google Analytics 4 Now Available in ArcGIS Hub

3959
11
12-07-2022 08:57 AM
SydneyBohn
Esri Contributor
5 11 3,959

Howdy Hubbers!

The Hub team is excited to announce that we will be releasing support for configuring Hub sites with Google Analytics 4 (GA4) measurement IDs today (December 7, 2022)!

Hub’s new GA4 configuration option will be available alongside the legacy Universal Analytics (UA) Google Analytics configuration option that already exists in Hub sites today. Site editors will be able to configure both UA & GA4 tracking on the same site to facilitate migration efforts ahead of Google's planned deprecation of Universal Analytics in July 2023.

In early 2023, we will share additional information and guidance for site owners regarding Hub's deprecation of Universal Analytics configuration support.

 

Curious about Google Analytics?

If you're not already familiar, Google Analytics allows you to collect anonymous tracking data that can help answer questions like: How is my Hub site performing alongside my other websites How are people finding my Hub site? Are they visiting from a desktop computer or a mobile device? What are the most common keywords people are using to search? What datasets are being downloaded?

While answering these questions has been possible with UA tracking, configuring your Hub site to use Google Analytics 4  will make answering these questions and finding useful insights much easier.

 

Getting Started

First, make sure you have a Google Analytics account. Check with your website administrator or your marketing team if you’re unsure. If you don’t already have an account, consider signing up—it’s free and easy to get up and running.

If you’ve already upgraded to Google Analytics 4, you will use your Measurement ID. The Measurement ID can be found in the Admin. section of your analytics page under Data Streams and Measurement ID. Copy this number to your clipboard. It should look something like this: G-XXXXXXXXXX.

For additional guidance on creating Google Analytics 4 properties, refer to Google’s documentation.

 

Adding Google Analytics 4 to Hub Sites

To add Google Analytics 4 to your Hub site, simply launch your site in edit mode, open the Customize side panel and navigate to Settings > Tracking & Consent, enable the Google Analytics (GA4) toggle, and paste in your measurement ID. Once the measurement ID is added, save and publish the site for the changes to take effect on your live site. 

chrome_jbQPgPV3mw.png

 

Adding a consent message is optional and up to site owners. It’s important to check with your organization’s policies for data collection. Remember all the data you collect with Google Analytics is anonymous, there is no personally identifiable information collected.

chrome_tUB7APQz25.png

 

You’ll know it’s working when you see the information for your site such as page titles/URLs, page views, and events in your Google Analytics account.

chrome_fICWYbxNnU.png

 

Not seeing any metrics yet? Don’t worry, over the next few days check back in as metrics accrue, and make sure you have the tracking date range set to overlap with when you added it to your site.

 

Important functionality notes

The Hub team is working to provide updated documentation on Google Analytics 4 support, but in the meantime, here are some important details for site owners to keep in mind when configuring GA 4 measurement IDs:

  • Sites will support having both UA and GA4-based tracking configured on the same site.
  • Site owners can continue to configure their sites with new Universal Analytics tracking IDs for the time being and existing UA configurations will continue to function until Google retires Universal Analytics in July 2023. We will share plans for deprecating the Hub UA configuration option in early 2023.
  • To receive the most accurate page view counts, we recommend disabling the "Enhanced measurement" setting in Google Analytics when creating a GA4 property for use within a Hub site. Leaving this setting enabled may lead to double-counted page views due to a conflict with the way that Hub separately enumerates site and page views.

 

P.S. If your organization doesn’t use Google Analytics, don’t fret! The Hub team is actively working on incorporating support for additional analytics providers such as Adobe Analytics and SiteImprove. We’ll be sharing more details on these updates in the near future, so stay tuned!

 

Let us know what you think!

11 Comments
Trippetoe
Occasional Contributor III

Thanks for implementing the GA4 functionality and getting this info out to us. I do want to clarify your last bullet point --- do not enable "Enhanced Measurement".  My understanding of GA4 is a bit like having a handful of sand (it's always slipping away from me), but if i understand correctly, without 'Enhanced Measurements' the only stats we will get in GA4 are the 'Automatically tracked events'

  • first_session
  • session_start
  • user_engagement

Is that correct?

AndreaC
New Contributor II

I added a GA4 measurement ID to my site about two weeks ago, but Google reports that the data is not flowing. Has anyone else run into this issue? If so, any tips for fixing the problem?

HungGi
by
New Contributor III

Hi @AndreaC , have you added (installed) the google tag on each of your page? We're using ArcGIS Hub for our opendata site and what I've done is added an empty Text card (box) at the top of each site where we need to track stats. Go in the text card and edit in HTML "</> Edit in HTML", then paste the Google Tag that you get from Google Analytics. Keep in mind to replace G-########## with your key.

"Below is the Google tag for this account. Copy and paste it in the code of every page of your website, immediately after the <head> element. Don’t add more than one Google tag to each page."

 

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-##########"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-##########');
</script>

 

 

If you can't find the above script, on the main page of Google Analytics, click on the 4 small square icon on the right beside your username and select Tag Manager.

From there, click on the Google Tag tab and search for and then click on your tag name. Click on Installtation instructions.

Click on the Install manually tab and you should be presented with something that looks similar to what i've written above.

Google's instructions is available in the post under the "Getting Started" section.

Hope this helps!

Edited: Looks like this step was not necessary at all. I went back into the site and have removed the tags I've added to each page and GA is still tracking.

AndreaC
New Contributor II

Hi @HungGi ,

Thanks for your response. No, I haven't added the tag to each page. I was under the impression that the Open Data site would do that for me after I added the Measurement ID in the settings (like it does for the UA ID).

AndreaC_0-1686682328491.png

Does the GA4 ID in settings do anything or should I remove it?

Thanks,

Andrea

Trippetoe
Occasional Contributor III

Hi @AndreaC 

Our group has been using GA4 in three different hub sites without issue. We followed the directions outlined in this post and have been receiving GA input since enabling it. We did not add the GA4 tag to individual pages. 

I can't speak as to why your setup is not working, but i'm pretty sure you add the Measurement ID in the 'Tracking and Consent' section like in your screen cap and not per page.

Is your UA tag getting data?

AndreaC
New Contributor II

Good news, GA4 is now working with the Measurement ID. I believe the problem was that I saved the change, but didn't publish it. Lesson learned.

HungGi
by
New Contributor III

@Trippetoe interesting you didn't have to add in the script tag for each page.

For some reason i had to do that. Do you have both UA and G4A enabled on your site?

Trippetoe
Occasional Contributor III

Hello @HungGi 

Yes - we have both UA and GA4 enabled on all our Hub sites although i suspect that could break July 1 when Google shuts down UA.  

I'd reach out to Esri tech support and @SydneyBohn - she's the Hub + GA4 guru at Esri. It doesn't seem right that you'd have to manually add the tag to each page. My thinking is that Hub does that behind the scenes for us.

HungGi
by
New Contributor III

@Trippetoe thanks. I did go through and removed the tags i've added to the site and looks like GA is still being captured.

Must have been something that i did that initially when trying to setup the GA4.

AJ_devaccount
Occasional Contributor

@SydneyBohn  are we supposed to have turned off Enhanced measurement for UA as well? Because my page views is much higher in UA compared to GA4.

ChelseaDickerson1
New Contributor II

I have GA4 enabled on my hub site, however there's a conflict between number of Views reported via Esri's "Usage" tab and GA4. 

  • Esri reports 2,850 views during a 7-day period.
  • GA4 reports 236 views during that same 7-day period.

I do not know if "Enhanced Measurement" is enabled or not, however, your statement about "Enhanced Measurement" implies counts in GA4 would be higher if left enabled, so I am not sure that is the issue here. That's a massive discrepancy, and I am wondering if Esri is including internal views of the hub site by organizational members, while GA4 strictly counts public user views. Thoughts? 🙂

About the Author
Hi friends! My name is Sydney and I'm a Product Engineer for ArcGIS Hub and Enterprise Sites. I've been with Esri since 2017 and have been a Hub enthusiast for just as long. If you want to talk Hub sites, I'm your gal! I love traveling, cats, maps, and all the weird things in life.