Skip to content

Commit 0c65f57

Browse files
authored
Merge pull request #655 from citizensadvice/CP-944-How-tracking-in-the-energy-app-tools-work
CP-944 GA tracking in energy apps
2 parents 33687ff + 18b12b8 commit 0c65f57

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

docs/analytics.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,55 @@ Google Analytics 4 is added via Google Tag Manager and is loaded on all pages.
66

77
## Google Tag Manager
88

9-
[Google Tag Manager](https://developers.google.com/tag-platform/tag-manager/web) is loaded on all pages.
9+
[Google Tag Manager](https://developers.google.com/tag-platform/tag-manager/web) is loaded on all pages once a user has consented to analytics cookies.
1010

1111
There is a script loaded in the `<head>` at [shared/\_head_analytics.html.haml](../app/views/shared/_head_analytics.html.haml) and a `<noscript>` variant loaded in the `<body>` at [shared/\_google_tag_manager_no_script.html.haml](../app/views/shared/_google_tag_manager_no_script.html.haml).
12+
13+
## Analytics configuration by app
14+
### Energy Customer Service Ratings Table
15+
Special gtm classes have been added to certain elements in order to facilitate better analytics.
16+
17+
The inclusion of class `gtm-supplier-table-row` means that we can track how many users click on 'More details' for a specific supplier.
18+
19+
Class `gtm-select-unranked-supplier` allows us to track how many users search for an unranked supplier. We would not be able to track this behaviour without this class, as the unranked supplier information opens in the main supplier table page.
20+
21+
Finally, class `gtm-show-more-suppliers` allows us to track interactions with the 'Show more suppliers' button on the mobile view of the main supplier table page. By default only the top 5 suppliers are displayed on mobile view, and users can click 'Show more suppliers' if they want to see the full table.
22+
23+
No bespoke gtm events have been created for the CSR table.
24+
25+
### Appliance Calculator
26+
The appliance calculator uses custom GTM events to track user engagement with the tool. When debugging in GTM you should use the URL of the iframe i.e. `/appliance-calculator` rather than the advice collection in which it is embedded.
27+
28+
#### DataLayer Variables
29+
| Description | Event | Value | Example Values |
30+
|----------------------------------------|-------------------------------------|--------------------------------------------------|----------------------------------------------------------|
31+
| Next button clicked | `app_calc_next_button_click` | The name of the step on when clicked | `appliance`, `time_usage`, `cyclical_usage`, `unit_rate` |
32+
| Previous button clicked | `app_calc_previous_button_click` | The name of the step on when clicked | `appliance`, `time_usage`, `cyclical_usage`, `unit_rate` |
33+
| Add another appliance clicked | `app_calc_add_another_appliance` | Fixed text | `add_another_appliance_click` |
34+
| Clear list clicked | `app_calc_clear_list` | Fixed text | `clear_list_click` |
35+
| Most expensive appliance message shown | `app_calc_most_expensive_appliance` | The name of the appliance that is most expensive | `TEST _ Fan heater`, `TEST _ Tumble dryer (condenser)` |
36+
| Appliance added to the list | `app_calc_appliance_added` | The message shown in the green box | `TEST _ Fan heater added to the list below` |
37+
| An error is displayed | `app_calc_form_error` | The error message | `Select an appliance from the list` |
38+
39+
#### Analytics Reports
40+
An [exploration report has been set up to display appliance calculator data](https://analytics.google.com/analytics/web/#/analysis/p284911746/edit/Lf8bsW4-RDSKqB0-K7W2pg).
41+
42+
You can get to it from the main page by following: `Explore` > `Appliance Calculator`.
43+
44+
There are five tabs in the exploration:
45+
1. **Events** - shows total count of all of the tracked events, broken down by event.
46+
2. **Form navigation** - shows total number of `Next` and `Previous` button clicks, broken down by form step (see form url to step table below).
47+
3. **Errors** - lists all the unique error messages logged and count
48+
4. **Added appliances** - lists all the added appliances logged and count
49+
5. **Most expensive** - lists all the most expensive appliance messages displayed and count
50+
51+
##### Form url to step
52+
The exploration report only shows URLs. These can be converted into steps using the table below:
53+
54+
| URL | Step |
55+
|------------------------------------------------------------------------|------------------|
56+
| /appliance-calculator/daily_usage_creation/steps/appliance?no-js=false | Appliance |
57+
| /appliance-calculator/daily_usage_creation/steps/time_usage | Usage (time) |
58+
| /appliance-calculator/daily_usage_creation/steps/unit_rate | Unit rate |
59+
| /appliance-calculator/daily_usage_creation/steps/appliance | Appliance |
60+
| /appliance-calculator/daily_usage_creation/steps/cyclical_usage | Usage (cyclical) |

0 commit comments

Comments
 (0)