Open jsandlund opened 5 months ago
FYI @ClaireValdivia @TylerHendrickson Backlogged this ticket for consideration.
Creating a thread on Question #1:
Is there an existing instrumentation convention that should be used? If not, a couple fwiw thoughts on approaches:
I lean towards 2. I think the benefit of reducing the number of distinct events > the con of end users needing to filter events by properties. But just a thought :).
Notes from weekly:
DD advantages of GA
DD disadvantages:
DD cost not a factor, acceptably low. Benefit to consolidating tooling.
Next steps:
Next steps - Ty to add implementation steps to this issue for consistency in execution
@TylerHendrickson I updated the requirements based on the Tracking plan. Added definitions to clarify when the events should emit. Lmk if any of them need clarified. I didn't add custom properties to any of the events (e.g. "status_name", etc.). I think that's OK for v1: first see feature usage frequency (n times per User) and breadth (% of Users who use). If high, can then layer in more properties.
@ClaireValdivia @jsandlund Added implementation details for the ticket and spreadsheet in its current state. However, before this is moved to "Ready", I'd like to resolve outstanding comments on the tracking spreadsheet.
Also should note: all of these events are currently being captured in Datadog RUM. As noted in some of the spreadsheet comments, the event names diverge slightly.
Posterity edit: resolved!
User Story
Requirements Instrument the following actions on the GDP using GA4s Custom Events: https://support.google.com/analytics/answer/12229021?hl=en
Assets
Implementation Details
Modify the
GrantDetails.vue
view as follows:In
packages/client/src/helpers/gtag.js
, create a new functiongtagEvent(eventName, eventParams)
that wraps a call ofwindow.gtag('event', eventName, eventParams)
when the following conditions are true:window.gtag
is a functionwindow.APP_CONFIG?.GOOGLE_TAG_ID
is truthygtagConfig()
function, which is defined in the same file.eventName
and optional parameterseventParams
when GA is initialized.window.APP_CONFIG?.GOOGLE_ANALYTICS_DEBUG
is truthy, log the event name and any parameters to the console so that it is easy for developers to check how instrumented events are being emitted, e.g.Bonus points for firing this log even when the event itself was not emitted (because GA is disabled), but indicate whether that was/wasn't the case.
Make the
gtagEvent()
function available in thepackages/client/src/views/GrantDetails.vue
view view by mapping it to the view'sdata
option.In the same
GrantDetails.vue
view, add@click
(feel free to use different events if more appropriate) event handlers to the following elements (left side) that calls the newgtagEvent()
with the corresponding event (right side):Grants.gov btn clicked
Print btn clicked
Copy btn clicked
In the same
GrantDetails.vue
view file, adddata-dd-action-name
attributes to the following elements (left side) with the corresponding attribute values (right side):Print btn
Copy btn
Update the following
GrantDetails.vue
methods to callgtagEvent()
anddatadogRum.addAction()
as-follows:assignAgenciesToGrant()
assign team to grant
unassignAgenciesToGrant()
remove team assignment from grant
markGrantAsInterested()
, within thethis.selectedInterestedCode !== null
conditional blocksubmit team status for grant
{ status_name: statusName }
, wherestatusName
is derived by filtering thethis.interestedOptions
array for the entry with.id
matchingthis.selectedInterestedCode
(see code sample below)unmarkGrantAsInterested()
remove team status for grant
Relevant code samples
@click
handlermarkGrantAsInterested()
, given a selected Grant interested code, find its name: