You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(Analytics): Major overhaul of provider init and Umami Provider
Allow to tune down the logging on console. Change initialisation of providers and do a major overhaul of the Umami Provider.
Co-authored-by: Erin Donehoo <105813956+edonehoo@users.noreply.github.com>
Copy file name to clipboardExpand all lines: packages/module/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md
+18-14Lines changed: 18 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,10 +36,12 @@ Note that user code only interacts with:
36
36
37
37
### Setup
38
38
39
-
1. Before you can use the `trackingAPI`, you must first supply the API keys of the respective providers.
39
+
1. Before you can use the `trackingAPI`, you must first supply the API keys of the respective providers. To enable a provider, it must be added to the `activeProviders` property:
Only providers with a matching key in the `InitProps` will be started and used.
83
+
Only providers with a matching entry in the `InitProps.activeProviders` array will be started and used.
84
+
85
+
Possible values are:
86
+
* Umami
87
+
* Posthog
88
+
* Segment
89
+
* Console
80
90
81
-
```nolive
82
-
const initProps: InitProps = {
83
-
segmentKey: 'TODO-key', // TODO add your key here
84
-
posthogKey: 'TODO-key',
85
-
umamiKey: 'TODO-key',
86
-
umamiHostUrl: 'http://localhost:3000', // TODO where is your JS provider?
87
-
console: true
88
-
```
89
91
90
92
##### Modifying providers
91
93
92
94
If you know upfront that you only want to use 1 of the supported providers, you can modify `getTrackingProviders()` and remove all other providers in the providers array.
93
95
94
-
When using the providers you need to add additional dependencies to your package.json file:
96
+
When using the providers, you might need to add additional dependencies to your package.json file:
95
97
96
98
```nolive
97
99
"dependencies": {
98
100
"@segment/analytics-next": "^1.76.0",
99
101
"posthog-js": "^1.194.4"
100
102
```
101
103
104
+
Depending on your local setup, this might not be necessary. For example, if you pull the ChatBot codebase as a dependency into your project, you don't need to add it as an additional dependency in your package.json.
105
+
102
106
##### Adding providers
103
107
104
108
To add another analytics provider, you need to implement 2 interfaces, `TrackingSpi` and `trackingApi`.
105
109
106
110
1. It is easiest to start by copying the `ConsoleTrackingProvider`
107
-
1.The first thing you should do is to provide a correct value in `getKey()`
111
+
1.Add an entry for your new provider to the `Providers` enum in `tracking_spi.ts`
108
112
1. Once you are happy enough with the implementation, add it to the array of providers in `getTrackingProviders()`
0 commit comments