Project

General

Profile

Actions

Design/UX #15210

open

Google Analytics improvements

Added by Colin McDonald almost 3 years ago. Updated over 2 years ago.

Status:
New
Priority name:
Normal
Assignee:
Category name:
Analytics
Target version:
Start date:
2022-01-21
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

Sara's asked how she can see how often users are clicking on links in the various parts of the public/private new homepage. I'm not sure our Google Analytics (GA) setup is configured for this currently, and I pretty quickly hit my own knowledge and implementation limits on it so wanted to throw it to the dev team here.

If I understand correctly, we need to use the new GA-4 (as opposed to Universal Analytics or UA, see #13511) features to do this. I also believe we'll need to set up Events that recognize clicks in different areas of the page. I took a stab below at outlining the different sections. From here though, I'm a bit out of my depth. I think this is more of a challenge due to the dynamic nature of the link lists -- the URL of the link is actually less important, for these purposes, than if I clicked on it in My Sites or Activity From My Campus or wherever. It may matter that most of these links may not technically be "outbound" by GA's definition because they're still on the commons.gc.edu domain, but that's unclear to me too.

I'm not sure if we could tie different GA-4 events via CSS class to these sections or something similar, or if we need to append additional CSS or other code to structure this correctly. I also assume we'll be inserting more GA-4 code into the site, whether it makes sense to do that manually or via the Google Tag Manager service seemingly offered for things like this. GA-4 collects general events like all 'clicks' automatically, but nothing more granular without customization:

https://support.google.com/analytics/answer/9234069?hl=en&ref_topic=9756175

I'm also not really sure of the best way to track clicks on the more universal parts of the site, like the header (nav) and footer. There used to be a Chrome extension that was half-decent at this, but Google stopped supporting/updating that in 2019.

I think I'll leave it here for now, in the hopes that Boone/Ray/Jeremy have some experience to bear here, or can at least pick up the more technical parts of this thread. Let me know what else I can do to help steer and describe this.

One last thing - Sara would also like to be able to see how often the People page filters are being used, and which aspects are the most popular. I believe we set up something like this in #11760, but I'm not sure if it's still functional or how to find it in our Analytics dashboard.

Distinct Sections to Track Clicks, public homepage:
- Register / Login / Learn More top blade
- Latest News
- Featured Sites
- Active Sites
- Featured Groups
- Active Groups
- Members

Distinct Sections to Track Clicks, private homepage:
- Under-avatar links
- My Sites
- My Groups
- Latest News
- Shortcuts (by URL might be helpful here)
- CUNY-Wide Activity
- Campus Activity
- Featured Groups
- Groups Across CUNY
- Campus Groups
- Featured Sites
- Sites Across CUNY
- Campus Sites
- Members Across CUNY
- Campus Members


Files

explore-path.png (448 KB) explore-path.png Colin McDonald, 2022-02-02 02:04 PM
Actions #1

Updated by Boone Gorges almost 3 years ago

  • Category name set to Analytics

As noted, we previously collected certain information about nav clicks, as well as directory filter clicks. See https://redmine.gc.cuny.edu/issues/10229#note-6, #11760.

We migrated to GA4 as part of #13511. It appears that these custom params probably stopped being collected around that time. The structure for custom events changed in ways that I do not understand.

I've tried to follow some of the guidelines provided by Google on migrating custom events to GA4. I've put a test in place for main-nav clicks and will monitor over the upcoming days https://github.com/cuny-academic-commons/cac/commit/7eb4a5930c4f072b0d51ba2ea58ec1d987db5e5a. See https://developers.google.com/analytics/devguides/migration/measurement/events, https://support.google.com/analytics/answer/10075209?visit_id=637786348250600608-2555019247&rd=1

I'll have to check again in a few days to see whether this is being tracked. If not, I'm helpful that Ray or Jeremy will be able to chime in with some technical thoughts - I've spent an hour wading through blog posts and docs, and I have less understanding of the situation than I did before I started.

One last thing - Sara would also like to be able to see how often the People page filters are being used, and which aspects are the most popular. I believe we set up something like this in #11760, but I'm not sure if it's still functional or how to find it in our Analytics dashboard.

I can't seem to find any of this info in Analytics, so I guess we don't have it. If we can confirm that my test migration works, I'll migrate the rest of the events, and we'll report any data we collect over the next few weeks.

Actions #2

Updated by Boone Gorges almost 3 years ago

  • Target version set to 1.19.3
Actions #3

Updated by Matt Gold almost 3 years ago

Thank you for the time you've spent on this, Boone. If needed, we can seek out a meeting with a rep from the GA team, but let's see how things go.

Actions #4

Updated by Raymond Hoh almost 3 years ago

I've put a test in place for main-nav clicks and will monitor over the upcoming days https://github.com/cuny-academic-commons/cac/commit/7eb4a5930c4f072b0d51ba2ea58ec1d987db5e5a. See https://developers.google.com/analytics/devguides/migration/measurement/events, https://support.google.com/analytics/answer/10075209?visit_id=637786348250600608-2555019247&rd=1

Slightly-related, the cac-bp-nelo JS file was not being enqueued on the homepage, so Google Analytics events for users clicking on the main nav from the homepage were missed.

I caused this during some optimizing work to reduce homepage asset-loading in #14909. I've just added back the cac-bp-nelo JS file so it is enqueued on all pages now in https://github.com/cuny-academic-commons/cac/commit/96cb20fbc52da6e2aa01addb03d2a4c0a90b8607. This is also deployed on production.

Actions #5

Updated by Boone Gorges almost 3 years ago

In https://github.com/cuny-academic-commons/cac/commit/efdb5a39e700fdc4207d4251b66789938b895081 I've added a bunch of click events to the GA4 config. It now covers the following:

- Main navigation clicks
- Various uses of all filters (searches and checkboxes) across the four main directories (Groups, Sites, People, Courses)
- Directory tabs, like 'My Groups', 'All Groups'

There are many ways to slice up this data and I'm not confident that I've chosen the proper one, but perhaps we'll have better insight in a couple days, once data starts rolling in and we can pull some reports.

Actions #6

Updated by Colin McDonald almost 3 years ago

Many thanks, Boone. I'm seeing data on all three of these coming through. The main nav one is pretty clear.

The directory filter one seems to be broken up by individual filter, which is good, and you can see which options are being chosen within that filter (like individual campus names). I'm trying to figure out how to track which filters are being used the most overall, though, as the Event Count and Total Users seem to be the same across all of them. Maybe the key is the "(not set)" item for each, suggesting that the filters that "aren't set" the most often are the least used? Maybe clear enough, but making sure.

I'm not sure what the directory tab one is tracking, though. Sorry if I'm missing something obvious there. I'm seeing parameters like blogs-personal, groups-personal, blogs-following, members-all... thanks for clariftying.

Actions #7

Updated by Boone Gorges almost 3 years ago

I'm not sure what the directory tab one is tracking, though. Sorry if I'm missing something obvious there. I'm seeing parameters like blogs-personal, groups-personal, blogs-following, members-all... thanks for clariftying.

These are the tabs at the top of the directories. 'blogs-personal' is 'My Sites' on the Sites directory. 'groups-personal' is the 'My Groups' tab on the Groups directory, etc.

Maybe the key is the "(not set)" item for each, suggesting that the filters that "aren't set" the most often are the least used? Maybe clear enough, but making sure.

I guess it's set up in such a way that each event is sent for each filter. I didn't mean to do it this way, but in any case, just subtract the (not set) value from the total in each category to get a sense of what you're looking at.

Actions #8

Updated by Colin McDonald almost 3 years ago

Hi Boone, I figured out the directory tab one, sorry about my slow uptake there. I also spent some time in the GA4 Explore section to see if I could get the path data we discussed on yesterday's call.

See attached. I can easily enough set up a path report to see where users' next click is once they arrive on the homepage, and there is useful info. Other than the top nav items being clicked, I can see people clicking on blog posts, the register button, etc. But lower down, it gets really granular because each unique URL (i.e. for each unique group or site) is listed separately.

We could try and parse on our own which of these are groups/sites/etc, and which would be in the Featured section or the other sections, but that will likely be tedious and only go so far. It would help if we could somehow group individual links together based on the section on the page in which they appeared and were then clicked on. It's probably not this easy, but can we do this with something like CSS selector tracking via Google Tag Manager and then set up separate events in Analytics, kind of like what's discussed here?

https://www.analyticsmania.com/post/how-to-track-events-with-google-analytics-4-and-google-tag-manager/

Is there also a way we can think of to parse whether a user is on the public or logged-in homepage?

Actions #9

Updated by Boone Gorges almost 3 years ago

We could try and parse on our own which of these are groups/sites/etc, and which would be in the Featured section or the other sections, but that will likely be tedious and only go so far. It would help if we could somehow group individual links together based on the section on the page in which they appeared and were then clicked on. It's probably not this easy, but can we do this with something like CSS selector tracking via Google Tag Manager and then set up separate events in Analytics, kind of like what's discussed here?

Can you outline exactly what you're trying to track? Do you want to know "someone clicked a link in the Groups section"? Or "someone clicked a link in the Featured Groups section"? Or "someone clicked the first link in the Featured Groups section"? If I understand the level of granularity you're trying to achieve, I can make some recommendations about implementation.

I see that Google Tag Manager has all sorts of tools for using CSS collectors to create dimensions, etc. I find it totally bewildering, but if you don't, then you have my blessing to go ahead and set it up. Some of the metrics I describe in the previous paragraph can almost certainly be set up using the CSS selectors that are already there, or if you need specific ones on the links themselves, I can add that too. If, on the other hand, you are as confused by all of this as I am, then I'll just write more custom events in JavaScript as I have with other dimensions described in this ticket.

Is there also a way we can think of to parse whether a user is on the public or logged-in homepage?

In the past, we added a custom dimension to all hits indicating logged-in status. See #4518. It appears that this was not ported to the GA4 implementation. I've just done so in https://github.com/cuny-academic-commons/cac/commit/8858579ffa9b8b30842d3a945e3d349e0af53631. I pushed this to production and set up the isUserLoggedIn dimension in the GA interface. Let's see if this starts collecting data, and if it's useful for you.

Actions #10

Updated by Boone Gorges almost 3 years ago

  • Target version changed from 1.19.3 to 1.19.4
Actions #11

Updated by Boone Gorges almost 3 years ago

  • Target version changed from 1.19.4 to 1.19.5
Actions #12

Updated by Colin McDonald almost 3 years ago

Hi Boone, sorry about my delayed reply here. First off, the isUserLoggedIn dimension seems to be coming in just fine now, so we can parse data based on logged-in or not status. Sara, let me know if you want to take a look at that.

And regarding the other tracking and Google Tag Manager complexities, I've been reading up on it a little and am game to give it a try if you can give me GTM access for the Commons at my account. I hasten to add that I'm not certain I can get this going on my own right now, but I'd like to give it a try. If I can do it and lay out the steps for any future tracking needs, perhaps it will be more versatile and direct than the custom JavaScript event route. But I'll test and see with that access, if that's ok. Thanks!

Actions #13

Updated by Boone Gorges almost 3 years ago

Sounds good, Colin. I've set up GTM and have sent you an invite.

Actions #14

Updated by Boone Gorges over 2 years ago

  • Target version changed from 1.19.5 to 1.19.6
Actions #15

Updated by Boone Gorges over 2 years ago

  • Target version changed from 1.19.6 to 1.19.7
Actions #16

Updated by Boone Gorges over 2 years ago

  • Target version changed from 1.19.7 to 1.19.8
Actions #17

Updated by Boone Gorges over 2 years ago

  • Target version changed from 1.19.8 to 1.19.9
Actions #18

Updated by Boone Gorges over 2 years ago

  • Target version changed from 1.19.9 to 1.19.10
Actions #19

Updated by Boone Gorges over 2 years ago

  • Target version changed from 1.19.10 to Not tracked
Actions

Also available in: Atom PDF