@segment/analytics-browser-mixpanel-web-actions 1.0.1-staging-b870c2b86.0 → 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/dist/cjs/alias/index.js +3 -3
- package/dist/cjs/alias/index.js.map +1 -1
- package/dist/cjs/fields.js.map +1 -1
- package/dist/cjs/functions.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/init-script.js +15 -59
- package/dist/cjs/init-script.js.map +1 -1
- package/dist/cjs/setting-fields.js +1 -1
- package/dist/cjs/setting-fields.js.map +1 -1
- package/dist/cjs/track/index.js.map +1 -1
- package/dist/cjs/trackPageView/index.js.map +1 -1
- package/dist/esm/alias/index.js +3 -3
- package/dist/esm/alias/index.js.map +1 -1
- package/dist/esm/fields.js.map +1 -1
- package/dist/esm/functions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init-script.js +15 -59
- package/dist/esm/init-script.js.map +1 -1
- package/dist/esm/setting-fields.js +1 -1
- package/dist/esm/setting-fields.js.map +1 -1
- package/dist/esm/track/index.js.map +1 -1
- package/dist/esm/trackPageView/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/alias/__tests__/index.test.ts +3 -2
- package/src/alias/index.ts +3 -3
- package/src/constants.ts +1 -1
- package/src/fields.ts +134 -137
- package/src/functions.ts +10 -7
- package/src/group/__tests__/index.test.ts +7 -6
- package/src/group/index.ts +2 -2
- package/src/identify/__tests__/index.test.ts +13 -12
- package/src/identify/index.ts +3 -3
- package/src/index.ts +14 -14
- package/src/init-script.ts +2 -60
- package/src/setting-fields.ts +260 -260
- package/src/track/__tests__/index.test.ts +24 -23
- package/src/track/index.ts +6 -8
- package/src/trackPageView/__tests__/index.test.ts +35 -36
- package/src/trackPageView/index.ts +8 -10
- package/src/types.ts +18 -19
package/src/fields.ts
CHANGED
|
@@ -1,173 +1,170 @@
|
|
|
1
1
|
import { InputField } from '@segment/actions-core'
|
|
2
2
|
|
|
3
3
|
export const event_name: InputField = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
label: 'Event Name',
|
|
5
|
+
description: 'The name of the event to track in Mixpanel.',
|
|
6
|
+
required: true,
|
|
7
|
+
type: 'string',
|
|
8
|
+
default: { '@path': '$.event' }
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const properties: InputField =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export const properties: InputField ={
|
|
12
|
+
label: 'Event Properties',
|
|
13
|
+
description: 'Properties to associate with the event.',
|
|
14
|
+
required: false,
|
|
15
|
+
type: 'object',
|
|
16
|
+
default: { '@path': '$.properties'}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const unique_id: InputField = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
label: 'Unique ID',
|
|
21
|
+
description: 'The unique ID to associate with the user.',
|
|
22
|
+
required: true,
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: { '@path': '$.userId' }
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const user_profile_properties_to_set: InputField = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
label: 'User Profile Properties to Set',
|
|
29
|
+
description: 'User Profile Properties to set on the user profile in Mixpanel.',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultObjectUI: 'keyvalue',
|
|
32
|
+
additionalProperties: true,
|
|
33
|
+
type: 'object',
|
|
34
|
+
properties: {
|
|
35
|
+
name: {
|
|
36
|
+
label: 'Name',
|
|
37
|
+
description: 'The name of the user.',
|
|
38
|
+
type: 'string'
|
|
39
|
+
},
|
|
40
|
+
first_name: {
|
|
41
|
+
label: 'First Name',
|
|
42
|
+
description: 'The first name of the user.',
|
|
43
|
+
type: 'string'
|
|
44
|
+
},
|
|
45
|
+
last_name: {
|
|
46
|
+
label: 'Last Name',
|
|
47
|
+
description: 'The last name of the user.',
|
|
48
|
+
type: 'string'
|
|
49
|
+
},
|
|
50
|
+
email: {
|
|
51
|
+
label: 'Email',
|
|
52
|
+
description: 'The email of the user.',
|
|
53
|
+
type: 'string',
|
|
54
|
+
format: 'email'
|
|
55
|
+
},
|
|
56
|
+
phone: {
|
|
57
|
+
label: 'Phone',
|
|
58
|
+
description: 'The phone number of the user.',
|
|
59
|
+
type: 'string'
|
|
60
|
+
},
|
|
61
|
+
avatar: {
|
|
62
|
+
label: 'Avatar',
|
|
63
|
+
description: 'The avatar URL of the user.',
|
|
64
|
+
type: 'string',
|
|
65
|
+
format: 'uri'
|
|
66
|
+
},
|
|
67
|
+
created: {
|
|
68
|
+
label: 'Created',
|
|
69
|
+
description: 'The creation date of the user profile.',
|
|
70
|
+
type: 'string',
|
|
71
|
+
format: 'date-time'
|
|
72
|
+
}
|
|
39
73
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
type: 'string'
|
|
49
|
-
},
|
|
50
|
-
email: {
|
|
51
|
-
label: 'Email',
|
|
52
|
-
description: 'The email of the user.',
|
|
53
|
-
type: 'string',
|
|
54
|
-
format: 'email'
|
|
55
|
-
},
|
|
56
|
-
phone: {
|
|
57
|
-
label: 'Phone',
|
|
58
|
-
description: 'The phone number of the user.',
|
|
59
|
-
type: 'string'
|
|
60
|
-
},
|
|
61
|
-
avatar: {
|
|
62
|
-
label: 'Avatar',
|
|
63
|
-
description: 'The avatar URL of the user.',
|
|
64
|
-
type: 'string',
|
|
65
|
-
format: 'uri'
|
|
66
|
-
},
|
|
67
|
-
created: {
|
|
68
|
-
label: 'Created',
|
|
69
|
-
description: 'The creation date of the user profile.',
|
|
70
|
-
type: 'string',
|
|
71
|
-
format: 'date-time'
|
|
74
|
+
default: {
|
|
75
|
+
name: { '@path': '$.traits.name' },
|
|
76
|
+
first_name: { '@path': '$.traits.first_name' },
|
|
77
|
+
last_name: { '@path': '$.traits.last_name' },
|
|
78
|
+
email: { '@path': '$.traits.email' },
|
|
79
|
+
phone: { '@path': '$.traits.phone' },
|
|
80
|
+
avatar: { '@path': '$.traits.avatar' },
|
|
81
|
+
created: { '@path': '$.traits.created' }
|
|
72
82
|
}
|
|
73
|
-
},
|
|
74
|
-
default: {
|
|
75
|
-
name: { '@path': '$.traits.name' },
|
|
76
|
-
first_name: { '@path': '$.traits.first_name' },
|
|
77
|
-
last_name: { '@path': '$.traits.last_name' },
|
|
78
|
-
email: { '@path': '$.traits.email' },
|
|
79
|
-
phone: { '@path': '$.traits.phone' },
|
|
80
|
-
avatar: { '@path': '$.traits.avatar' },
|
|
81
|
-
created: { '@path': '$.traits.created' }
|
|
82
|
-
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export const user_profile_properties_to_set_once: InputField = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
type: 'object'
|
|
86
|
+
label: 'User Profile Properties to Set Once',
|
|
87
|
+
description: 'User Profile Properties to set once on the user profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
88
|
+
required: false,
|
|
89
|
+
defaultObjectUI: 'keyvalue',
|
|
90
|
+
type: 'object'
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
export const user_profile_properties_to_increment: InputField =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
export const user_profile_properties_to_increment: InputField = {
|
|
94
|
+
label: 'User Profile Properties to Increment',
|
|
95
|
+
description: 'User Profile Properties to increment on the user profile in Mixpanel. Values must be numeric.',
|
|
96
|
+
required: false,
|
|
97
|
+
defaultObjectUI: 'keyvalue',
|
|
98
|
+
type: 'object'
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
export const group_details: InputField = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
label: 'Group Details',
|
|
103
|
+
description: 'Details for the group to be created or updated in Mixpanel.',
|
|
104
|
+
type: 'object',
|
|
105
|
+
defaultObjectUI: 'keyvalue:only',
|
|
106
|
+
additionalProperties: false,
|
|
107
|
+
required: true,
|
|
108
|
+
properties: {
|
|
110
109
|
group_key: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
type: 'string'
|
|
110
|
+
label: 'Group Key',
|
|
111
|
+
description: 'The Group Key / type of group to associate with the user. This group key should already be defined in your Mixpanel project.',
|
|
112
|
+
required: true,
|
|
113
|
+
type: 'string'
|
|
116
114
|
},
|
|
117
115
|
group_id: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
label: 'Group ID',
|
|
117
|
+
description: 'The unique ID to associate with the group.',
|
|
118
|
+
required: true,
|
|
119
|
+
type: 'string'
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
default: {
|
|
123
|
+
group_key: { '@path': '$.traits.group_key' },
|
|
124
|
+
group_id: { '@path': '$.groupId' }
|
|
122
125
|
}
|
|
123
|
-
},
|
|
124
|
-
default: {
|
|
125
|
-
group_key: { '@path': '$.traits.group_key' },
|
|
126
|
-
group_id: { '@path': '$.groupId' }
|
|
127
|
-
}
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
export const group_profile_properties_to_set: InputField = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
label: 'Group properties to Set',
|
|
130
|
+
description: 'Group Profile Properties to set on the group in Mixpanel.',
|
|
131
|
+
required: false,
|
|
132
|
+
defaultObjectUI: 'keyvalue',
|
|
133
|
+
type: 'object'
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
export const group_profile_properties_to_set_once: InputField = {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
type: 'object'
|
|
137
|
+
label: 'Group properties to set once',
|
|
138
|
+
description: 'Group Profile Properties to set once on the group profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
139
|
+
required: false,
|
|
140
|
+
defaultObjectUI: 'keyvalue',
|
|
141
|
+
type: 'object'
|
|
145
142
|
}
|
|
146
143
|
|
|
147
144
|
export const group_profile_properties_to_union: InputField = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
145
|
+
label: 'Group list properties to union',
|
|
146
|
+
description: 'Merge a list into a list group property. Duplicates will be removed.',
|
|
147
|
+
required: false,
|
|
148
|
+
type: 'object',
|
|
149
|
+
multiple: true,
|
|
150
|
+
defaultObjectUI: 'arrayeditor',
|
|
151
|
+
additionalProperties: false,
|
|
152
|
+
properties: {
|
|
153
|
+
list_name: {
|
|
154
|
+
label: 'List Name',
|
|
155
|
+
description: 'The name of the list property to union values into.',
|
|
156
|
+
type: 'string',
|
|
157
|
+
allowNull: false,
|
|
158
|
+
required: true
|
|
159
|
+
},
|
|
160
|
+
string_values: {
|
|
161
|
+
label: 'Values',
|
|
162
|
+
description: 'An array of string values to merge into the list. Non string lists cannot be updated. Duplicates will be removed.',
|
|
163
|
+
type: 'string',
|
|
164
|
+
required: true,
|
|
165
|
+
allowNull: false,
|
|
166
|
+
multiple: true
|
|
167
|
+
}
|
|
171
168
|
}
|
|
172
|
-
}
|
|
173
169
|
}
|
|
170
|
+
|
package/src/functions.ts
CHANGED
|
@@ -5,14 +5,14 @@ import { Payload as TrackPageViewPayload } from './trackPageView/generated-types
|
|
|
5
5
|
import type { Mixpanel } from './types'
|
|
6
6
|
|
|
7
7
|
export function sendIdentify(mixpanel: Mixpanel, payload: IdentifyPayload | TrackPayload | TrackPageViewPayload) {
|
|
8
|
-
const {
|
|
9
|
-
unique_id,
|
|
8
|
+
const {
|
|
9
|
+
unique_id,
|
|
10
10
|
user_profile_properties_to_set,
|
|
11
11
|
user_profile_properties_to_set_once,
|
|
12
12
|
user_profile_properties_to_increment
|
|
13
13
|
} = payload
|
|
14
14
|
|
|
15
|
-
if
|
|
15
|
+
if(unique_id) {
|
|
16
16
|
mixpanel.identify(unique_id)
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -30,9 +30,9 @@ export function sendIdentify(mixpanel: Mixpanel, payload: IdentifyPayload | Trac
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function sendGroup(mixpanel: Mixpanel, payload: GroupPayload | TrackPayload | TrackPageViewPayload) {
|
|
33
|
-
const {
|
|
33
|
+
const {
|
|
34
34
|
group_details: { group_key, group_id } = {},
|
|
35
|
-
group_profile_properties_to_set,
|
|
35
|
+
group_profile_properties_to_set,
|
|
36
36
|
group_profile_properties_to_set_once,
|
|
37
37
|
group_profile_properties_to_union
|
|
38
38
|
} = payload
|
|
@@ -49,9 +49,12 @@ export function sendGroup(mixpanel: Mixpanel, payload: GroupPayload | TrackPaylo
|
|
|
49
49
|
}
|
|
50
50
|
if (group_profile_properties_to_union && group_profile_properties_to_union.length > 0) {
|
|
51
51
|
group_profile_properties_to_union.forEach((item) => {
|
|
52
|
-
const {
|
|
52
|
+
const {
|
|
53
|
+
list_name,
|
|
54
|
+
string_values
|
|
55
|
+
} = item
|
|
53
56
|
group.union(list_name, string_values)
|
|
54
57
|
})
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
|
-
}
|
|
60
|
+
}
|
|
@@ -36,6 +36,7 @@ describe('Mixpanel.group', () => {
|
|
|
36
36
|
beforeEach(async () => {
|
|
37
37
|
jest.restoreAllMocks()
|
|
38
38
|
jest.spyOn(destination, 'initialize').mockImplementation(() => {
|
|
39
|
+
|
|
39
40
|
mockGroup = {
|
|
40
41
|
set: jest.fn(),
|
|
41
42
|
set_once: jest.fn(),
|
|
@@ -69,15 +70,15 @@ describe('Mixpanel.group', () => {
|
|
|
69
70
|
subscribe: 'type = "group"',
|
|
70
71
|
mapping: {
|
|
71
72
|
group_details: {
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
group_key: { '@path': '$.traits.group_key' },
|
|
74
|
+
group_id: { '@path': '$.groupId' }
|
|
74
75
|
},
|
|
75
|
-
group_profile_properties_to_set: {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
group_profile_properties_to_set: {
|
|
77
|
+
company_name: { '@path': '$.traits.company_name' },
|
|
78
|
+
number_employees: { '@path': '$.traits.number_employees' }
|
|
78
79
|
},
|
|
79
80
|
group_profile_properties_to_set_once: {
|
|
80
|
-
|
|
81
|
+
set_once_trait: { '@path': '$.traits.set_once_trait_1' },
|
|
81
82
|
},
|
|
82
83
|
group_profile_properties_to_union: { '@path': '$.traits.union_properties' }
|
|
83
84
|
}
|
package/src/group/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
import type { Mixpanel } from '../types'
|
|
5
5
|
import { sendGroup } from '../functions'
|
|
6
|
-
import {
|
|
7
|
-
group_details,
|
|
6
|
+
import {
|
|
7
|
+
group_details,
|
|
8
8
|
group_profile_properties_to_set,
|
|
9
9
|
group_profile_properties_to_set_once,
|
|
10
10
|
group_profile_properties_to_union
|
|
@@ -36,6 +36,7 @@ describe('Mixpanel.identify', () => {
|
|
|
36
36
|
beforeEach(async () => {
|
|
37
37
|
jest.restoreAllMocks()
|
|
38
38
|
jest.spyOn(destination, 'initialize').mockImplementation(() => {
|
|
39
|
+
|
|
39
40
|
mockGroup = {
|
|
40
41
|
set: jest.fn(),
|
|
41
42
|
set_once: jest.fn(),
|
|
@@ -68,21 +69,21 @@ describe('Mixpanel.identify', () => {
|
|
|
68
69
|
enabled: true,
|
|
69
70
|
subscribe: 'type = "identify"',
|
|
70
71
|
mapping: {
|
|
71
|
-
unique_id:
|
|
72
|
-
user_profile_properties_to_set: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
unique_id:{ '@path': '$.userId' },
|
|
73
|
+
user_profile_properties_to_set: {
|
|
74
|
+
name: { '@path': '$.traits.name' },
|
|
75
|
+
first_name: { '@path': '$.traits.first_name' },
|
|
76
|
+
last_name: { '@path': '$.traits.last_name' },
|
|
77
|
+
email: { '@path': '$.traits.email' },
|
|
78
|
+
phone: { '@path': '$.traits.phone' },
|
|
79
|
+
avatar: { '@path': '$.traits.avatar' },
|
|
80
|
+
created: { '@path': '$.traits.created' }
|
|
80
81
|
},
|
|
81
82
|
user_profile_properties_to_set_once: {
|
|
82
|
-
|
|
83
|
+
set_once_trait: { '@path': '$.traits.set_once_trait_1' },
|
|
83
84
|
},
|
|
84
85
|
user_profile_properties_to_increment: {
|
|
85
|
-
|
|
86
|
+
increment_property: { '@path': '$.traits.increment_property_1' }
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -115,7 +116,7 @@ describe('Mixpanel.identify', () => {
|
|
|
115
116
|
await event.load(Context.system(), {} as Analytics)
|
|
116
117
|
await event.identify?.(context)
|
|
117
118
|
|
|
118
|
-
expect(mockMPP.identify).toHaveBeenCalledWith(
|
|
119
|
+
expect(mockMPP.identify).toHaveBeenCalledWith("userId1")
|
|
119
120
|
expect(mockMPP.people.set).toHaveBeenCalledWith({
|
|
120
121
|
name: 'name1',
|
|
121
122
|
last_name: 'lastName1',
|
package/src/identify/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
import type { Mixpanel } from '../types'
|
|
5
5
|
import { sendIdentify } from '../functions'
|
|
6
|
-
import {
|
|
7
|
-
unique_id,
|
|
6
|
+
import {
|
|
7
|
+
unique_id,
|
|
8
8
|
user_profile_properties_to_set,
|
|
9
9
|
user_profile_properties_to_set_once,
|
|
10
10
|
user_profile_properties_to_increment
|
|
@@ -16,7 +16,7 @@ const action: BrowserActionDefinition<Settings, Mixpanel, Payload> = {
|
|
|
16
16
|
defaultSubscription: 'type = "identify"',
|
|
17
17
|
platform: 'web',
|
|
18
18
|
fields: {
|
|
19
|
-
unique_id,
|
|
19
|
+
unique_id,
|
|
20
20
|
user_profile_properties_to_set,
|
|
21
21
|
user_profile_properties_to_set_once,
|
|
22
22
|
user_profile_properties_to_increment
|
package/src/index.ts
CHANGED
|
@@ -72,20 +72,20 @@ export const destination: BrowserDestinationDefinition<Settings, Mixpanel> = {
|
|
|
72
72
|
return mixpanel
|
|
73
73
|
},
|
|
74
74
|
presets: [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
{
|
|
76
|
+
name: 'Track',
|
|
77
|
+
subscribe: 'type = "track"',
|
|
78
|
+
partnerAction: 'track',
|
|
79
|
+
mapping: defaultValues(track.fields),
|
|
80
|
+
type: 'automatic'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Identify',
|
|
84
|
+
subscribe: 'type = "identify"',
|
|
85
|
+
partnerAction: 'identify',
|
|
86
|
+
mapping: defaultValues(identify.fields),
|
|
87
|
+
type: 'automatic'
|
|
88
|
+
}
|
|
89
89
|
],
|
|
90
90
|
actions: {
|
|
91
91
|
track,
|
package/src/init-script.ts
CHANGED
|
@@ -1,63 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
export async function initScript() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var e, g, i, h
|
|
7
|
-
window.mixpanel = b
|
|
8
|
-
b._i = []
|
|
9
|
-
b.init = function (e, f, c) {
|
|
10
|
-
function g(a, d) {
|
|
11
|
-
var b = d.split('.')
|
|
12
|
-
2 == b.length && ((a = a[b[0]]), (d = b[1]))
|
|
13
|
-
a[d] = function () {
|
|
14
|
-
a.push([d].concat(Array.prototype.slice.call(arguments, 0)))
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
var a = b
|
|
18
|
-
'undefined' !== typeof c ? (a = b[c] = []) : (c = 'mixpanel')
|
|
19
|
-
a.people = a.people || []
|
|
20
|
-
a.toString = function (a) {
|
|
21
|
-
var d = 'mixpanel'
|
|
22
|
-
'mixpanel' !== c && (d += '.' + c)
|
|
23
|
-
a || (d += ' (stub)')
|
|
24
|
-
return d
|
|
25
|
-
}
|
|
26
|
-
a.people.toString = function () {
|
|
27
|
-
return a.toString(1) + '.people (stub)'
|
|
28
|
-
}
|
|
29
|
-
i =
|
|
30
|
-
'disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove'.split(
|
|
31
|
-
' '
|
|
32
|
-
)
|
|
33
|
-
for (h = 0; h < i.length; h++) g(a, i[h])
|
|
34
|
-
var j = 'set set_once union unset remove delete'.split(' ')
|
|
35
|
-
a.get_group = function () {
|
|
36
|
-
function b(c) {
|
|
37
|
-
d[c] = function () {
|
|
38
|
-
call2_args = arguments
|
|
39
|
-
call2 = [c].concat(Array.prototype.slice.call(call2_args, 0))
|
|
40
|
-
a.push([e, call2])
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
for (var d = {}, e = ['get_group'].concat(Array.prototype.slice.call(arguments, 0)), c = 0; c < j.length; c++)
|
|
44
|
-
b(j[c])
|
|
45
|
-
return d
|
|
46
|
-
}
|
|
47
|
-
b._i.push([e, f, c])
|
|
48
|
-
}
|
|
49
|
-
b.__SV = 1.2
|
|
50
|
-
e = f.createElement('script')
|
|
51
|
-
e.type = 'text/javascript'
|
|
52
|
-
e.async = !0
|
|
53
|
-
e.src =
|
|
54
|
-
'undefined' !== typeof MIXPANEL_CUSTOM_LIB_URL
|
|
55
|
-
? MIXPANEL_CUSTOM_LIB_URL
|
|
56
|
-
: 'file:' === f.location.protocol && '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'.match(/^\/\//)
|
|
57
|
-
? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
|
|
58
|
-
: '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
|
|
59
|
-
g = f.getElementsByTagName('script')[0]
|
|
60
|
-
g.parentNode.insertBefore(e, g)
|
|
61
|
-
}
|
|
62
|
-
})(document, window.mixpanel || [])
|
|
63
|
-
}
|
|
4
|
+
(function (f, b) { if (!b.__SV) { var e, g, i, h; window.mixpanel = b; b._i = []; b.init = function (e, f, c) { function g(a, d) { var b = d.split("."); 2 == b.length && ((a = a[b[0]]), (d = b[1])); a[d] = function () { a.push([d].concat(Array.prototype.slice.call(arguments, 0))); }; } var a = b; "undefined" !== typeof c ? (a = b[c] = []) : (c = "mixpanel"); a.people = a.people || []; a.toString = function (a) { var d = "mixpanel"; "mixpanel" !== c && (d += "." + c); a || (d += " (stub)"); return d; }; a.people.toString = function () { return a.toString(1) + ".people (stub)"; }; i = "disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split( " "); for (h = 0; h < i.length; h++) g(a, i[h]); var j = "set set_once union unset remove delete".split(" "); a.get_group = function () { function b(c) { d[c] = function () { call2_args = arguments; call2 = [c].concat(Array.prototype.slice.call(call2_args, 0)); a.push([e, call2]); }; } for ( var d = {}, e = ["get_group"].concat( Array.prototype.slice.call(arguments, 0)), c = 0; c < j.length; c++) b(j[c]); return d; }; b._i.push([e, f, c]); }; b.__SV = 1.2; e = f.createElement("script"); e.type = "text/javascript"; e.async = !0; e.src = "undefined" !== typeof MIXPANEL_CUSTOM_LIB_URL ? MIXPANEL_CUSTOM_LIB_URL : "file:" === f.location.protocol && "//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//) ? "https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js" : "//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js"; g = f.getElementsByTagName("script")[0]; g.parentNode.insertBefore(e, g); } })(document, window.mixpanel || []);
|
|
5
|
+
}
|