@segment/analytics-browser-actions-fullsession 1.1.0
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 +31 -0
- package/dist/cjs/generated-types.d.ts +3 -0
- package/dist/cjs/generated-types.js +3 -0
- package/dist/cjs/generated-types.js.map +1 -0
- package/dist/cjs/identifyUser/generated-types.d.ts +7 -0
- package/dist/cjs/identifyUser/generated-types.js +3 -0
- package/dist/cjs/identifyUser/generated-types.js.map +1 -0
- package/dist/cjs/identifyUser/index.d.ts +6 -0
- package/dist/cjs/identifyUser/index.js +53 -0
- package/dist/cjs/identifyUser/index.js.map +1 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/recordEvent/generated-types.d.ts +6 -0
- package/dist/cjs/recordEvent/generated-types.js +3 -0
- package/dist/cjs/recordEvent/generated-types.js.map +1 -0
- package/dist/cjs/recordEvent/index.d.ts +6 -0
- package/dist/cjs/recordEvent/index.js +34 -0
- package/dist/cjs/recordEvent/index.js.map +1 -0
- package/dist/cjs/types.d.ts +11 -0
- package/dist/cjs/types.js +6 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/visitPage/generated-types.d.ts +5 -0
- package/dist/cjs/visitPage/generated-types.js +3 -0
- package/dist/cjs/visitPage/generated-types.js.map +1 -0
- package/dist/cjs/visitPage/index.d.ts +6 -0
- package/dist/cjs/visitPage/index.js +27 -0
- package/dist/cjs/visitPage/index.js.map +1 -0
- package/dist/esm/generated-types.d.ts +3 -0
- package/dist/esm/generated-types.js +2 -0
- package/dist/esm/generated-types.js.map +1 -0
- package/dist/esm/identifyUser/generated-types.d.ts +7 -0
- package/dist/esm/identifyUser/generated-types.js +2 -0
- package/dist/esm/identifyUser/generated-types.js.map +1 -0
- package/dist/esm/identifyUser/index.d.ts +6 -0
- package/dist/esm/identifyUser/index.js +51 -0
- package/dist/esm/identifyUser/index.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +54 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/recordEvent/generated-types.d.ts +6 -0
- package/dist/esm/recordEvent/generated-types.js +2 -0
- package/dist/esm/recordEvent/generated-types.js.map +1 -0
- package/dist/esm/recordEvent/index.d.ts +6 -0
- package/dist/esm/recordEvent/index.js +32 -0
- package/dist/esm/recordEvent/index.js.map +1 -0
- package/dist/esm/types.d.ts +11 -0
- package/dist/esm/types.js +3 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/visitPage/generated-types.d.ts +5 -0
- package/dist/esm/visitPage/generated-types.js +2 -0
- package/dist/esm/visitPage/generated-types.js.map +1 -0
- package/dist/esm/visitPage/index.d.ts +6 -0
- package/dist/esm/visitPage/index.js +25 -0
- package/dist/esm/visitPage/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +25 -0
- package/src/__tests__/index.test.ts +177 -0
- package/src/generated-types.ts +8 -0
- package/src/identifyUser/__tests__/index.test.ts +315 -0
- package/src/identifyUser/generated-types.ts +18 -0
- package/src/identifyUser/index.ts +66 -0
- package/src/index.ts +68 -0
- package/src/recordEvent/__tests__/index.test.ts +274 -0
- package/src/recordEvent/generated-types.ts +14 -0
- package/src/recordEvent/index.ts +37 -0
- package/src/types.ts +14 -0
- package/src/visitPage/__tests__/index.test.ts +312 -0
- package/src/visitPage/generated-types.ts +10 -0
- package/src/visitPage/index.ts +31 -0
- package/tsconfig.json +9 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @segment/analytics-browser-actions-fullsession
|
|
2
|
+
|
|
3
|
+
The FullSession browser action destination for use with @segment/analytics-next.
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Segment
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../src/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/identifyUser/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import { FUS } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FUS, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Identify User',
|
|
5
|
+
description: 'Identify users and set their properties in FullSession.',
|
|
6
|
+
platform: 'web',
|
|
7
|
+
defaultSubscription: 'type = "identify"',
|
|
8
|
+
fields: {
|
|
9
|
+
userId: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: false,
|
|
12
|
+
description: "The user's unique identifier.",
|
|
13
|
+
label: 'User ID',
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.userId'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
anonymousId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
required: false,
|
|
21
|
+
description: "The user's anonymous identifier when no user ID is available.",
|
|
22
|
+
label: 'Anonymous ID',
|
|
23
|
+
default: {
|
|
24
|
+
'@path': '$.anonymousId'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
traits: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
required: false,
|
|
30
|
+
description: 'User traits and properties to be sent to FullSession.',
|
|
31
|
+
label: 'User Traits',
|
|
32
|
+
default: {
|
|
33
|
+
'@path': '$.traits'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
perform: (FUS, data) => {
|
|
38
|
+
const { userId, anonymousId, traits = {} } = data.payload;
|
|
39
|
+
const identifyTraits = {
|
|
40
|
+
name: traits.name ?? '',
|
|
41
|
+
email: traits.email ?? ''
|
|
42
|
+
};
|
|
43
|
+
FUS.identify(userId ?? anonymousId, identifyTraits);
|
|
44
|
+
const { name: _ignoredName, email: _ignoredEmail, ...restTraits } = traits || {};
|
|
45
|
+
const sessionAttributes = {
|
|
46
|
+
...restTraits,
|
|
47
|
+
...(anonymousId ? { segmentAnonymousId: anonymousId } : {})
|
|
48
|
+
};
|
|
49
|
+
FUS.setSessionAttributes(sessionAttributes);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.default = action;
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identifyUser/index.ts"],"names":[],"mappings":";;AAKA,MAAM,MAAM,GAAoD;IAC9D,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,yDAAyD;IACtE,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+BAA+B;YAC5C,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+DAA+D;YAC5E,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uDAAuD;YACpE,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QAGzD,MAAM,cAAc,GAAG;YACrB,IAAI,EAAG,MAAM,CAAC,IAAe,IAAI,EAAE;YACnC,KAAK,EAAG,MAAM,CAAC,KAAgB,IAAI,EAAE;SACtC,CAAA;QAID,GAAG,CAAC,QAAQ,CAAC,MAAM,IAAK,WAAsB,EAAE,cAAc,CAAC,CAAA;QAG/D,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;QAGhF,MAAM,iBAAiB,GAAG;YACxB,GAAG,UAAU;YACb,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5D,CAAA;QAED,GAAG,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Settings } from './generated-types';
|
|
2
|
+
import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types';
|
|
3
|
+
import type { FUS } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
FUS: FUS;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const destination: BrowserDestinationDefinition<Settings, FUS>;
|
|
10
|
+
declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destination = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const shim_1 = require("@segment/browser-destination-runtime/shim");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
const identifyUser_1 = tslib_1.__importDefault(require("./identifyUser"));
|
|
8
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
9
|
+
const recordEvent_1 = tslib_1.__importDefault(require("./recordEvent"));
|
|
10
|
+
const visitPage_1 = tslib_1.__importDefault(require("./visitPage"));
|
|
11
|
+
exports.destination = {
|
|
12
|
+
name: 'FullSession',
|
|
13
|
+
slug: 'actions-fullsession',
|
|
14
|
+
mode: 'device',
|
|
15
|
+
presets: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Identify User',
|
|
18
|
+
subscribe: 'type = "identify"',
|
|
19
|
+
partnerAction: 'identifyUser',
|
|
20
|
+
mapping: (0, actions_core_1.defaultValues)(identifyUser_1.default.fields),
|
|
21
|
+
type: 'automatic'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Record Event',
|
|
25
|
+
subscribe: 'type = "track"',
|
|
26
|
+
partnerAction: 'recordEvent',
|
|
27
|
+
mapping: (0, actions_core_1.defaultValues)(recordEvent_1.default.fields),
|
|
28
|
+
type: 'automatic'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Visit Page',
|
|
32
|
+
subscribe: 'type = "page"',
|
|
33
|
+
partnerAction: 'visitPage',
|
|
34
|
+
mapping: (0, actions_core_1.defaultValues)(visitPage_1.default.fields),
|
|
35
|
+
type: 'automatic'
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
settings: {
|
|
39
|
+
customerId: {
|
|
40
|
+
description: 'Your FullSession Customer ID. You can find this in your FullSession dashboard under Settings .',
|
|
41
|
+
label: 'Customer ID',
|
|
42
|
+
type: 'string',
|
|
43
|
+
required: true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
initialize: async ({ settings }, deps) => {
|
|
47
|
+
types_1.fullSessionTracker.initialize(settings.customerId);
|
|
48
|
+
await deps.resolveWhen(() => Object.prototype.hasOwnProperty.call(window, 'FUS'), 1000);
|
|
49
|
+
return types_1.fullSessionTracker;
|
|
50
|
+
},
|
|
51
|
+
actions: {
|
|
52
|
+
identifyUser: identifyUser_1.default,
|
|
53
|
+
recordEvent: recordEvent_1.default,
|
|
54
|
+
visitPage: visitPage_1.default
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.default = (0, shim_1.browserDestination)(exports.destination);
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
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AAA;QACvF,OAAO,0BAAkB,CAAA;IAC3B,CAAC;IAED,OAAO,EAAE;QACP,YAAY,EAAZ,sBAAY;QACZ,WAAW,EAAX,qBAAW;QACX,SAAS,EAAT,mBAAS;KACV;CACF,CAAA;AAED,kBAAe,IAAA,yBAAkB,EAAC,mBAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/recordEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import type { FUS } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FUS, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Track Event',
|
|
5
|
+
description: 'Track custom events and user interactions in FullSession for behavioral analysis.',
|
|
6
|
+
platform: 'web',
|
|
7
|
+
defaultSubscription: 'type = "track"',
|
|
8
|
+
fields: {
|
|
9
|
+
name: {
|
|
10
|
+
description: 'The name of the event being tracked.',
|
|
11
|
+
label: 'Event Name',
|
|
12
|
+
required: true,
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.event'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
properties: {
|
|
19
|
+
description: 'Additional properties and metadata associated with the event.',
|
|
20
|
+
label: 'Event Properties',
|
|
21
|
+
required: false,
|
|
22
|
+
type: 'object',
|
|
23
|
+
default: {
|
|
24
|
+
'@path': '$.properties'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
perform: (FUS, data) => {
|
|
29
|
+
const { name, properties } = data.payload;
|
|
30
|
+
FUS.event(name, (properties ?? {}));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.default = action;
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/recordEvent/index.ts"],"names":[],"mappings":";;AAKA,MAAM,MAAM,GAAoD;IAC9D,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,mFAAmF;IAChG,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,WAAW,EAAE,sCAAsC;YACnD,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,UAAU,EAAE;YACV,WAAW,EAAE,+DAA+D;YAC5E,KAAK,EAAE,kBAAkB;YACzB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;KACF;IACD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QACzC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU,IAAI,EAAE,CAAoB,CAAC,CAAA;IACxD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fullSessionTracker } from 'fullsession';
|
|
2
|
+
type CustomEventData = {
|
|
3
|
+
[key: string]: string | number;
|
|
4
|
+
[stringKey: `${string}_str`]: string;
|
|
5
|
+
[numberKey: `${string}_real`]: number;
|
|
6
|
+
};
|
|
7
|
+
type UserCustomAttributes = {
|
|
8
|
+
[attribute: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export type FUS = typeof fullSessionTracker;
|
|
11
|
+
export { fullSessionTracker, CustomEventData, UserCustomAttributes };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fullSessionTracker = void 0;
|
|
4
|
+
const fullsession_1 = require("fullsession");
|
|
5
|
+
Object.defineProperty(exports, "fullSessionTracker", { enumerable: true, get: function () { return fullsession_1.fullSessionTracker; } });
|
|
6
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAavC,mGAbA,gCAAkB,OAaA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/visitPage/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import type { FUS } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FUS, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Page View',
|
|
5
|
+
description: 'Track page views and set page-specific attributes in FullSession for navigation analysis.',
|
|
6
|
+
defaultSubscription: 'type = "page"',
|
|
7
|
+
platform: 'web',
|
|
8
|
+
fields: {
|
|
9
|
+
properties: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
required: false,
|
|
12
|
+
description: 'Properties and metadata associated with the page being viewed',
|
|
13
|
+
label: 'Page Properties',
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.properties'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
perform: (FUS, data) => {
|
|
20
|
+
const { properties } = data.payload;
|
|
21
|
+
FUS.setPageAttributes({
|
|
22
|
+
...properties
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.default = action;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/visitPage/index.ts"],"names":[],"mappings":";;AAMA,MAAM,MAAM,GAAoD;IAC9D,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,2FAA2F;IACxG,mBAAmB,EAAE,eAAe;IACpC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+DAA+D;YAC5E,KAAK,EAAE,iBAAiB;YACxB,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;KACF;IACD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QACnC,GAAG,CAAC,iBAAiB,CAAC;YACpB,GAAG,UAAU;SACU,CAAC,CAAA;IAC5B,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../src/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/identifyUser/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import { FUS } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FUS, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
title: 'Identify User',
|
|
3
|
+
description: 'Identify users and set their properties in FullSession.',
|
|
4
|
+
platform: 'web',
|
|
5
|
+
defaultSubscription: 'type = "identify"',
|
|
6
|
+
fields: {
|
|
7
|
+
userId: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
required: false,
|
|
10
|
+
description: "The user's unique identifier.",
|
|
11
|
+
label: 'User ID',
|
|
12
|
+
default: {
|
|
13
|
+
'@path': '$.userId'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
anonymousId: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
required: false,
|
|
19
|
+
description: "The user's anonymous identifier when no user ID is available.",
|
|
20
|
+
label: 'Anonymous ID',
|
|
21
|
+
default: {
|
|
22
|
+
'@path': '$.anonymousId'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
traits: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
required: false,
|
|
28
|
+
description: 'User traits and properties to be sent to FullSession.',
|
|
29
|
+
label: 'User Traits',
|
|
30
|
+
default: {
|
|
31
|
+
'@path': '$.traits'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
perform: (FUS, data) => {
|
|
36
|
+
const { userId, anonymousId, traits = {} } = data.payload;
|
|
37
|
+
const identifyTraits = {
|
|
38
|
+
name: traits.name ?? '',
|
|
39
|
+
email: traits.email ?? ''
|
|
40
|
+
};
|
|
41
|
+
FUS.identify(userId ?? anonymousId, identifyTraits);
|
|
42
|
+
const { name: _ignoredName, email: _ignoredEmail, ...restTraits } = traits || {};
|
|
43
|
+
const sessionAttributes = {
|
|
44
|
+
...restTraits,
|
|
45
|
+
...(anonymousId ? { segmentAnonymousId: anonymousId } : {})
|
|
46
|
+
};
|
|
47
|
+
FUS.setSessionAttributes(sessionAttributes);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export default action;
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identifyUser/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAoD;IAC9D,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,yDAAyD;IACtE,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+BAA+B;YAC5C,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+DAA+D;YAC5E,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE;gBACP,OAAO,EAAE,eAAe;aACzB;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uDAAuD;YACpE,KAAK,EAAE,aAAa;YACpB,OAAO,EAAE;gBACP,OAAO,EAAE,UAAU;aACpB;SACF;KACF;IACD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QAGzD,MAAM,cAAc,GAAG;YACrB,IAAI,EAAG,MAAM,CAAC,IAAe,IAAI,EAAE;YACnC,KAAK,EAAG,MAAM,CAAC,KAAgB,IAAI,EAAE;SACtC,CAAA;QAID,GAAG,CAAC,QAAQ,CAAC,MAAM,IAAK,WAAsB,EAAE,cAAc,CAAC,CAAA;QAG/D,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;QAGhF,MAAM,iBAAiB,GAAG;YACxB,GAAG,UAAU;YACb,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5D,CAAA;QAED,GAAG,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Settings } from './generated-types';
|
|
2
|
+
import type { BrowserDestinationDefinition } from '@segment/browser-destination-runtime/types';
|
|
3
|
+
import type { FUS } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
FUS: FUS;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const destination: BrowserDestinationDefinition<Settings, FUS>;
|
|
10
|
+
declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { browserDestination } from '@segment/browser-destination-runtime/shim';
|
|
2
|
+
import { fullSessionTracker } from './types';
|
|
3
|
+
import identifyUser from './identifyUser';
|
|
4
|
+
import { defaultValues } from '@segment/actions-core';
|
|
5
|
+
import recordEvent from './recordEvent';
|
|
6
|
+
import visitPage from './visitPage';
|
|
7
|
+
export const destination = {
|
|
8
|
+
name: 'FullSession',
|
|
9
|
+
slug: 'actions-fullsession',
|
|
10
|
+
mode: 'device',
|
|
11
|
+
presets: [
|
|
12
|
+
{
|
|
13
|
+
name: 'Identify User',
|
|
14
|
+
subscribe: 'type = "identify"',
|
|
15
|
+
partnerAction: 'identifyUser',
|
|
16
|
+
mapping: defaultValues(identifyUser.fields),
|
|
17
|
+
type: 'automatic'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Record Event',
|
|
21
|
+
subscribe: 'type = "track"',
|
|
22
|
+
partnerAction: 'recordEvent',
|
|
23
|
+
mapping: defaultValues(recordEvent.fields),
|
|
24
|
+
type: 'automatic'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Visit Page',
|
|
28
|
+
subscribe: 'type = "page"',
|
|
29
|
+
partnerAction: 'visitPage',
|
|
30
|
+
mapping: defaultValues(visitPage.fields),
|
|
31
|
+
type: 'automatic'
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
settings: {
|
|
35
|
+
customerId: {
|
|
36
|
+
description: 'Your FullSession Customer ID. You can find this in your FullSession dashboard under Settings .',
|
|
37
|
+
label: 'Customer ID',
|
|
38
|
+
type: 'string',
|
|
39
|
+
required: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
initialize: async ({ settings }, deps) => {
|
|
43
|
+
fullSessionTracker.initialize(settings.customerId);
|
|
44
|
+
await deps.resolveWhen(() => Object.prototype.hasOwnProperty.call(window, 'FUS'), 1000);
|
|
45
|
+
return fullSessionTracker;
|
|
46
|
+
},
|
|
47
|
+
actions: {
|
|
48
|
+
identifyUser,
|
|
49
|
+
recordEvent,
|
|
50
|
+
visitPage
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export default browserDestination(destination);
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAE9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,WAAW,MAAM,e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kB,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/recordEvent/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import type { FUS } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FUS, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
title: 'Track Event',
|
|
3
|
+
description: 'Track custom events and user interactions in FullSession for behavioral analysis.',
|
|
4
|
+
platform: 'web',
|
|
5
|
+
defaultSubscription: 'type = "track"',
|
|
6
|
+
fields: {
|
|
7
|
+
name: {
|
|
8
|
+
description: 'The name of the event being tracked.',
|
|
9
|
+
label: 'Event Name',
|
|
10
|
+
required: true,
|
|
11
|
+
type: 'string',
|
|
12
|
+
default: {
|
|
13
|
+
'@path': '$.event'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
properties: {
|
|
17
|
+
description: 'Additional properties and metadata associated with the event.',
|
|
18
|
+
label: 'Event Properties',
|
|
19
|
+
required: false,
|
|
20
|
+
type: 'object',
|
|
21
|
+
default: {
|
|
22
|
+
'@path': '$.properties'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
perform: (FUS, data) => {
|
|
27
|
+
const { name, properties } = data.payload;
|
|
28
|
+
FUS.event(name, (properties ?? {}));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export default action;
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/recordEvent/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAoD;IAC9D,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,mFAAmF;IAChG,QAAQ,EAAE,KAAK;IACf,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,WAAW,EAAE,sCAAsC;YACnD,KAAK,EAAE,YAAY;YACnB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,UAAU,EAAE;YACV,WAAW,EAAE,+DAA+D;YAC5E,KAAK,EAAE,kBAAkB;YACzB,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,cAAc;aACxB;SACF;KACF;IACD,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QACzC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU,IAAI,EAAE,CAAoB,CAAC,CAAA;IACxD,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { fullSessionTracker } from 'fullsession';
|
|
2
|
+
type CustomEventData = {
|
|
3
|
+
[key: string]: string | number;
|
|
4
|
+
[stringKey: `${string}_str`]: string;
|
|
5
|
+
[numberKey: `${string}_real`]: number;
|
|
6
|
+
};
|
|
7
|
+
type UserCustomAttributes = {
|
|
8
|
+
[attribute: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export type FUS = typeof fullSessionTracker;
|
|
11
|
+
export { fullSessionTracker, CustomEventData, UserCustomAttributes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAahD,OAAO,EAAE,kBAAkB,EAAyC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/visitPage/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types';
|
|
2
|
+
import type { Settings } from '../generated-types';
|
|
3
|
+
import type { Payload } from './generated-types';
|
|
4
|
+
import type { FUS } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, FUS, Payload>;
|
|
6
|
+
export default action;
|