Skip to content

Commit

Permalink
Add tracking to SupportRequestForm (#223)
Browse files Browse the repository at this point in the history
* chore: added tracking id to SupportRequestFOrm (#221)

* chore: updated ga documentation (#221)
  • Loading branch information
jpaten authored Oct 17, 2024
1 parent e3de566 commit 51f9ad4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
24 changes: 17 additions & 7 deletions src/common/analytics/readme-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ See below a list of the currently available events.

### GA4 Event Inventory

| Event | Parameters | Description |
| ------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- |
| `bulk_download_requested` | `catalog`, `current_query`, `entity_type`, `index`, `tool_name` | Runs when the HCA-DCP "Request curl command" button is selected |
| `entity_selected` | `entity_name` | Runs when an entity (tab) is selected |
| `entity_table_paginated` | `entity_name`, `pagination_directed` | Runs when the page forward/backwards buttons are clicked |
| `entity_table_sorted` | `entity_name`, `column_name`, `sort_direction` | Runs each time a column in the entity table is sorted |
| `filter_selected` | `filter_name`, `filter_value` | Runs each time a filter is selected |
| Event | Parameters | Description |
| ------------------------- | ------------------------------------------------ | --------------------------------------------------------------- |
| `bulk_download_requested` | `catalog`, `current_query`, `index`, `tool_name` | Runs when the HCA-DCP "Request curl command" button is selected |
| `entity_selected` | `entity_name` | Runs when an entity (tab) is selected |
| `entity_table_paginated` | `entity_name`, `pagination_direction` | Runs when the page forward/backwards buttons are clicked |
| `entity_table_sorted` | `entity_name`, `column_name`, `sort_direction` | Runs each time a column in the entity table is sorted |
| `filter_selected` | `filter_name`, `filter_value` | Runs each time a filter is selected |

### Tracking-related ID Inventory

Some GA4 Events are tracked using ids instead of events. Below is an inventory of the ids that, when clicked, trigger an event:

| Component | Id name | "All Elements" or "Just Links"? | Purpose |
| -------------------- | -------------------------------- | ------------------------------- | ------------------------------------------- |
| `SupportRequestForm` | `button-support-request` | "All Elements" | To track submitted support requests |
| `ExportMethod` | The value passed as `trackingId` | "All Elements" | To separately track ExportMethod events |
| `ExportButton` | `button-cohort-export` | "Just Links" | To track clicks to the Cohort Export button |
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ export const SupportRequestForm = ({
submitting: false,
}));
setFormSubmitted(true); // Shows form submitted message.
// Execute GTM tracking.
// TODO(cc) add GTM tracking.
} catch (error) {
setFormState((formState) => ({
...formState,
Expand Down Expand Up @@ -249,6 +247,7 @@ export const SupportRequestForm = ({
disabled={Boolean(errors) || formState.submitting}
fullWidth
onClick={onSupportRequestSubmitted}
id="button-support-request"
>
Send
</ButtonPrimary>
Expand Down

0 comments on commit 51f9ad4

Please sign in to comment.