Event tracking analytics
There are many custom events we created to give us added insight into user behavior. They are listed and defined below. These were added at different times and the dates at which they started collecting data (or were turned off) can be deduced from Google Analytics with the date dimension. Some events are implemented globally and some are implemented at a page-level, weâll identify which are such below.
Event hooks conventions
If a specific query selector is needed to attach an event create a new classname with a js- prefix. Using that only for javascript event attachment makes it obvious to a developer only concerned with layout that they are affecting javascript when they are modifying HTML.
Accordion clicks - global
These events are attached to any of our accordion elements, which can be on any page.
Category | Action | Label | Notes |
---|---|---|---|
âclickâ | âaccordionâ | accordion header string | for current reporting |
âaccordionâ | âclickâ | accordion header string | for historical reporting |
Is this page useful - global
We have a widget in the footer that asks users Is this page useful? We send events to Google Analytics when they click Yes or No. The comments are collected separately in a database outside of Google Analytics. The Yes/No button clicks event data is:
Category | Action | Label |
---|---|---|
âratingâ | âhelpfulâ | âyesâ or ânoâ |
Offsite links - global
We record when a user clicks on a link that send them to a URL thatâs not on our site (for example, https://www.cdc.gov/coronavirus/2019-ncov/vaccines/safety.html).
Category | Action | Label |
---|---|---|
âclickâ | âoffsiteâ | âurlâ |
PDF links - global
We record when a user clicks on a PDF link.
Category | Action | Label |
---|---|---|
âclickâ | âpdfâ | âurlâ |
Search - global
We record the search terms people use to see if we need to create more quick answer content. The got_quick_answers and no_quick_answers actions are used to show when a search query finds one or more quick answers.
Category | Action | Label |
---|---|---|
âsearchâ | âgot_quick_answersâ | search terms |
âsearchâ | âno_quick_answersâ | search terms |
Surveys - global
We track several events related to inviting users to take surveys like the survey prompt display, selecting on the button to take the survey, or dismissing the prompt.
Category | Action | Label |
---|---|---|
âsurveyâ | âclickâ | âsurveyDisplayâ |
âsurveyâ | âclickâ | âopenSurveyâ |
âsurveyâ | âclickâ | âdismissSurveyâ |
Home - page-level
When we redesigned and relaunched the homepage we began tracking several elements to understand what was prime real estate and what information users wanted.
Category | Action | Label |
---|---|---|
âclickâ | âhomepage-tracking covidâ | âurlâ |
âclickâ | âhomepage-hero textâ | âurlâ |
âclickâ | âhomepage-alerts sectionâ | âurlâ |
âclickâ | âhomepage-want to knowâ | âurlâ |
âclickâ | âhomepage-footerâ | âurlâ |
âclickâ | âhomepage-menuâ | âurlâ |
âclickâ | âhomepage-videoâ | âurlâ |
âclickâ | âhomepage-latest newsâ | âurl or âview moreââ |
âscrollâ | âscroll-25â | âscroll-25-homepageâ |
âscrollâ | âscroll-50â | âscroll-50-homepageâ |
âscrollâ | âscroll-75â | âscroll-75-homepageâ |
âscrollâ | âscroll-90â | âscroll-90-homepageâ |
Safer Economy (Blueprint) - page-level
When we launched the Blueprint for a Safer Economy page we wanted to track how users interacted with the whatâs open search box. If the user selected county is (not set) that means they did not select a county and are looking at acitivity statuses statewide. Similarly, if the user-selected activity is (not set) that means they are looking at all activities rather than a specific one.
Category | Action | Label |
---|---|---|
âactivity-statusâ | â{user-selected-county}â or â(not set)â | â{user-selected-activity}â or â(not set)â |
Equity - page-level
When we launched the equity page we wanted to track how users interacted with the page and chart data.
Category | Action | Label |
---|---|---|
âactivity-statusâ | âcounty-selectâ | â{user-selected-county}â |
âclickâ | âtab-selectâ | âchart-nameâ |
âscrollâ | âscroll-25â | âscroll-25-equityâ |
âscrollâ | âscroll-50â | âscroll-50-equityâ |
âscrollâ | âscroll-75â | âscroll-75-equityâ |
âscrollâ | âscroll-90â | âscroll-90-equityâ |
âscrollâ | âchart-in-viewâ | âchart-nameâ |
CTA
We are tracking some call to action links with custom events. There is javascript tracking code that will look for the cta data attribute and apply a click listener that fires a custom event so you can instrument links as follows:
Example:
<a href="https://myturn.ca.gov/" class="link-arrow-blue text-center" data-tracking-action="cta" data-tracking-label="$15 million">
<div class="link-arrow-label">GET VAXED TO WIN</div>
<cagov-arrow></cagov-arrow>
</a>
The important parts are:
- data-tracking-action=âctaâ
This should be the same on every link. The string cta needs to be used for the javascript event assignment to find the link. This will fire a custom event on click with an action value of cta and a category value of click.
- data-tracking-label="$15 million"
This value should be set to the string you want to show up in google analytics as the event label value.