Skip to content

Commit 597d866

Browse files
Merge pull request #114 from filionf/browser-update
Browser update
2 parents 076e456 + 7fd4bc2 commit 597d866

File tree

2 files changed

+6533
-3127
lines changed

2 files changed

+6533
-3127
lines changed

src/browser/MixpanelProxy.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ function on_mixpanel_loaded(callback) {
3636
else return false;
3737
}
3838

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.
3941
var r = mixpanel.original_alias(alias, originalId);
4042

41-
if (typeof r !== "object" || typeof r.properties !== "object") {
43+
if (r < 0) {
4244
if (onFail && typeof onFail === 'function')
4345
return onFail(errors.invalid('alias', alias));
4446
} else {
@@ -72,25 +74,22 @@ function on_mixpanel_loaded(callback) {
7274

7375

7476

75-
// IDENTITY
77+
// IDENTIFY
78+
// usePeople is not used. people.identify does not exists in mixpanel-js
7679
mixpanel.original_identify = mixpanel.identify;
77-
mixpanel.identify = function(unique_id, onSuccess, onFail) {
80+
mixpanel.identify = function(unique_id, usePeople, onSuccess, onFail) {
7881

7982
if (!unique_id || typeof unique_id !== 'string') {
8083
if (onFail && typeof onFail === 'function')
8184
return onFail(errors.invalid('unique_id', unique_id));
8285
else return false;
8386
}
8487

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;
9493
};
9594

9695
// registerSuperProperties
@@ -134,7 +133,7 @@ function on_mixpanel_loaded(callback) {
134133

135134
};
136135

137-
mixpanel.people.original_identify = mixpanel.people.identify;
136+
// @deprecated. people.identify does not exists in the mixpanel-js library.
138137
mixpanel.people.identify = function(distinctId, onSuccess, onFail) {
139138
return mixpanel.original_identify(distinctId, onSuccess, onFail);
140139
};
@@ -148,7 +147,7 @@ function on_mixpanel_loaded(callback) {
148147
}
149148

150149
mixpanel.people.original_set(peopleProperties, function(r) {
151-
if (typeof r !== "object") {
150+
if (r !== 1) {
152151
if (onFail && typeof onFail === 'function')
153152
return onFail(errors.invalid('people.set', peopleProperties));
154153
} else {

0 commit comments

Comments
 (0)