@segment/analytics-browser-mixpanel-web-actions 1.4.0 → 1.4.1-staging-154441964.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/fields.js.map +1 -1
- package/dist/cjs/functions.js.map +1 -1
- package/dist/cjs/init-script.js +59 -15
- 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/fields.js.map +1 -1
- package/dist/esm/functions.js.map +1 -1
- package/dist/esm/init-script.js +59 -15
- 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 +3 -3
- package/src/alias/__tests__/index.test.ts +2 -3
- package/src/constants.ts +1 -1
- package/src/fields.ts +137 -134
- package/src/functions.ts +9 -14
- package/src/group/__tests__/index.test.ts +6 -7
- package/src/group/index.ts +2 -2
- package/src/identify/__tests__/index.test.ts +12 -13
- package/src/identify/index.ts +3 -3
- package/src/init-script.ts +60 -2
- package/src/setting-fields.ts +260 -260
- package/src/track/__tests__/index.test.ts +23 -24
- package/src/track/index.ts +8 -6
- package/src/trackPageView/__tests__/index.test.ts +36 -35
- package/src/trackPageView/index.ts +10 -8
package/src/fields.ts
CHANGED
|
@@ -1,170 +1,173 @@
|
|
|
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
|
-
|
|
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
|
-
}
|
|
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'
|
|
73
39
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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'
|
|
82
72
|
}
|
|
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
|
-
|
|
86
|
+
label: 'User Profile Properties to Set Once',
|
|
87
|
+
description:
|
|
88
|
+
'User Profile Properties to set once on the user profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
89
|
+
required: false,
|
|
90
|
+
defaultObjectUI: 'keyvalue',
|
|
91
|
+
type: 'object'
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
export const user_profile_properties_to_increment: InputField =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
export const user_profile_properties_to_increment: InputField = {
|
|
95
|
+
label: 'User Profile Properties to Increment',
|
|
96
|
+
description: 'User Profile Properties to increment on the user profile in Mixpanel. Values must be numeric.',
|
|
97
|
+
required: false,
|
|
98
|
+
defaultObjectUI: 'keyvalue',
|
|
99
|
+
type: 'object'
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
export const group_details: InputField = {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
label: 'Group Details',
|
|
104
|
+
description: 'Details for the group to be created or updated in Mixpanel.',
|
|
105
|
+
type: 'object',
|
|
106
|
+
defaultObjectUI: 'keyvalue:only',
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
required: true,
|
|
109
|
+
properties: {
|
|
109
110
|
group_key: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
label: 'Group Key',
|
|
112
|
+
description:
|
|
113
|
+
'The Group Key / type of group to associate with the user. This group key should already be defined in your Mixpanel project.',
|
|
114
|
+
required: true,
|
|
115
|
+
type: 'string'
|
|
114
116
|
},
|
|
115
117
|
group_id: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
default: {
|
|
123
|
-
group_key: { '@path': '$.traits.group_key' },
|
|
124
|
-
group_id: { '@path': '$.groupId' }
|
|
118
|
+
label: 'Group ID',
|
|
119
|
+
description: 'The unique ID to associate with the group.',
|
|
120
|
+
required: true,
|
|
121
|
+
type: 'string'
|
|
125
122
|
}
|
|
123
|
+
},
|
|
124
|
+
default: {
|
|
125
|
+
group_key: { '@path': '$.traits.group_key' },
|
|
126
|
+
group_id: { '@path': '$.groupId' }
|
|
127
|
+
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
export const group_profile_properties_to_set: InputField = {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
label: 'Group properties to Set',
|
|
132
|
+
description: 'Group Profile Properties to set on the group in Mixpanel.',
|
|
133
|
+
required: false,
|
|
134
|
+
defaultObjectUI: 'keyvalue',
|
|
135
|
+
type: 'object'
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
export const group_profile_properties_to_set_once: InputField = {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
label: 'Group properties to set once',
|
|
140
|
+
description:
|
|
141
|
+
'Group Profile Properties to set once on the group profile in Mixpanel. Values which get set once cannot be overwritten later.',
|
|
142
|
+
required: false,
|
|
143
|
+
defaultObjectUI: 'keyvalue',
|
|
144
|
+
type: 'object'
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
export const group_profile_properties_to_union: InputField = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
148
|
+
label: 'Group list properties to union',
|
|
149
|
+
description: 'Merge a list into a list group property. Duplicates will be removed.',
|
|
150
|
+
required: false,
|
|
151
|
+
type: 'object',
|
|
152
|
+
multiple: true,
|
|
153
|
+
defaultObjectUI: 'arrayeditor',
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
properties: {
|
|
156
|
+
list_name: {
|
|
157
|
+
label: 'List Name',
|
|
158
|
+
description: 'The name of the list property to union values into.',
|
|
159
|
+
type: 'string',
|
|
160
|
+
allowNull: false,
|
|
161
|
+
required: true
|
|
162
|
+
},
|
|
163
|
+
string_values: {
|
|
164
|
+
label: 'Values',
|
|
165
|
+
description:
|
|
166
|
+
'An array of string values to merge into the list. Non string lists cannot be updated. Duplicates will be removed.',
|
|
167
|
+
type: 'string',
|
|
168
|
+
required: true,
|
|
169
|
+
allowNull: false,
|
|
170
|
+
multiple: true
|
|
168
171
|
}
|
|
172
|
+
}
|
|
169
173
|
}
|
|
170
|
-
|
package/src/functions.ts
CHANGED
|
@@ -6,14 +6,14 @@ import type { Mixpanel } from './types'
|
|
|
6
6
|
import { STANDARD_USER_PROFILE_PROPERTIES } from './constants'
|
|
7
7
|
|
|
8
8
|
export function sendIdentify(mixpanel: Mixpanel, payload: IdentifyPayload | TrackPayload | TrackPageViewPayload) {
|
|
9
|
-
const {
|
|
10
|
-
unique_id,
|
|
9
|
+
const {
|
|
10
|
+
unique_id,
|
|
11
11
|
user_profile_properties_to_set,
|
|
12
12
|
user_profile_properties_to_set_once,
|
|
13
13
|
user_profile_properties_to_increment
|
|
14
14
|
} = payload
|
|
15
15
|
|
|
16
|
-
if(unique_id) {
|
|
16
|
+
if (unique_id) {
|
|
17
17
|
mixpanel.identify(unique_id)
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -31,22 +31,20 @@ export function sendIdentify(mixpanel: Mixpanel, payload: IdentifyPayload | Trac
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function ensureDollarPrefix(property: string): string {
|
|
34
|
-
if(STANDARD_USER_PROFILE_PROPERTIES.includes(property) && !property.startsWith('$')) {
|
|
34
|
+
if (STANDARD_USER_PROFILE_PROPERTIES.includes(property) && !property.startsWith('$')) {
|
|
35
35
|
return `$${property}`
|
|
36
36
|
}
|
|
37
37
|
return property
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function mapKeys<T extends Record<string, unknown>>(obj: T, fn: (key: string) => string): Record<string, T[keyof T]> {
|
|
41
|
-
return Object.fromEntries(
|
|
42
|
-
Object.entries(obj).map(([k, v]) => [fn(k), v])
|
|
43
|
-
) as Record<string, T[keyof T]>;
|
|
41
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [fn(k), v])) as Record<string, T[keyof T]>
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
export function sendGroup(mixpanel: Mixpanel, payload: GroupPayload | TrackPayload | TrackPageViewPayload) {
|
|
47
|
-
const {
|
|
45
|
+
const {
|
|
48
46
|
group_details: { group_key, group_id } = {},
|
|
49
|
-
group_profile_properties_to_set,
|
|
47
|
+
group_profile_properties_to_set,
|
|
50
48
|
group_profile_properties_to_set_once,
|
|
51
49
|
group_profile_properties_to_union
|
|
52
50
|
} = payload
|
|
@@ -63,12 +61,9 @@ export function sendGroup(mixpanel: Mixpanel, payload: GroupPayload | TrackPaylo
|
|
|
63
61
|
}
|
|
64
62
|
if (group_profile_properties_to_union && group_profile_properties_to_union.length > 0) {
|
|
65
63
|
group_profile_properties_to_union.forEach((item) => {
|
|
66
|
-
const {
|
|
67
|
-
list_name,
|
|
68
|
-
string_values
|
|
69
|
-
} = item
|
|
64
|
+
const { list_name, string_values } = item
|
|
70
65
|
group.union(list_name, string_values)
|
|
71
66
|
})
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
|
-
}
|
|
69
|
+
}
|
|
@@ -36,7 +36,6 @@ describe('Mixpanel.group', () => {
|
|
|
36
36
|
beforeEach(async () => {
|
|
37
37
|
jest.restoreAllMocks()
|
|
38
38
|
jest.spyOn(destination, 'initialize').mockImplementation(() => {
|
|
39
|
-
|
|
40
39
|
mockGroup = {
|
|
41
40
|
set: jest.fn(),
|
|
42
41
|
set_once: jest.fn(),
|
|
@@ -70,15 +69,15 @@ describe('Mixpanel.group', () => {
|
|
|
70
69
|
subscribe: 'type = "group"',
|
|
71
70
|
mapping: {
|
|
72
71
|
group_details: {
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
group_key: { '@path': '$.traits.group_key' },
|
|
73
|
+
group_id: { '@path': '$.groupId' }
|
|
75
74
|
},
|
|
76
|
-
group_profile_properties_to_set: {
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
group_profile_properties_to_set: {
|
|
76
|
+
company_name: { '@path': '$.traits.company_name' },
|
|
77
|
+
number_employees: { '@path': '$.traits.number_employees' }
|
|
79
78
|
},
|
|
80
79
|
group_profile_properties_to_set_once: {
|
|
81
|
-
|
|
80
|
+
set_once_trait: { '@path': '$.traits.set_once_trait_1' }
|
|
82
81
|
},
|
|
83
82
|
group_profile_properties_to_union: { '@path': '$.traits.union_properties' }
|
|
84
83
|
}
|
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,7 +36,6 @@ describe('Mixpanel.identify', () => {
|
|
|
36
36
|
beforeEach(async () => {
|
|
37
37
|
jest.restoreAllMocks()
|
|
38
38
|
jest.spyOn(destination, 'initialize').mockImplementation(() => {
|
|
39
|
-
|
|
40
39
|
mockGroup = {
|
|
41
40
|
set: jest.fn(),
|
|
42
41
|
set_once: jest.fn(),
|
|
@@ -69,21 +68,21 @@ describe('Mixpanel.identify', () => {
|
|
|
69
68
|
enabled: true,
|
|
70
69
|
subscribe: 'type = "identify"',
|
|
71
70
|
mapping: {
|
|
72
|
-
unique_id:{ '@path': '$.userId' },
|
|
73
|
-
user_profile_properties_to_set: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
unique_id: { '@path': '$.userId' },
|
|
72
|
+
user_profile_properties_to_set: {
|
|
73
|
+
name: { '@path': '$.traits.name' },
|
|
74
|
+
first_name: { '@path': '$.traits.first_name' },
|
|
75
|
+
last_name: { '@path': '$.traits.last_name' },
|
|
76
|
+
email: { '@path': '$.traits.email' },
|
|
77
|
+
phone: { '@path': '$.traits.phone' },
|
|
78
|
+
avatar: { '@path': '$.traits.avatar' },
|
|
79
|
+
created: { '@path': '$.traits.created' }
|
|
81
80
|
},
|
|
82
81
|
user_profile_properties_to_set_once: {
|
|
83
|
-
|
|
82
|
+
set_once_trait: { '@path': '$.traits.set_once_trait_1' }
|
|
84
83
|
},
|
|
85
84
|
user_profile_properties_to_increment: {
|
|
86
|
-
|
|
85
|
+
increment_property: { '@path': '$.traits.increment_property_1' }
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
}
|
|
@@ -116,7 +115,7 @@ describe('Mixpanel.identify', () => {
|
|
|
116
115
|
await event.load(Context.system(), {} as Analytics)
|
|
117
116
|
await event.identify?.(context)
|
|
118
117
|
|
|
119
|
-
expect(mockMPP.identify).toHaveBeenCalledWith(
|
|
118
|
+
expect(mockMPP.identify).toHaveBeenCalledWith('userId1')
|
|
120
119
|
expect(mockMPP.people.set).toHaveBeenCalledWith({
|
|
121
120
|
$name: 'name1',
|
|
122
121
|
$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/init-script.ts
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
export async function initScript() {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
;(function (f, b) {
|
|
5
|
+
if (!b.__SV) {
|
|
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
|
+
}
|