@workleap/mixpanel 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +43 -0
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @workleap/mixpanel
|
|
2
|
+
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4](https://github.com/workleap/wl-tracking/pull/4) [`3430c6d`](https://github.com/workleap/wl-tracking/commit/3430c6dc2ccf381a96f8d1d03e7f695670d9e9d2) Thanks [@alexasselin008](https://github.com/alexasselin008)! - Added cjs entry point to our package
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#2](https://github.com/workleap/wl-tracking/pull/2) [`5e904ad`](https://github.com/workleap/wl-tracking/commit/5e904ad5117d86d0d7e7a727bfabe3f2db427f62) Thanks [@alexasselin008](https://github.com/alexasselin008)! - Add readme to package
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# `@workleap/mixpanel`
|
|
2
|
+
|
|
3
|
+
This package allows you to add basic tracking capabilities to your applications. It exposes a single `track` function that calls a tracking endpoint that conforms to the Workleap Platform Tracking API in the environment URL you have provided.
|
|
4
|
+
|
|
5
|
+
To use it you must first call the `createTrackingFunction` factory, which will return you a tracking function that you can then use in your code
|
|
6
|
+
```ts
|
|
7
|
+
import { createTrackingFunction } from "@workleap/mixpanel";
|
|
8
|
+
|
|
9
|
+
const environmentVariables = getEnvironmentVariables();
|
|
10
|
+
const productId = "wlp" //Workleap Management
|
|
11
|
+
const track = createTrackingFunction(productId, environmentVariables.navigationApiBaseUrl);
|
|
12
|
+
|
|
13
|
+
track("ButtonClicked", { "Trigger": "ChangePlan", "Location": "Header" });
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
You might want to track an action done in Workleap Management (or another product) that targets another product. The library provides a function options to specify the target product identifier.
|
|
17
|
+
```ts
|
|
18
|
+
import { createTrackingFunction } from "@workleap/mixpanel";
|
|
19
|
+
|
|
20
|
+
const environmentVariables = getEnvironmentVariables();
|
|
21
|
+
const productId = "wlp" //Workleap Management
|
|
22
|
+
const targetProductId = "wov" //Officevibe
|
|
23
|
+
const track = createTrackingFunction(productId, environmentVariables.navigationApiBaseUrl, {
|
|
24
|
+
targetProductId
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
track("ButtonClicked", { "Trigger": "ChangePlan", "Location": "Header" });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Link Tracking
|
|
31
|
+
|
|
32
|
+
If you want to track a link click, you can use the `track` function and add the `keepAlive` option to keep the current page alive while the tracking request is being made.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
|
|
36
|
+
const track = createTrackingFunction(productId, environmentVariables.navigationApiBaseUrl);
|
|
37
|
+
|
|
38
|
+
track("LinkClicked", { "Trigger": "ChangePlan", "Location": "Header" }, { keepAlive: true });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Migration Notes
|
|
42
|
+
|
|
43
|
+
The migration notes can be found [here](./MIGRATION_NOTES.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workleap/mixpanel",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"provenance": true
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
17
18
|
"import": "./dist/index.js",
|