castled-js-sdk 0.0.1
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 +125 -0
- package/index.d.ts +480 -0
- package/index.es.js +1 -0
- package/index.js +1 -0
- package/package.json +50 -0
- package/service-worker/index.d.ts +220 -0
- package/service-worker/index.es.js +5336 -0
- package/service-worker/index.js +5346 -0
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Events SDK Javascript
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @ht-sdks/events-sdk-js --save
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
**Note that this NPM module is only meant to be used for a browser installation**. If you want to integrate with your Node.js application, refer to the [**Node.js repository**](https://github.com/ht-sdks/events-sdk-node).
|
|
10
|
+
<br><br>
|
|
11
|
+
|
|
12
|
+
**IMPORTANT**: You should run the following code snippet only once and use the exported object throughout your project (e.g. Node module caching):
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import * as analytics from "@ht-sdks/events-sdk-js";
|
|
16
|
+
analytics.ready(() => {
|
|
17
|
+
console.log("we are all set!!!");
|
|
18
|
+
});
|
|
19
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>, {configUrl: <CONTROL_PLANE_URL> });
|
|
20
|
+
export { analytics };
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You can also do this with **ES5** using the `require` method, as shown:
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
var analytics = require("@ht-sdks/events-sdk-js");
|
|
27
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>, {config:Url: <CONTROL_PLANE_URL>});
|
|
28
|
+
exports.analytics = analytics;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Exported APIs
|
|
32
|
+
|
|
33
|
+
The APIs exported by the module are:
|
|
34
|
+
|
|
35
|
+
- `load`
|
|
36
|
+
- `ready`
|
|
37
|
+
- `identify`
|
|
38
|
+
- `alias`
|
|
39
|
+
- `page`
|
|
40
|
+
- `track`
|
|
41
|
+
- `group`
|
|
42
|
+
- `reset`
|
|
43
|
+
- `getAnonymousId`
|
|
44
|
+
- `setAnonymousId`
|
|
45
|
+
|
|
46
|
+
### Supported browser versions
|
|
47
|
+
|
|
48
|
+
| **Browser** | **Supported Versions** |
|
|
49
|
+
| :-------------- | :--------------------- |
|
|
50
|
+
| Safari | v7 or later |
|
|
51
|
+
| IE | v10 or later |
|
|
52
|
+
| Edge | v15 or later |
|
|
53
|
+
| Mozilla Firefox | v40 or later |
|
|
54
|
+
| Chrome | v37 or later |
|
|
55
|
+
| Opera | v23 or later |
|
|
56
|
+
| Yandex | v14.12 or later |
|
|
57
|
+
|
|
58
|
+
> If the SDK does not work on the browser versions that you are targeting, verify if adding the browser polyfills to your application solves the issue.
|
|
59
|
+
|
|
60
|
+
## Identifying users
|
|
61
|
+
|
|
62
|
+
The `identify` call lets you identify a visiting user and associate them to their actions. It also lets you record the traits about them like their name, email address, etc.
|
|
63
|
+
|
|
64
|
+
A sample `identify()` call is shown below:
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
analytics.identify(
|
|
68
|
+
'12345',
|
|
69
|
+
{
|
|
70
|
+
email: 'name@domain.com',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
page: {
|
|
74
|
+
path: '',
|
|
75
|
+
referrer: '',
|
|
76
|
+
search: '',
|
|
77
|
+
title: '',
|
|
78
|
+
url: '',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
() => {
|
|
82
|
+
console.log('in identify call');
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
In the above example, the user-related information like the `userId` and `email` (and other contextual info) is captured.
|
|
88
|
+
|
|
89
|
+
> There is no need to call `identify()` for anonymous visitors to your website. Such visitors are automatically assigned an `anonymousId`.
|
|
90
|
+
|
|
91
|
+
## Tracking user actions
|
|
92
|
+
|
|
93
|
+
The `track` call lets you record the customer events, i.e. the actions that they perform, along with any associated properties.
|
|
94
|
+
|
|
95
|
+
A sample `track` call is shown below:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
analytics.track(
|
|
99
|
+
'test track event GA3',
|
|
100
|
+
{
|
|
101
|
+
revenue: 30,
|
|
102
|
+
currency: 'USD',
|
|
103
|
+
user_actual_id: 12345,
|
|
104
|
+
},
|
|
105
|
+
() => {
|
|
106
|
+
console.log('in track call');
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
In the above example, the `track` method tracks the user event ‘**test track event GA3**’ and information such as the `revenue`, `currency`, `anonymousId`.
|
|
112
|
+
|
|
113
|
+
> You can use the `track` method to track various success metrics for your website like user signups, item purchases, article bookmarks, and more.
|
|
114
|
+
|
|
115
|
+
## The `ready` API
|
|
116
|
+
|
|
117
|
+
There are cases when you may want to tap into the features provided by the end-destination SDKs to enhance tracking and other functionalities. The JavaScript SDK exposes a `ready` API with a `callback` parameter that fires when the SDK is done initializing itself and the other third-party native SDK destinations.
|
|
118
|
+
|
|
119
|
+
An example is shown in the following snippet:
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
analytics.ready(() => {
|
|
123
|
+
console.log('we are all set!!!');
|
|
124
|
+
});
|
|
125
|
+
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
declare module 'castled-js-sdk' {
|
|
2
|
+
/**
|
|
3
|
+
* Represents the integration options object
|
|
4
|
+
* Example usages:
|
|
5
|
+
* integrationOptions { All: false, "Google Analytics": true, "Braze": true}
|
|
6
|
+
* integrationOptions { All: true, "Chartbeat": false, "Customer.io": false}
|
|
7
|
+
*/
|
|
8
|
+
interface integrationOptions {
|
|
9
|
+
// Defaults to true
|
|
10
|
+
// If set to false, specific integration should be set to true to send the event
|
|
11
|
+
All?: boolean;
|
|
12
|
+
// Destination name: true/false/integration specific information
|
|
13
|
+
[index: string]: boolean | undefined | apiObject;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the queue options parameter in loadOptions type
|
|
18
|
+
*/
|
|
19
|
+
interface queueOptions {
|
|
20
|
+
// Upper cap on maximum delay for an event
|
|
21
|
+
maxRetryDelay?: number;
|
|
22
|
+
// Minimum delay before sending an event
|
|
23
|
+
minRetryDelay?: number;
|
|
24
|
+
// Exponential base
|
|
25
|
+
backoffFactor?: number;
|
|
26
|
+
// Maximum number of attempts
|
|
27
|
+
maxAttempts?: number;
|
|
28
|
+
// Maximum number of events in storage
|
|
29
|
+
maxItems?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Represents the beacon queue options parameter in loadOptions type
|
|
34
|
+
*/
|
|
35
|
+
interface beaconQueueOptions {
|
|
36
|
+
// Maximum number of events in storage
|
|
37
|
+
maxItems?: number;
|
|
38
|
+
// Time in milliseconds to flush the queue autometically
|
|
39
|
+
flushQueueInterval?: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Represents the beacon queue options parameter in loadOptions type
|
|
44
|
+
*/
|
|
45
|
+
interface cookieConsentManager {
|
|
46
|
+
// OneTrust
|
|
47
|
+
oneTrust?: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
};
|
|
50
|
+
// Ketch
|
|
51
|
+
ketch?: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Represents the options parameter for anonymousId
|
|
58
|
+
*/
|
|
59
|
+
interface anonymousIdOptions {
|
|
60
|
+
autoCapture?: {
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
source?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface userIdOptions {
|
|
67
|
+
autoCapture?: {
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
source?: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Represents residency server input the options
|
|
75
|
+
*/
|
|
76
|
+
enum RESIDENCY_SERVER {
|
|
77
|
+
US = 'US',
|
|
78
|
+
EU = 'EU',
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Represents the options parameter in the load API
|
|
83
|
+
*/
|
|
84
|
+
interface loadOptions {
|
|
85
|
+
integrations?: integrationOptions;
|
|
86
|
+
// defaults to us-east-1.hightouch-events.com
|
|
87
|
+
configUrl?: string;
|
|
88
|
+
queueOptions?: queueOptions;
|
|
89
|
+
// Defaults to true
|
|
90
|
+
loadIntegration?: boolean;
|
|
91
|
+
lockIntegrationsVersion?: boolean;
|
|
92
|
+
// Defaults to false
|
|
93
|
+
secureCookie?: boolean;
|
|
94
|
+
// Defaults to "Lax" (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite)
|
|
95
|
+
sameSiteCookie?: string;
|
|
96
|
+
logLevel?: string;
|
|
97
|
+
getSourceConfig?: () => string | apiObject | Promise<apiObject> | Promise<string>;
|
|
98
|
+
setCookieDomain?: string;
|
|
99
|
+
sendAdblockPage?: boolean;
|
|
100
|
+
sendAdblockPageOptions?: apiOptions;
|
|
101
|
+
clientSuppliedCallbacks?: { string: () => void };
|
|
102
|
+
useBeacon?: boolean; // Defaults to false
|
|
103
|
+
beaconQueueOptions?: beaconQueueOptions;
|
|
104
|
+
cookieConsentManager?: cookieConsentManager;
|
|
105
|
+
anonymousIdOptions?: anonymousIdOptions;
|
|
106
|
+
userIdOptions?: userIdOptions;
|
|
107
|
+
// defaults to https://cdn.hightouch-events.com/js/v1.1/js-integrations
|
|
108
|
+
destSDKBaseURL?: string;
|
|
109
|
+
sessions?: {
|
|
110
|
+
autoTrack?: boolean; // Defaults to true
|
|
111
|
+
timeout?: number; // Defaults to 30 mins
|
|
112
|
+
};
|
|
113
|
+
residencyServer?: RESIDENCY_SERVER;
|
|
114
|
+
// Controls whether the SDK should polyfill unsupported browser API's if they are detected as missing
|
|
115
|
+
// Defaults to true
|
|
116
|
+
polyfillIfRequired?: boolean;
|
|
117
|
+
uaChTrackLevel?: 'none' | 'default' | 'full';
|
|
118
|
+
onLoaded?: (analytics: any) => void;
|
|
119
|
+
useGlobalIntegrationsConfigInEvents?: boolean; // Default is false
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Represents the options parameter in the APIs
|
|
124
|
+
*/
|
|
125
|
+
interface apiOptions {
|
|
126
|
+
integrations?: integrationOptions;
|
|
127
|
+
anonymousId?: string;
|
|
128
|
+
// ISO 8601 date string
|
|
129
|
+
originalTimestamp?: string;
|
|
130
|
+
// Merged with event's contextual information
|
|
131
|
+
[index: string]:
|
|
132
|
+
| string
|
|
133
|
+
| number
|
|
134
|
+
| boolean
|
|
135
|
+
| apiObject
|
|
136
|
+
| (string | number | boolean | apiObject)[]
|
|
137
|
+
| integrationOptions
|
|
138
|
+
| undefined;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Represents a generic object in the APIs
|
|
143
|
+
* Use for parameters like properties, traits etc.
|
|
144
|
+
*/
|
|
145
|
+
interface apiObject {
|
|
146
|
+
[index: string]:
|
|
147
|
+
| string
|
|
148
|
+
| number
|
|
149
|
+
| boolean
|
|
150
|
+
| apiObject
|
|
151
|
+
| (string | number | boolean | apiObject)[]
|
|
152
|
+
| undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Represents the callback in the APIs
|
|
157
|
+
*/
|
|
158
|
+
type apiCallback = () => void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Call control pane to get client configs
|
|
162
|
+
* @param writeKey
|
|
163
|
+
* @param dataPlaneUrl
|
|
164
|
+
* @param options
|
|
165
|
+
*/
|
|
166
|
+
function load(writeKey: string, dataPlaneUrl: string, options?: loadOptions): void;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* To register a callback for SDK ready state
|
|
170
|
+
* @param callback
|
|
171
|
+
*/
|
|
172
|
+
function ready(callback: apiCallback): void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* To record a page view event
|
|
176
|
+
* @param category
|
|
177
|
+
* @param name
|
|
178
|
+
* @param properties
|
|
179
|
+
* @param options
|
|
180
|
+
* @param callback
|
|
181
|
+
*/
|
|
182
|
+
function page(
|
|
183
|
+
category?: string,
|
|
184
|
+
name?: string,
|
|
185
|
+
properties?: apiObject,
|
|
186
|
+
options?: apiOptions,
|
|
187
|
+
callback?: apiCallback,
|
|
188
|
+
): void;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* To record a page view event
|
|
192
|
+
* @param category
|
|
193
|
+
* @param name
|
|
194
|
+
* @param properties
|
|
195
|
+
* @param callback
|
|
196
|
+
*/
|
|
197
|
+
function page(category: string, name: string, properties: apiObject, callback: apiCallback): void;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* To record a page view event
|
|
201
|
+
* @param category
|
|
202
|
+
* @param name
|
|
203
|
+
* @param callback
|
|
204
|
+
*/
|
|
205
|
+
function page(category: string, name: string, callback: apiCallback): void;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* To record a page view event
|
|
209
|
+
* @param name
|
|
210
|
+
* @param properties
|
|
211
|
+
* @param options
|
|
212
|
+
* @param callback
|
|
213
|
+
*/
|
|
214
|
+
function page(
|
|
215
|
+
name: string,
|
|
216
|
+
properties?: apiObject,
|
|
217
|
+
options?: apiOptions,
|
|
218
|
+
callback?: apiCallback,
|
|
219
|
+
): void;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* To record a page view event
|
|
223
|
+
* @param name
|
|
224
|
+
* @param properties
|
|
225
|
+
* @param callback
|
|
226
|
+
*/
|
|
227
|
+
function page(name: string, properties: apiObject, callback: apiCallback): void;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
* @param name
|
|
232
|
+
* @param callback
|
|
233
|
+
*/
|
|
234
|
+
function page(name: string, callback: apiCallback): void;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
*
|
|
238
|
+
* @param properties
|
|
239
|
+
* @param options
|
|
240
|
+
* @param callback
|
|
241
|
+
*/
|
|
242
|
+
function page(properties: apiObject, options: apiOptions, callback?: apiCallback): void;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* To record a page view event
|
|
246
|
+
* @param properties
|
|
247
|
+
* @param callback
|
|
248
|
+
*/
|
|
249
|
+
function page(properties: apiObject, callback?: apiCallback): void;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* To record a user track event
|
|
253
|
+
* @param event
|
|
254
|
+
* @param properties
|
|
255
|
+
* @param options
|
|
256
|
+
* @param callback
|
|
257
|
+
*/
|
|
258
|
+
function track(
|
|
259
|
+
event: string,
|
|
260
|
+
properties?: apiObject,
|
|
261
|
+
options?: apiOptions,
|
|
262
|
+
callback?: apiCallback,
|
|
263
|
+
): void;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* To record a user track event
|
|
267
|
+
* @param event
|
|
268
|
+
* @param properties
|
|
269
|
+
* @param callback
|
|
270
|
+
*/
|
|
271
|
+
function track(event: string, properties: apiObject, callback: apiCallback): void;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* To record a user track event
|
|
275
|
+
* @param event
|
|
276
|
+
* @param callback
|
|
277
|
+
*/
|
|
278
|
+
function track(event: string, callback: apiCallback): void;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* To record a user identification event
|
|
282
|
+
* @param userId
|
|
283
|
+
* @param traits
|
|
284
|
+
* @param options
|
|
285
|
+
* @param callback
|
|
286
|
+
*/
|
|
287
|
+
function identify(
|
|
288
|
+
userId?: string,
|
|
289
|
+
traits?: apiObject,
|
|
290
|
+
options?: apiOptions,
|
|
291
|
+
callback?: apiCallback,
|
|
292
|
+
): void;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* To record a user identification event
|
|
296
|
+
* @param userId
|
|
297
|
+
* @param traits
|
|
298
|
+
* @param callback
|
|
299
|
+
*/
|
|
300
|
+
function identify(userId: string, traits: apiObject, callback: apiCallback): void;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* To record a user identification event
|
|
304
|
+
* @param userId
|
|
305
|
+
* @param callback
|
|
306
|
+
*/
|
|
307
|
+
function identify(userId: string, callback: apiCallback): void;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
*
|
|
311
|
+
* @param traits
|
|
312
|
+
* @param options
|
|
313
|
+
* @param callback
|
|
314
|
+
*/
|
|
315
|
+
function identify(traits: apiObject, options: apiOptions, callback?: apiCallback): void;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
*
|
|
319
|
+
* @param traits
|
|
320
|
+
* @param callback
|
|
321
|
+
*/
|
|
322
|
+
function identify(traits: apiObject, callback?: apiCallback): void;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* To record a user alias event
|
|
326
|
+
* @param to
|
|
327
|
+
* @param from
|
|
328
|
+
* @param options
|
|
329
|
+
* @param callback
|
|
330
|
+
*/
|
|
331
|
+
function alias(to: string, from?: string, options?: apiOptions, callback?: apiCallback): void;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* To record a user alias event
|
|
335
|
+
* @param to
|
|
336
|
+
* @param from
|
|
337
|
+
* @param callback
|
|
338
|
+
*/
|
|
339
|
+
function alias(to: string, from: string, callback: apiCallback): void;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* To record a user alias event
|
|
343
|
+
* @param to
|
|
344
|
+
* @param callback
|
|
345
|
+
*/
|
|
346
|
+
function alias(to: string, callback: apiCallback): void;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* To record a user alias event
|
|
350
|
+
* @param to
|
|
351
|
+
* @param options
|
|
352
|
+
* @param callback
|
|
353
|
+
*/
|
|
354
|
+
function alias(to: string, options: apiOptions, callback?: apiCallback): void;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* To record a user group event
|
|
358
|
+
* @param groupId
|
|
359
|
+
* @param traits
|
|
360
|
+
* @param options
|
|
361
|
+
* @param callback
|
|
362
|
+
*/
|
|
363
|
+
function group(
|
|
364
|
+
groupId: string,
|
|
365
|
+
traits?: apiObject,
|
|
366
|
+
options?: apiOptions,
|
|
367
|
+
callback?: apiCallback,
|
|
368
|
+
): void;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* To record a user group event
|
|
372
|
+
* @param groupId
|
|
373
|
+
* @param traits
|
|
374
|
+
* @param callback
|
|
375
|
+
*/
|
|
376
|
+
function group(groupId: string, traits: apiObject, callback: apiCallback): void;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* To record a user group event
|
|
380
|
+
* @param groupId
|
|
381
|
+
* @param callback
|
|
382
|
+
*/
|
|
383
|
+
function group(groupId: string, callback: apiCallback): void;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* To record a user group event
|
|
387
|
+
* @param traits
|
|
388
|
+
* @param options
|
|
389
|
+
* @param callback
|
|
390
|
+
*/
|
|
391
|
+
function group(traits: apiObject, options: apiOptions, callback?: apiCallback): void;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* To record a user group event
|
|
395
|
+
* @param traits
|
|
396
|
+
* @param callback
|
|
397
|
+
*/
|
|
398
|
+
function group(traits: apiObject, callback?: apiCallback): void;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* To get anonymousId set in the SDK
|
|
402
|
+
*/
|
|
403
|
+
function getAnonymousId(options?: anonymousIdOptions): string;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* To set anonymousId
|
|
407
|
+
* @param anonymousId
|
|
408
|
+
* @param rudderAmpLinkerParm AMP Linker ID string
|
|
409
|
+
*/
|
|
410
|
+
function setAnonymousId(anonymousId?: string, rudderAmpLinkerParm?: string): void;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Clear user information
|
|
414
|
+
* @param flag If true, clears anonymousId as well
|
|
415
|
+
*/
|
|
416
|
+
function reset(flag?: boolean): void;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* To get userId set in the SDK
|
|
420
|
+
*/
|
|
421
|
+
function getUserId(): string;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* To get user traits set in the SDK
|
|
425
|
+
*/
|
|
426
|
+
function getUserTraits(): apiObject;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* To get groupId set in the SDK
|
|
430
|
+
*/
|
|
431
|
+
function getGroupId(): string;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* To get group traits set in the SDK
|
|
435
|
+
*/
|
|
436
|
+
function getGroupTraits(): apiObject;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* To manually start user session in the SDK
|
|
440
|
+
*/
|
|
441
|
+
function startSession(sessionId?: number): void;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* To manually end user session in the SDK
|
|
445
|
+
*/
|
|
446
|
+
function endSession(): void;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* To fetch the current sessionId
|
|
450
|
+
*/
|
|
451
|
+
function getSessionId(): number | null;
|
|
452
|
+
|
|
453
|
+
export {
|
|
454
|
+
integrationOptions,
|
|
455
|
+
loadOptions,
|
|
456
|
+
apiOptions,
|
|
457
|
+
queueOptions,
|
|
458
|
+
apiObject,
|
|
459
|
+
apiCallback,
|
|
460
|
+
anonymousIdOptions,
|
|
461
|
+
load,
|
|
462
|
+
ready,
|
|
463
|
+
reset,
|
|
464
|
+
page,
|
|
465
|
+
track,
|
|
466
|
+
identify,
|
|
467
|
+
alias,
|
|
468
|
+
group,
|
|
469
|
+
setAnonymousId,
|
|
470
|
+
getAnonymousId,
|
|
471
|
+
getUserId,
|
|
472
|
+
getUserTraits,
|
|
473
|
+
getGroupId,
|
|
474
|
+
getGroupTraits,
|
|
475
|
+
startSession,
|
|
476
|
+
endSession,
|
|
477
|
+
RESIDENCY_SERVER,
|
|
478
|
+
getSessionId,
|
|
479
|
+
};
|
|
480
|
+
}
|