@@ -36,9 +36,11 @@ function on_mixpanel_loaded(callback) {
36
36
else return false ;
37
37
}
38
38
39
+ // The original_alias function from MixPanel calls the track and identify functions, which have been changed by this library.
40
+ // In version 2.39, if the result is smaller than 0, an error occured.
39
41
var r = mixpanel . original_alias ( alias , originalId ) ;
40
42
41
- if ( typeof r !== "object" || typeof r . properties !== "object" ) {
43
+ if ( r < 0 ) {
42
44
if ( onFail && typeof onFail === 'function' )
43
45
return onFail ( errors . invalid ( 'alias' , alias ) ) ;
44
46
} else {
@@ -72,25 +74,22 @@ function on_mixpanel_loaded(callback) {
72
74
73
75
74
76
75
- // IDENTITY
77
+ // IDENTIFY
78
+ // usePeople is not used. people.identify does not exists in mixpanel-js
76
79
mixpanel . original_identify = mixpanel . identify ;
77
- mixpanel . identify = function ( unique_id , onSuccess , onFail ) {
80
+ mixpanel . identify = function ( unique_id , usePeople , onSuccess , onFail ) {
78
81
79
82
if ( ! unique_id || typeof unique_id !== 'string' ) {
80
83
if ( onFail && typeof onFail === 'function' )
81
84
return onFail ( errors . invalid ( 'unique_id' , unique_id ) ) ;
82
85
else return false ;
83
86
}
84
87
85
- mixpanel . original_identify ( unique_id , function ( r ) {
86
- if ( typeof r !== "object" || typeof r . properties !== "object" ) {
87
- if ( onFail && typeof onFail === 'function' )
88
- return onFail ( errors . invalid ( 'identify' , unique_id ) ) ;
89
- } else {
90
- if ( onSuccess && typeof onSuccess === 'function' )
91
- return onSuccess ( ) ;
92
- }
93
- } ) ;
88
+ mixpanel . original_identify ( unique_id ) ;
89
+ if ( onSuccess && typeof onSuccess === 'function' )
90
+ return onSuccess ( ) ;
91
+
92
+ return true ;
94
93
} ;
95
94
96
95
// registerSuperProperties
@@ -134,7 +133,7 @@ function on_mixpanel_loaded(callback) {
134
133
135
134
} ;
136
135
137
- mixpanel . people . original_identify = mixpanel . people . identify ;
136
+ // @deprecated . people.identify does not exists in the mixpanel-js library.
138
137
mixpanel . people . identify = function ( distinctId , onSuccess , onFail ) {
139
138
return mixpanel . original_identify ( distinctId , onSuccess , onFail ) ;
140
139
} ;
@@ -148,7 +147,7 @@ function on_mixpanel_loaded(callback) {
148
147
}
149
148
150
149
mixpanel . people . original_set ( peopleProperties , function ( r ) {
151
- if ( typeof r !== "object" ) {
150
+ if ( r !== 1 ) {
152
151
if ( onFail && typeof onFail === 'function' )
153
152
return onFail ( errors . invalid ( 'people.set' , peopleProperties ) ) ;
154
153
} else {
0 commit comments