@fullstory/browser 2.0.0-beta.3 → 2.0.0-beta.4
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/README.md +108 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
FullStory's browser SDK lets you manage FullStory recording on your site as well as retrieve deep links to session replays and send your own custom events. More information about the FullStory API can be found at https://developer.fullstory.com.
|
|
6
6
|
|
|
7
|
+
> **NOTE:** this is the documentation for version 2. For version 1 documentation, please see [@fullstory/browser@1.7.1](https://www.npmjs.com/package/@fullstory/browser/v/1.7.1).
|
|
7
8
|
|
|
8
9
|
## Install the SDK
|
|
9
10
|
|
|
@@ -18,6 +19,48 @@ npm i @fullstory/browser --save
|
|
|
18
19
|
yarn add @fullstory/browser
|
|
19
20
|
```
|
|
20
21
|
|
|
22
|
+
## Migrating to Version 2.x.x
|
|
23
|
+
In version 2.x.x, `init` is a separate named export from `FullStory`. You will need to update all of your wildcard (`'*'`) imports to explicit named imports.
|
|
24
|
+
|
|
25
|
+
_Version 1.x.x_
|
|
26
|
+
```js
|
|
27
|
+
import * as FullStory from '@fullstory/browser';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
_Version 2.x.x_
|
|
31
|
+
```js
|
|
32
|
+
import { FullStory, init } from '@fullstory/browser';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### `init`
|
|
36
|
+
You can use the named import `init` by itself:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import { init } from '@fullstory/browser';
|
|
40
|
+
|
|
41
|
+
init({ orgId: 'my-org-id' })
|
|
42
|
+
```
|
|
43
|
+
You can also rename the function for readability:
|
|
44
|
+
```js
|
|
45
|
+
import { init as initFullStory } from '@fullstory/browser';
|
|
46
|
+
|
|
47
|
+
initFullStory({ orgId: 'my-org-id' })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `FullStory`
|
|
51
|
+
The `FullStory` named export is equivalent to the global `FS` object described in the [developer documentation](https://developer.fullstory.com/browser/v2/getting-started/). You can use it to make all version 2 API calls:
|
|
52
|
+
```js
|
|
53
|
+
import { FullStory } from '@fullstory/browser';
|
|
54
|
+
|
|
55
|
+
FullStory('trackEvent', {
|
|
56
|
+
name: 'My Event',
|
|
57
|
+
properties: {
|
|
58
|
+
product: 'Sprockets',
|
|
59
|
+
quantity: 1,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
21
64
|
## Initialize the SDK
|
|
22
65
|
|
|
23
66
|
Call the `init()` function with options as soon as you can in your website startup process. Calling init after successful initialization will trigger console warnings - if you need to programmatically check if FullStory has been initialized at some point in your code, you can call `isInitialized()`.
|
|
@@ -43,7 +86,9 @@ The only required option is `orgId`, all others are optional.
|
|
|
43
86
|
The `init` function also accepts an optional `readyCallback` argument. If you provide a function, it will be invoked when the FullStory session has started. Your callback will be called with one parameter: an object containing information about the session. Currently the only property is `sessionUrl`, which is a string containing the URL to the session.
|
|
44
87
|
|
|
45
88
|
```javascript
|
|
46
|
-
|
|
89
|
+
import { init } from '@fullstory/browser';
|
|
90
|
+
|
|
91
|
+
init({ orgId }, ({ sessionUrl }) => console.log(`Started session: ${sessionUrl}`));
|
|
47
92
|
```
|
|
48
93
|
|
|
49
94
|
### Initialization Examples
|
|
@@ -55,10 +100,10 @@ import React from 'react';
|
|
|
55
100
|
import ReactDOM from 'react-dom';
|
|
56
101
|
import './index.css';
|
|
57
102
|
import App from './App';
|
|
58
|
-
import
|
|
103
|
+
import { init as initFullStory } from '@fullstory/browser';
|
|
59
104
|
|
|
60
105
|
|
|
61
|
-
|
|
106
|
+
initFullStory({ orgId: '<your org id here>' });
|
|
62
107
|
|
|
63
108
|
ReactDOM.render(<App />, document.getElementById('root'));
|
|
64
109
|
```
|
|
@@ -67,7 +112,7 @@ ReactDOM.render(<App />, document.getElementById('root'));
|
|
|
67
112
|
|
|
68
113
|
```javascript
|
|
69
114
|
import { Component } from '@angular/core';
|
|
70
|
-
import
|
|
115
|
+
import { init as initFullStory } from '@fullstory/browser';
|
|
71
116
|
import { environment } from '../environments/environment';
|
|
72
117
|
|
|
73
118
|
@Component({
|
|
@@ -78,8 +123,10 @@ import { environment } from '../environments/environment';
|
|
|
78
123
|
export class AppComponent {
|
|
79
124
|
|
|
80
125
|
constructor() {
|
|
81
|
-
|
|
82
|
-
|
|
126
|
+
initFullStory({
|
|
127
|
+
orgId: '<your org id here>',
|
|
128
|
+
devMode: !environment.production,
|
|
129
|
+
});
|
|
83
130
|
}
|
|
84
131
|
}
|
|
85
132
|
```
|
|
@@ -89,9 +136,9 @@ export class AppComponent {
|
|
|
89
136
|
```javascript
|
|
90
137
|
import Vue from 'vue';
|
|
91
138
|
import App from './App.vue';
|
|
92
|
-
import
|
|
139
|
+
import { init as initFullStory, FullStory } from '@fullstory/browser';
|
|
93
140
|
|
|
94
|
-
|
|
141
|
+
initFullStory({ orgId: '<your org id here>' });
|
|
95
142
|
Vue.prototype.$FullStory = FullStory;
|
|
96
143
|
|
|
97
144
|
new Vue({
|
|
@@ -102,11 +149,11 @@ new Vue({
|
|
|
102
149
|
#### Vue 3
|
|
103
150
|
|
|
104
151
|
```javascript
|
|
105
|
-
import { createApp } from 'vue'
|
|
106
|
-
import App from './App.vue'
|
|
107
|
-
import
|
|
152
|
+
import { createApp } from 'vue';
|
|
153
|
+
import App from './App.vue';
|
|
154
|
+
import { init as initFullStory, FullStory } from '@fullstory/browser';
|
|
108
155
|
|
|
109
|
-
|
|
156
|
+
initFullStory({ orgId: '<your org id here>' });
|
|
110
157
|
|
|
111
158
|
const app = createApp(App);
|
|
112
159
|
app.config.globalProperties.$FullStory = FullStory;
|
|
@@ -115,37 +162,68 @@ app.mount('#app');
|
|
|
115
162
|
|
|
116
163
|
## Using the SDK
|
|
117
164
|
|
|
118
|
-
Once FullStory is initialized, you can make calls to the FullStory SDK.
|
|
165
|
+
Once FullStory is initialized, you can make calls to the FullStory SDK. See the [developer documentation](https://developer.fullstory.com/browser/v2/getting-started/) for more information.
|
|
119
166
|
|
|
120
167
|
### Sending custom events
|
|
121
168
|
|
|
122
169
|
```JavaScript
|
|
123
|
-
FullStory
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
170
|
+
FullStory('trackEvent', {
|
|
171
|
+
name: 'Subscribed',
|
|
172
|
+
properties: {
|
|
173
|
+
uid: '750948353',
|
|
174
|
+
plan_name: 'Professional',
|
|
175
|
+
plan_price: 299,
|
|
176
|
+
plan_users: 10,
|
|
177
|
+
days_in_trial: 42,
|
|
178
|
+
feature_packs: ['MAPS', 'DEV', 'DATA'],
|
|
179
|
+
},
|
|
180
|
+
schema: {
|
|
181
|
+
properties: {
|
|
182
|
+
plan_users: 'int', // override default inferred "real" type with "int"
|
|
183
|
+
days_in_trial: 'int', // override default inferred "real" type with "int"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
130
186
|
});
|
|
131
187
|
```
|
|
132
188
|
|
|
189
|
+
> **NOTE:** The inclusion of type suffixes - appending `_str` or `_int` to the end of properties - is no longer required. All custom properties are inferred on the server. To override any default inference, you can add a `schema`. See [Custom Properties](https://developer.fullstory.com/browser/v2/custom-properties/) for more information.
|
|
190
|
+
|
|
133
191
|
### Generating session replay links
|
|
134
192
|
|
|
135
193
|
```JavaScript
|
|
136
|
-
const startOfPlayback = FullStory
|
|
137
|
-
const playbackAtThisMomentInTime = FullStory.
|
|
194
|
+
const startOfPlayback = FullStory('getSession');
|
|
195
|
+
const playbackAtThisMomentInTime = FullStory('getSession', { format: 'url.now' });
|
|
138
196
|
```
|
|
139
197
|
|
|
140
|
-
### Sending custom
|
|
198
|
+
### Sending custom user properties
|
|
141
199
|
```JavaScript
|
|
142
|
-
FullStory
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
200
|
+
FullStory('setProperties', {
|
|
201
|
+
type: 'user',
|
|
202
|
+
properties: {
|
|
203
|
+
displayName: 'Daniel Falko',
|
|
204
|
+
email: 'daniel.falko@example.com',
|
|
205
|
+
pricing_plan: 'free',
|
|
206
|
+
popup_help: true,
|
|
207
|
+
total_spent: 14.50,
|
|
208
|
+
},
|
|
146
209
|
});
|
|
147
210
|
```
|
|
148
|
-
For more information on
|
|
211
|
+
For more information on sending custom user properties, view the FullStory help article on [Capturing custom user properties](https://help.fullstory.com/hc/en-us/articles/360020623294).
|
|
149
212
|
|
|
150
|
-
|
|
151
|
-
|
|
213
|
+
### Sending custom page properties
|
|
214
|
+
```JavaScript
|
|
215
|
+
FullStory('setProperties', {
|
|
216
|
+
type: 'page',
|
|
217
|
+
properties: {
|
|
218
|
+
pageName: 'Checkout', // what is the name of the page?
|
|
219
|
+
cart_size: 10, // how many items were in the cart?
|
|
220
|
+
used_coupon: true, // was a coupon used?
|
|
221
|
+
},
|
|
222
|
+
schema: {
|
|
223
|
+
properties: {
|
|
224
|
+
cart_size: 'int', // override default inferred "real" type with "int"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
For more information on setting page properties, view the FullStory help article on [Sending custom page data to FullStory](https://help.fullstory.com/hc/en-us/articles/1500004101581-FS-setVars-API-Sending-custom-page-data-to-FullStory).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstory/browser",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "The official FullStory browser SDK",
|
|
5
5
|
"repository": "git://github.com/fullstorydev/fullstory-browser-sdk.git",
|
|
6
6
|
"homepage": "https://github.com/fullstorydev/fullstory-browser-sdk",
|