@segment/analytics-browser-mixpanel-web-actions 1.0.1-staging-294d81392.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/alias/generated-types.d.ts +4 -0
- package/dist/cjs/alias/generated-types.js +3 -0
- package/dist/cjs/alias/generated-types.js.map +1 -0
- package/dist/cjs/alias/index.d.ts +6 -0
- package/dist/cjs/alias/index.js +32 -0
- package/dist/cjs/alias/index.js.map +1 -0
- package/dist/cjs/constants.d.ts +14 -0
- package/dist/cjs/constants.js +18 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/fields.d.ts +11 -0
- package/dist/cjs/fields.js +162 -0
- package/dist/cjs/fields.js.map +1 -0
- package/dist/cjs/functions.d.ts +7 -0
- package/dist/cjs/functions.js +39 -0
- package/dist/cjs/functions.js.map +1 -0
- package/dist/cjs/generated-types.d.ts +30 -0
- package/dist/cjs/generated-types.js +3 -0
- package/dist/cjs/generated-types.js.map +1 -0
- package/dist/cjs/group/generated-types.d.ts +16 -0
- package/dist/cjs/group/generated-types.js +3 -0
- package/dist/cjs/group/generated-types.js.map +1 -0
- package/dist/cjs/group/index.d.ts +6 -0
- package/dist/cjs/group/index.js +21 -0
- package/dist/cjs/group/index.js.map +1 -0
- package/dist/cjs/identify/generated-types.d.ts +19 -0
- package/dist/cjs/identify/generated-types.js +3 -0
- package/dist/cjs/identify/generated-types.js.map +1 -0
- package/dist/cjs/identify/index.d.ts +6 -0
- package/dist/cjs/identify/index.js +21 -0
- package/dist/cjs/identify/index.js.map +1 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +76 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/init-script.d.ts +1 -0
- package/dist/cjs/init-script.js +65 -0
- package/dist/cjs/init-script.js.map +1 -0
- package/dist/cjs/setting-fields.d.ts +2 -0
- package/dist/cjs/setting-fields.js +273 -0
- package/dist/cjs/setting-fields.js.map +1 -0
- package/dist/cjs/track/generated-types.d.ts +37 -0
- package/dist/cjs/track/generated-types.js +3 -0
- package/dist/cjs/track/generated-types.js.map +1 -0
- package/dist/cjs/track/index.d.ts +6 -0
- package/dist/cjs/track/index.js +93 -0
- package/dist/cjs/track/index.js.map +1 -0
- package/dist/cjs/trackPageView/generated-types.d.ts +37 -0
- package/dist/cjs/trackPageView/generated-types.js +3 -0
- package/dist/cjs/trackPageView/generated-types.js.map +1 -0
- package/dist/cjs/trackPageView/index.d.ts +6 -0
- package/dist/cjs/trackPageView/index.js +101 -0
- package/dist/cjs/trackPageView/index.js.map +1 -0
- package/dist/cjs/types.d.ts +68 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/alias/generated-types.d.ts +4 -0
- package/dist/esm/alias/generated-types.js +2 -0
- package/dist/esm/alias/generated-types.js.map +1 -0
- package/dist/esm/alias/index.d.ts +6 -0
- package/dist/esm/alias/index.js +30 -0
- package/dist/esm/alias/index.js.map +1 -0
- package/dist/esm/constants.d.ts +14 -0
- package/dist/esm/constants.js +15 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/fields.d.ts +11 -0
- package/dist/esm/fields.js +159 -0
- package/dist/esm/fields.js.map +1 -0
- package/dist/esm/functions.d.ts +7 -0
- package/dist/esm/functions.js +35 -0
- package/dist/esm/functions.js.map +1 -0
- package/dist/esm/generated-types.d.ts +30 -0
- package/dist/esm/generated-types.js +2 -0
- package/dist/esm/generated-types.js.map +1 -0
- package/dist/esm/group/generated-types.d.ts +16 -0
- package/dist/esm/group/generated-types.js +2 -0
- package/dist/esm/group/generated-types.js.map +1 -0
- package/dist/esm/group/index.d.ts +6 -0
- package/dist/esm/group/index.js +19 -0
- package/dist/esm/group/index.js.map +1 -0
- package/dist/esm/identify/generated-types.d.ts +19 -0
- package/dist/esm/identify/generated-types.js +2 -0
- package/dist/esm/identify/generated-types.js.map +1 -0
- package/dist/esm/identify/index.d.ts +6 -0
- package/dist/esm/identify/index.js +19 -0
- package/dist/esm/identify/index.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +72 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/init-script.d.ts +1 -0
- package/dist/esm/init-script.js +62 -0
- package/dist/esm/init-script.js.map +1 -0
- package/dist/esm/setting-fields.d.ts +2 -0
- package/dist/esm/setting-fields.js +270 -0
- package/dist/esm/setting-fields.js.map +1 -0
- package/dist/esm/track/generated-types.d.ts +37 -0
- package/dist/esm/track/generated-types.js +2 -0
- package/dist/esm/track/generated-types.js.map +1 -0
- package/dist/esm/track/index.d.ts +6 -0
- package/dist/esm/track/index.js +91 -0
- package/dist/esm/track/index.js.map +1 -0
- package/dist/esm/trackPageView/generated-types.d.ts +37 -0
- package/dist/esm/trackPageView/generated-types.js +2 -0
- package/dist/esm/trackPageView/generated-types.js.map +1 -0
- package/dist/esm/trackPageView/index.d.ts +6 -0
- package/dist/esm/trackPageView/index.js +99 -0
- package/dist/esm/trackPageView/index.js.map +1 -0
- package/dist/esm/types.d.ts +68 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +25 -0
- package/src/alias/__tests__/index.test.ts +95 -0
- package/src/alias/generated-types.ts +12 -0
- package/src/alias/index.ts +35 -0
- package/src/constants.ts +16 -0
- package/src/fields.ts +173 -0
- package/src/functions.ts +57 -0
- package/src/generated-types.ts +116 -0
- package/src/group/__tests__/index.test.ts +126 -0
- package/src/group/generated-types.ts +42 -0
- package/src/group/index.ts +29 -0
- package/src/identify/__tests__/index.test.ts +135 -0
- package/src/identify/generated-types.ts +54 -0
- package/src/identify/index.ts +29 -0
- package/src/index.ts +99 -0
- package/src/init-script.ts +63 -0
- package/src/setting-fields.ts +273 -0
- package/src/track/__tests__/index.test.ts +196 -0
- package/src/track/generated-types.ts +102 -0
- package/src/track/index.ts +109 -0
- package/src/trackPageView/__tests__/index.test.ts +250 -0
- package/src/trackPageView/generated-types.ts +102 -0
- package/src/trackPageView/index.ts +116 -0
- package/src/types.ts +78 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/trackPageView/index.ts"],"names":[],"mappings":";;AAIA,4CAAsD;AACtD,sCAWkB;AAElB,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,uCAAuC;IACpD,mBAAmB,EAAE,eAAe;IACpC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,UAAU,EAAE;YACV,GAAG,mBAAU;YACb,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,KAAK;SAChB;QACD,UAAU,EAAV,mBAAU;QACV,SAAS,EAAE;YACT,GAAG,kBAAS;YACZ,WAAW,EACT,gJAAgJ;YAClJ,OAAO,EAAE,SAAS;SACnB;QACD,8BAA8B,EAAE;YAC9B,GAAG,uCAA8B;YACjC,OAAO,EAAE;gBACP,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL,MAAM,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;wBAC5C,IAAI,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;wBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;qBACvC;iBACF;gBACD,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,MAAM,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;wBAClD,IAAI,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE;wBAChD,IAAI,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;qBAC7C;iBACF;gBACD,SAAS,EAAE;oBACT,KAAK,EAAE;wBACL,MAAM,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;wBACjD,IAAI,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;wBAC/C,IAAI,EAAE,EAAE,OAAO,EA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,EAAE,OAAO,CAAC,CAAA;QAC/B,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAC5B,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;QAC/C,IAAI,UAAU,EAAE,CAAC;YACf,QAAQ,CAAC,cAAc,CAAC,UAAU,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;QAC3D,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,cAAc,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { PAGE_VIEW_URL_CONFIG_OPTIONS, PERSISTENCE_OPTIONS, AUTOCAPTURE_OPTIONS } from './constants';
|
|
2
|
+
export type PageViewUrlConfigOption = typeof PAGE_VIEW_URL_CONFIG_OPTIONS[keyof typeof PAGE_VIEW_URL_CONFIG_OPTIONS];
|
|
3
|
+
export type PersistenceOptions = typeof PERSISTENCE_OPTIONS[keyof typeof PERSISTENCE_OPTIONS];
|
|
4
|
+
export type AutocaptureOptions = typeof AUTOCAPTURE_OPTIONS[keyof typeof AUTOCAPTURE_OPTIONS];
|
|
5
|
+
export interface Mixpanel {
|
|
6
|
+
init(token: string, config: Config, name?: string): Mixpanel;
|
|
7
|
+
track_pageview(properties?: {
|
|
8
|
+
[k: string]: unknown;
|
|
9
|
+
}, options?: {
|
|
10
|
+
event_name?: string | undefined;
|
|
11
|
+
}): void;
|
|
12
|
+
track(event_name: string, properties?: {
|
|
13
|
+
[k: string]: unknown;
|
|
14
|
+
}): void;
|
|
15
|
+
identify(unique_id?: string): void;
|
|
16
|
+
alias(alias: string, original?: string): void;
|
|
17
|
+
get_group(group_key: string, group_id: string): Group;
|
|
18
|
+
set_group(group_key: string, group_ids: string): void;
|
|
19
|
+
people: People;
|
|
20
|
+
}
|
|
21
|
+
export interface People {
|
|
22
|
+
set(prop: {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
}): void;
|
|
25
|
+
set_once(prop: {
|
|
26
|
+
[k: string]: unknown;
|
|
27
|
+
}): void;
|
|
28
|
+
increment(prop: {
|
|
29
|
+
[k: string]: unknown;
|
|
30
|
+
}): void;
|
|
31
|
+
}
|
|
32
|
+
export interface Group {
|
|
33
|
+
set(prop: {
|
|
34
|
+
[k: string]: unknown;
|
|
35
|
+
}): void;
|
|
36
|
+
set_once(prop: {
|
|
37
|
+
[k: string]: unknown;
|
|
38
|
+
}): void;
|
|
39
|
+
union(list_name: string, values: (string | number | boolean)[]): void;
|
|
40
|
+
}
|
|
41
|
+
export interface Config {
|
|
42
|
+
autocapture?: {
|
|
43
|
+
pageview?: PageViewUrlConfigOption;
|
|
44
|
+
click?: boolean;
|
|
45
|
+
dead_click?: boolean;
|
|
46
|
+
input?: boolean;
|
|
47
|
+
rage_click?: boolean;
|
|
48
|
+
scroll?: boolean;
|
|
49
|
+
submit?: boolean;
|
|
50
|
+
capture_text_content?: boolean;
|
|
51
|
+
} | boolean;
|
|
52
|
+
cross_subdomain_cookie?: boolean;
|
|
53
|
+
persistence?: PersistenceOptions;
|
|
54
|
+
track_marketing?: boolean;
|
|
55
|
+
cookie_expiration?: number;
|
|
56
|
+
disable_persistence?: boolean;
|
|
57
|
+
ip?: boolean;
|
|
58
|
+
record_block_class?: string;
|
|
59
|
+
record_block_selector?: string;
|
|
60
|
+
record_canvas?: boolean;
|
|
61
|
+
record_heatmap_data?: boolean;
|
|
62
|
+
record_idle_timeout_ms?: number;
|
|
63
|
+
record_mask_text_class?: string;
|
|
64
|
+
record_mask_text_selectors?: string;
|
|
65
|
+
record_max_ms?: number;
|
|
66
|
+
record_min_ms?: number;
|
|
67
|
+
record_sessions_percent?: number;
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/alias/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 { Mixpanel } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Mixpanel, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const action = {
|
|
2
|
+
title: 'Identify',
|
|
3
|
+
description: 'Sync user profile data to Mixpanel.',
|
|
4
|
+
defaultSubscription: 'type = "identify"',
|
|
5
|
+
platform: 'web',
|
|
6
|
+
fields: {
|
|
7
|
+
alias: {
|
|
8
|
+
label: 'Alias ID',
|
|
9
|
+
description: 'The new ID to associate with the user.',
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: true,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
default: { '@path': '$.userId' }
|
|
14
|
+
},
|
|
15
|
+
original: {
|
|
16
|
+
label: 'Original ID',
|
|
17
|
+
description: 'The original ID to associate with the user.',
|
|
18
|
+
type: 'string',
|
|
19
|
+
required: true,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
default: { '@path': '$.previousId' }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
perform: (mixpanel, { payload }) => {
|
|
25
|
+
const { alias, original } = payload;
|
|
26
|
+
mixpanel.alias(alias, original);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export default action;
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/alias/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;KACF;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QACnC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const PAGE_VIEW_URL_CONFIG_OPTIONS: {
|
|
2
|
+
readonly FULL_URL: "full-url";
|
|
3
|
+
readonly URL_WITH_PATH_AND_QUERY_STRING: "url-with-path-and-query-string";
|
|
4
|
+
readonly URL_WITH_PATH: "url-with-path";
|
|
5
|
+
};
|
|
6
|
+
export declare const PERSISTENCE_OPTIONS: {
|
|
7
|
+
readonly LOCAL_STORAGE: "localStorage";
|
|
8
|
+
readonly COOKIE: "cookie";
|
|
9
|
+
};
|
|
10
|
+
export declare const AUTOCAPTURE_OPTIONS: {
|
|
11
|
+
readonly ENABLED: "enabled";
|
|
12
|
+
readonly DISABLED: "disabled";
|
|
13
|
+
readonly CUSTOM: "custom";
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const PAGE_VIEW_URL_CONFIG_OPTIONS = {
|
|
2
|
+
FULL_URL: 'full-url',
|
|
3
|
+
URL_WITH_PATH_AND_QUERY_STRING: 'url-with-path-and-query-string',
|
|
4
|
+
URL_WITH_PATH: 'url-with-path'
|
|
5
|
+
};
|
|
6
|
+
export const PERSISTENCE_OPTIONS = {
|
|
7
|
+
LOCAL_STORAGE: 'localStorage',
|
|
8
|
+
COOKIE: 'cookie'
|
|
9
|
+
};
|
|
10
|
+
export const AUTOCAPTURE_OPTIONS = {
|
|
11
|
+
ENABLED: 'enabled',
|
|
12
|
+
DISABLED: 'disabled',
|
|
13
|
+
CUSTOM: 'custom'
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,QAAQ,EAAE,UAAU;IACpB,8BAA8B,EAAE,gCAAgC;IAChE,aAAa,EAAE,eAAe;CACtB,CAAA;AAEV,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,aAAa,EAAE,cAAc;IAC7B,MAAM,EAAE,QAAQ;CACR,CAAA;AAEV,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACR,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core';
|
|
2
|
+
export declare const event_name: InputField;
|
|
3
|
+
export declare const properties: InputField;
|
|
4
|
+
export declare const unique_id: InputField;
|
|
5
|
+
export declare const user_profile_properties_to_set: InputField;
|
|
6
|
+
export declare const user_profile_properties_to_set_once: InputField;
|
|
7
|
+
export declare const user_profile_properties_to_increment: InputField;
|
|
8
|
+
export declare const group_details: InputField;
|
|
9
|
+
export declare const group_profile_properties_to_set: InputField;
|
|
10
|
+
export declare const group_profile_properties_to_set_once: InputField;
|
|
11
|
+
export declare const group_profile_properties_to_union: InputField;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
export const event_name = {
|
|
2
|
+
label: 'Event Name',
|
|
3
|
+
description: 'The name of the event to track in Mixpanel.',
|
|
4
|
+
required: true,
|
|
5
|
+
type: 'string',
|
|
6
|
+
default: { '@path': '$.event' }
|
|
7
|
+
};
|
|
8
|
+
export const properties = {
|
|
9
|
+
label: 'Event Properties',
|
|
10
|
+
description: 'Properties to associate with the event.',
|
|
11
|
+
required: false,
|
|
12
|
+
type: 'object',
|
|
13
|
+
default: { '@path': '$.properties' }
|
|
14
|
+
};
|
|
15
|
+
export const unique_id = {
|
|
16
|
+
label: 'Unique ID',
|
|
17
|
+
description: 'The unique ID to associate with the user.',
|
|
18
|
+
required: true,
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: { '@path': '$.userId' }
|
|
21
|
+
};
|
|
22
|
+
export const user_profile_properties_to_set = {
|
|
23
|
+
label: 'User Profile Properties to Set',
|
|
24
|
+
description: 'User Profile Properties to set on the user profile in Mixpanel.',
|
|
25
|
+
required: false,
|
|
26
|
+
defaultObjectUI: 'keyvalue',
|
|
27
|
+
additionalProperties: true,
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
name: {
|
|
31
|
+
label: 'Name',
|
|
32
|
+
description: 'The name of the user.',
|
|
33
|
+
type: 'string'
|
|
34
|
+
},
|
|
35
|
+
first_name: {
|
|
36
|
+
label: 'First Name',
|
|
37
|
+
description: 'The first name of the user.',
|
|
38
|
+
type: 'string'
|
|
39
|
+
},
|
|
40
|
+
last_name: {
|
|
41
|
+
label: 'Last Name',
|
|
42
|
+
description: 'The last name of the user.',
|
|
43
|
+
type: 'string'
|
|
44
|
+
},
|
|
45
|
+
email: {
|
|
46
|
+
label: 'Email',
|
|
47
|
+
description: 'The email of the user.',
|
|
48
|
+
type: 'string',
|
|
49
|
+
format: 'email'
|
|
50
|
+
},
|
|
51
|
+
phone: {
|
|
52
|
+
label: 'Phone',
|
|
53
|
+
description: 'The phone number of the user.',
|
|
54
|
+
type: 'string'
|
|
55
|
+
},
|
|
56
|
+
avatar: {
|
|
57
|
+
label: 'Avatar',
|
|
58
|
+
description: 'The avatar URL of the user.',
|
|
59
|
+
type: 'string',
|
|
60
|
+
format: 'uri'
|
|
61
|
+
},
|
|
62
|
+
created: {
|
|
63
|
+
label: 'Created',
|
|
64
|
+
description: 'The creation date of the user profile.',
|
|
65
|
+
type: 'string',
|
|
66
|
+
format: 'date-time'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
default: {
|
|
70
|
+
name: { '@path': '$.traits.name' },
|
|
71
|
+
first_name: { '@path': '$.traits.first_name' },
|
|
72
|
+
last_name: { '@path': '$.traits.last_name' },
|
|
73
|
+
email: { '@path': '$.traits.email' },
|
|
74
|
+
phone: { '@path': '$.traits.phone' },
|
|
75
|
+
avatar: { '@path': '$.traits.avatar' },
|
|
76
|
+
created: { '@path': '$.traits.created' }
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export const user_profile_properties_to_set_once = {
|
|
80
|
+
label: 'User Profile Properties to Set Once',
|
|
81
|
+
description: 'User Profile Properties to set once on the user profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
82
|
+
required: false,
|
|
83
|
+
defaultObjectUI: 'keyvalue',
|
|
84
|
+
type: 'object'
|
|
85
|
+
};
|
|
86
|
+
export const user_profile_properties_to_increment = {
|
|
87
|
+
label: 'User Profile Properties to Increment',
|
|
88
|
+
description: 'User Profile Properties to increment on the user profile in Mixpanel. Values must be numeric.',
|
|
89
|
+
required: false,
|
|
90
|
+
defaultObjectUI: 'keyvalue',
|
|
91
|
+
type: 'object'
|
|
92
|
+
};
|
|
93
|
+
export const group_details = {
|
|
94
|
+
label: 'Group Details',
|
|
95
|
+
description: 'Details for the group to be created or updated in Mixpanel.',
|
|
96
|
+
type: 'object',
|
|
97
|
+
defaultObjectUI: 'keyvalue:only',
|
|
98
|
+
additionalProperties: false,
|
|
99
|
+
required: true,
|
|
100
|
+
properties: {
|
|
101
|
+
group_key: {
|
|
102
|
+
label: 'Group Key',
|
|
103
|
+
description: 'The Group Key / type of group to associate with the user. This group key should already be defined in your Mixpanel project.',
|
|
104
|
+
required: true,
|
|
105
|
+
type: 'string'
|
|
106
|
+
},
|
|
107
|
+
group_id: {
|
|
108
|
+
label: 'Group ID',
|
|
109
|
+
description: 'The unique ID to associate with the group.',
|
|
110
|
+
required: true,
|
|
111
|
+
type: 'string'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
default: {
|
|
115
|
+
group_key: { '@path': '$.traits.group_key' },
|
|
116
|
+
group_id: { '@path': '$.groupId' }
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
export const group_profile_properties_to_set = {
|
|
120
|
+
label: 'Group properties to Set',
|
|
121
|
+
description: 'Group Profile Properties to set on the group in Mixpanel.',
|
|
122
|
+
required: false,
|
|
123
|
+
defaultObjectUI: 'keyvalue',
|
|
124
|
+
type: 'object'
|
|
125
|
+
};
|
|
126
|
+
export const group_profile_properties_to_set_once = {
|
|
127
|
+
label: 'Group properties to set once',
|
|
128
|
+
description: 'Group Profile Properties to set once on the group profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
129
|
+
required: false,
|
|
130
|
+
defaultObjectUI: 'keyvalue',
|
|
131
|
+
type: 'object'
|
|
132
|
+
};
|
|
133
|
+
export const group_profile_properties_to_union = {
|
|
134
|
+
label: 'Group list properties to union',
|
|
135
|
+
description: 'Merge a list into a list group property. Duplicates will be removed.',
|
|
136
|
+
required: false,
|
|
137
|
+
type: 'object',
|
|
138
|
+
multiple: true,
|
|
139
|
+
defaultObjectUI: 'arrayeditor',
|
|
140
|
+
additionalProperties: false,
|
|
141
|
+
properties: {
|
|
142
|
+
list_name: {
|
|
143
|
+
label: 'List Name',
|
|
144
|
+
description: 'The name of the list property to union values into.',
|
|
145
|
+
type: 'string',
|
|
146
|
+
allowNull: false,
|
|
147
|
+
required: true
|
|
148
|
+
},
|
|
149
|
+
string_values: {
|
|
150
|
+
label: 'Values',
|
|
151
|
+
description: 'An array of string values to merge into the list. Non string lists cannot be updated. Duplicates will be removed.',
|
|
152
|
+
type: 'string',
|
|
153
|
+
required: true,
|
|
154
|
+
allowNull: false,
|
|
155
|
+
multiple: true
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/fields.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;CAChC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;CACrC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC,KAAK,EAAE,WAAW;IAClB,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;CACjC,CAAA;AAED,MAAM,CAAC,MAAM,8BAA8B,GAAe;IACxD,KAAK,EAAE,gCAAgC;IACvC,WAAW,EAAE,iEAAiE;IAC9E,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,UAAU;IAC3B,oBAAoB,EAAE,IAAI;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;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e;IAC3D,KAAK,EAAE,gCAAgC;IACvC,WAAW,EAAE,sEAAsE;IACnF,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,IAAI;IACd,eAAe,EAAE,aAAa;IAC9B,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,qDAAqD;YAClE,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,aAAa,EAAE;YACb,KAAK,EAAE,QAAQ;YACf,WAAW,EACT,mHAAmH;YACrH,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,IAAI;SACf;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Payload as GroupPayload } from './group/generated-types';
|
|
2
|
+
import { Payload as TrackPayload } from './track/generated-types';
|
|
3
|
+
import { Payload as IdentifyPayload } from './identify/generated-types';
|
|
4
|
+
import { Payload as TrackPageViewPayload } from './trackPageView/generated-types';
|
|
5
|
+
import type { Mixpanel } from './types';
|
|
6
|
+
export declare function sendIdentify(mixpanel: Mixpanel, payload: IdentifyPayload | TrackPayload | TrackPageViewPayload): void;
|
|
7
|
+
export declare function sendGroup(mixpanel: Mixpanel, payload: GroupPayload | TrackPayload | TrackPageViewPayload): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function sendIdentify(mixpanel, payload) {
|
|
2
|
+
const { unique_id, user_profile_properties_to_set, user_profile_properties_to_set_once, user_profile_properties_to_increment } = payload;
|
|
3
|
+
if (unique_id) {
|
|
4
|
+
mixpanel.identify(unique_id);
|
|
5
|
+
}
|
|
6
|
+
if (user_profile_properties_to_set && Object.keys(user_profile_properties_to_set).length > 0) {
|
|
7
|
+
mixpanel.people.set(user_profile_properties_to_set);
|
|
8
|
+
}
|
|
9
|
+
if (user_profile_properties_to_set_once && Object.keys(user_profile_properties_to_set_once).length > 0) {
|
|
10
|
+
mixpanel.people.set_once(user_profile_properties_to_set_once);
|
|
11
|
+
}
|
|
12
|
+
if (user_profile_properties_to_increment && Object.keys(user_profile_properties_to_increment).length > 0) {
|
|
13
|
+
mixpanel.people.increment(user_profile_properties_to_increment);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function sendGroup(mixpanel, payload) {
|
|
17
|
+
const { group_details: { group_key, group_id } = {}, group_profile_properties_to_set, group_profile_properties_to_set_once, group_profile_properties_to_union } = payload;
|
|
18
|
+
if (group_key && group_id) {
|
|
19
|
+
mixpanel.set_group(group_key, group_id);
|
|
20
|
+
const group = mixpanel.get_group(group_key, group_id);
|
|
21
|
+
if (group_profile_properties_to_set && Object.keys(group_profile_properties_to_set).length > 0) {
|
|
22
|
+
group.set(group_profile_properties_to_set);
|
|
23
|
+
}
|
|
24
|
+
if (group_profile_properties_to_set_once && Object.keys(group_profile_properties_to_set_once).length > 0) {
|
|
25
|
+
group.set_once(group_profile_properties_to_set_once);
|
|
26
|
+
}
|
|
27
|
+
if (group_profile_properties_to_union && group_profile_properties_to_union.length > 0) {
|
|
28
|
+
group_profile_properties_to_union.forEach((item) => {
|
|
29
|
+
const { list_name, string_values } = item;
|
|
30
|
+
group.union(list_name, string_values);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,YAAY,CAAC,QAAkB,EAAE,OAA8D;IAC7G,MAAM,EACJ,SAAS,EACT,8BAA8B,EAC9B,mCAAmC,EACnC,oCAAoC,EACrC,GAAG,OAAO,CAAA;IAEX,IAAI,SAAS,EAAE,CAAC;QACd,QAAQ,CAAC,QAAQ,CA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K,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAA;QACtD,CAAC;QACD,IAAI,iCAAiC,IAAI,iCAAiC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtF,iCAAiC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACjD,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;gBACzC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;YACvC,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface Settings {
|
|
2
|
+
projectToken: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
api_host: string;
|
|
5
|
+
autocapture?: string;
|
|
6
|
+
pageview: string;
|
|
7
|
+
click: boolean;
|
|
8
|
+
dead_click: boolean;
|
|
9
|
+
input: boolean;
|
|
10
|
+
rage_click: boolean;
|
|
11
|
+
scroll: boolean;
|
|
12
|
+
submit?: boolean;
|
|
13
|
+
capture_text_content: boolean;
|
|
14
|
+
cross_subdomain_cookie?: boolean;
|
|
15
|
+
persistence?: string;
|
|
16
|
+
track_marketing?: boolean;
|
|
17
|
+
cookie_expiration?: number;
|
|
18
|
+
disable_persistence?: boolean;
|
|
19
|
+
ip?: boolean;
|
|
20
|
+
record_block_class?: string;
|
|
21
|
+
record_block_selector?: string;
|
|
22
|
+
record_canvas?: boolean;
|
|
23
|
+
record_heatmap_data?: boolean;
|
|
24
|
+
record_idle_timeout_ms?: number;
|
|
25
|
+
record_mask_text_class?: string;
|
|
26
|
+
record_mask_text_selector?: string;
|
|
27
|
+
record_max_ms?: number;
|
|
28
|
+
record_min_ms?: number;
|
|
29
|
+
record_sessions_percent?: number;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../src/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
group_details: {
|
|
3
|
+
group_key: string;
|
|
4
|
+
group_id: string;
|
|
5
|
+
};
|
|
6
|
+
group_profile_properties_to_set?: {
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
group_profile_properties_to_set_once?: {
|
|
10
|
+
[k: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
group_profile_properties_to_union?: {
|
|
13
|
+
list_name: string;
|
|
14
|
+
string_values: string[];
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/group/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 { Mixpanel } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Mixpanel, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sendGroup } from '../functions';
|
|
2
|
+
import { group_details, group_profile_properties_to_set, group_profile_properties_to_set_once, group_profile_properties_to_union } from '../fields';
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Group',
|
|
5
|
+
description: 'Sync Group data to Mixpanel.',
|
|
6
|
+
defaultSubscription: 'type = "group"',
|
|
7
|
+
platform: 'web',
|
|
8
|
+
fields: {
|
|
9
|
+
group_details,
|
|
10
|
+
group_profile_properties_to_set,
|
|
11
|
+
group_profile_properties_to_set_once,
|
|
12
|
+
group_profile_properties_to_union
|
|
13
|
+
},
|
|
14
|
+
perform: (mixpanel, { payload }) => {
|
|
15
|
+
sendGroup(mixpanel, payload);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default action;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/group/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EACL,aAAa,EACb,+BAA+B,EAC/B,oCAAoC,EACpC,iCAAiC,EAClC,MAAM,WAAW,CAAA;AAElB,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,8BAA8B;IAC3C,mBAAmB,EAAE,gBAAgB;IACrC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,aAAa;QACb,+BAA+B;QAC/B,oCAAoC;QACpC,iCAAiC;KAClC;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
unique_id: string;
|
|
3
|
+
user_profile_properties_to_set?: {
|
|
4
|
+
name?: string;
|
|
5
|
+
first_name?: string;
|
|
6
|
+
last_name?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
phone?: string;
|
|
9
|
+
avatar?: string;
|
|
10
|
+
created?: string;
|
|
11
|
+
[k: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
user_profile_properties_to_set_once?: {
|
|
14
|
+
[k: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
user_profile_properties_to_increment?: {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/identify/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 { Mixpanel } from '../types';
|
|
5
|
+
declare const action: BrowserActionDefinition<Settings, Mixpanel, Payload>;
|
|
6
|
+
export default action;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sendIdentify } from '../functions';
|
|
2
|
+
import { unique_id, user_profile_properties_to_set, user_profile_properties_to_set_once, user_profile_properties_to_increment } from '../fields';
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Identify',
|
|
5
|
+
description: 'Sync user profile data to Mixpanel.',
|
|
6
|
+
defaultSubscription: 'type = "identify"',
|
|
7
|
+
platform: 'web',
|
|
8
|
+
fields: {
|
|
9
|
+
unique_id,
|
|
10
|
+
user_profile_properties_to_set,
|
|
11
|
+
user_profile_properties_to_set_once,
|
|
12
|
+
user_profile_properties_to_increment
|
|
13
|
+
},
|
|
14
|
+
perform: (mixpanel, { payload }) => {
|
|
15
|
+
sendIdentify(mixpanel, payload);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default action;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identify/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EACL,SAAS,EACT,8BAA8B,EAC9B,mCAAmC,EACnC,oCAAoC,EACrC,MAAM,WAAW,CAAA;AAElB,MAAM,MAAM,GAAyD;IACnE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE;QACN,SAAS;QACT,8BAA8B;QAC9B,mCAAmC;QACnC,oCAAoC;KACrC;IACD,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACjC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACjC,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 { Mixpanel } from './types';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
mixpanel: Mixpanel;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export declare const destination: BrowserDestinationDefinition<Settings, Mixpanel>;
|
|
10
|
+
declare const _default: import("@segment/browser-destination-runtime/types").PluginFactory;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { browserDestination } from '@segment/browser-destination-runtime/shim';
|
|
2
|
+
import { defaultValues } from '@segment/actions-core';
|
|
3
|
+
import { AUTOCAPTURE_OPTIONS } from './constants';
|
|
4
|
+
import { settingFields } from './setting-fields';
|
|
5
|
+
import track from './track';
|
|
6
|
+
import trackPageView from './trackPageView';
|
|
7
|
+
import identify from './identify';
|
|
8
|
+
import group from './group';
|
|
9
|
+
import alias from './alias';
|
|
10
|
+
import { initScript } from './init-script';
|
|
11
|
+
export const destination = {
|
|
12
|
+
name: 'Mixpanel Web (actions)',
|
|
13
|
+
slug: 'mixpanel-web-actions',
|
|
14
|
+
mode: 'device',
|
|
15
|
+
settings: settingFields,
|
|
16
|
+
initialize: async ({ settings }, deps) => {
|
|
17
|
+
await initScript();
|
|
18
|
+
await deps.resolveWhen(() => window?.mixpanel != null, 100);
|
|
19
|
+
const mixpanel = window.mixpanel;
|
|
20
|
+
const { projectToken, name, autocapture, pageview, click, dead_click, input, rage_click, scroll, submit, capture_text_content, persistence, ...rest } = settings;
|
|
21
|
+
const config = {
|
|
22
|
+
autocapture: autocapture === AUTOCAPTURE_OPTIONS.CUSTOM
|
|
23
|
+
? {
|
|
24
|
+
pageview: pageview,
|
|
25
|
+
click,
|
|
26
|
+
dead_click,
|
|
27
|
+
input,
|
|
28
|
+
rage_click,
|
|
29
|
+
scroll,
|
|
30
|
+
submit,
|
|
31
|
+
capture_text_content
|
|
32
|
+
}
|
|
33
|
+
: autocapture === AUTOCAPTURE_OPTIONS.ENABLED
|
|
34
|
+
? true
|
|
35
|
+
: false,
|
|
36
|
+
persistence: persistence,
|
|
37
|
+
...rest
|
|
38
|
+
};
|
|
39
|
+
if (name) {
|
|
40
|
+
mixpanel.init(projectToken, config, name);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
mixpanel.init(projectToken, config);
|
|
44
|
+
}
|
|
45
|
+
return mixpanel;
|
|
46
|
+
},
|
|
47
|
+
presets: [
|
|
48
|
+
{
|
|
49
|
+
name: 'Track',
|
|
50
|
+
subscribe: 'type = "track"',
|
|
51
|
+
partnerAction: 'track',
|
|
52
|
+
mapping: defaultValues(track.fields),
|
|
53
|
+
type: 'automatic'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Identify',
|
|
57
|
+
subscribe: 'type = "identify"',
|
|
58
|
+
partnerAction: 'identify',
|
|
59
|
+
mapping: defaultValues(identify.fields),
|
|
60
|
+
type: 'automatic'
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
actions: {
|
|
64
|
+
track,
|
|
65
|
+
trackPageView,
|
|
66
|
+
identify,
|
|
67
|
+
group,
|
|
68
|
+
alias
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
export default browserDestination(destination);
|
|
72
|
+
//# sourceMappingURL=index.js.map
|