Commit 0e86fed
authored
[Analytics] Track install and error events (#1984)
This PR will track which plugins and themes were installed during boot
from a Blueprint, by sending a `installTheme` and `installPlugin`
events.
An `error` event will be sent if Playground experiences a boot or PHP
request error.
All events are sent to Google Analytics and don't contain any personal
data information.
`InstallTheme` and `InstallPlugin` events will include the resource type
and the theme/plugin slug if the resource type is WordPress.org.
`Error` events will only send an error `source` which can be:
- `bootSiteClient` - error occurred during boot.
- `request` - a PHP or SQL error occurred during a PHP request.
- `unknown` - for request errors that don't have a source. This
shouldn't happen but we still want to catch it to confirm it's not
happening in practice.
The purpose of the `error` event is to provide insights into how
frequently users experience issues.
It's not intended for logging or debugging.
Fixes
[#1778](#1778)
## Testing Instructions (or ideally a Blueprint)
- The easiest way to see events is to add a `console.log` before this
line
https://github.com/WordPress/wordpress-playground/blob/acea593bc551aac14aebd982333be592ee4b298c/packages/playground/website/src/lib/tracking.ts#L26
- Open this link to
[http://127.0.0.1:5400/website-server/?plugin=friends&theme=twentytwentythree](http://127.0.0.1:5400/website-server/?plugin=friends&theme=twentytwentythree)
- Confirm that a `installPlugin` and `installTheme` install event were
sent with the slug and correct resource type
- Open this link to [install a plugin from a git
resource.](http://127.0.0.1:5400/website-server/#{%22steps%22:%20[{%20%22step%22:%20%22installPlugin%22,%20%22pluginData%22:%20{%20%22resource%22:%20%22git:directory%22,%20%22url%22:%20%22https://github.com/WordPress/block-development-examples%22,%20%22ref%22:%20%22HEAD%22,%20%22path%22:%20%22plugins/data-basics-59c8f8%22%20},%20%22options%22:%20{%20%22activate%22:%20true%20}%20}]})
- Confirm that a `installPlugin` event was sent with the correct
resource type
- Open this link
[http://127.0.0.1:5400/website-server/?plugin=friefffnds&theme=astra](http://127.0.0.1:5400/website-server/?plugin=friefffnds&theme=astra)
- Confirm that at `bootSiteClient` error was sent1 parent e51665e commit 0e86fed
File tree
5 files changed
+70
-24
lines changed- packages/playground
- blueprints/src
- lib/v1
- website/src
- components/layout
- lib
- state/redux
5 files changed
+70
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
| |||
Lines changed: 4 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 153 | + | |
| 154 | + | |
163 | 155 | | |
164 | 156 | | |
165 | 157 | | |
| |||
174 | 166 | | |
175 | 167 | | |
176 | 168 | | |
| 169 | + | |
177 | 170 | | |
178 | 171 | | |
179 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
1 | 7 | | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
5 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
6 | 14 | | |
7 | 15 | | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
11 | | - | |
| 19 | + | |
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
17 | 25 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments