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
Copy file name to clipboardExpand all lines: README.md
+68-7Lines changed: 68 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,55 @@
1
1
# Telemetry Deck JavaScript SDK
2
2
3
-
Support modern evergreen browsers which support [cryptography](https://caniuse.com/cryptography).
3
+
This package allows you to send signals to [TelemetryDeck](https://telemetrydeck.com) from your JavaScript code.
4
+
5
+
It has no package dependencies and supports modern evergreen browsers which support [cryptography](https://caniuse.com/cryptography).
6
+
7
+
Signals sent with this version of the SDK automatically send the following payload items:
8
+
9
+
- url
10
+
- useragent
11
+
- locale
12
+
- platform
13
+
14
+
You can filter and show these values in the TelemetryDeck dashboard.
15
+
16
+
Test Mode is currently not supported.
4
17
5
18
## Usage
6
19
7
-
### For applications that use a bundler (like Webpack, Rollup, …)
20
+
### 📄 Usage via Script Tag
21
+
22
+
For regular websites and to try out the code quickly, you can use [UNPKG](https://unpkg.com), a free CDN which allows you to load files from any npm package.
23
+
24
+
Include the following snippet in your page header:
then include a script tag at the bottom of your page like this to send a signal once every time the page loads:
31
+
32
+
```html
33
+
<script>
34
+
signal(
35
+
// required options to identify your app and the user
36
+
{
37
+
appID:'YOUR_APP_ID',
38
+
userIdentifier:'ANONYMOUS',
39
+
},
40
+
// optional: custom payload stored with the signal
41
+
{
42
+
route:'some/page/path',
43
+
}
44
+
);
45
+
</script>
46
+
```
47
+
48
+
Please replace `YOUR_APP_ID` with the app ID you received from TelemetryDeck, and set a user identifier if possible.
49
+
50
+
### 📦 Usage for applications that use a bundler (like Webpack, Rollup, …)
51
+
52
+
After installing the package via NPM, use it like this:
8
53
9
54
```js
10
55
import { signal } from'telemetry-deck';
@@ -23,10 +68,26 @@ signal(
23
68
);
24
69
```
25
70
26
-
### For situations where you just want to add a script tag and generate signals
71
+
Please replace `YOUR_APP_ID` with the app ID you received from TelemetryDeck. If you have any string that identifies your user, such as an email address, pass it into `userIdentifier` – it will be cryptographically anonymized with a hash function.
27
72
28
-
[UNPKG](https://unpkg.com) is a free CDN which allows you to load files from any npm package.
73
+
If you want to pass optional parameters to the signal being sent, add them to the optional paylaod object.
Every application and website registered to TelemetryDeck has its own unique ID that we use to assign incoming signals to the correct app. To get started, create a new app in the TelemetryDeck UI and copy its ID.
80
+
81
+
### 👤 Optional: User Identifiers
82
+
83
+
TelemetryDeck can count users if you assign it a unique identifier for each user that doesn't change. This identifier can be any string that is unique to the user, such as their email address, or a randomly generated UUID.
84
+
85
+
Feel free to use personally identifiable information as the user identifier: We use a cryptographically secure double-hasing process on client and server to make sure the data that arrives at our servers is anonymized and can not be traced back to individual users via their identifiers. A user's identifier is hashed inside the library, and then salted+hashed again on arrival at the server. This way the data is anonymized as defined by the GDPR and you don't have to ask for user consent for procesing or storing this data.
86
+
87
+
### 🚛 Optional: Payload
88
+
89
+
You can optionally attach an object with string values to the signal. This will allow you to filter and aggregate signal by these values in the dashboard.
90
+
91
+
### 📚 Full Docs
92
+
93
+
Go to [docs.telemetrydeck.com](https://docs.telemetrydeck.com) to see all documentation articles
0 commit comments