mixpanel-browser 2.64.0 → 2.65.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/mixpanel-core.cjs.js +50 -40
- package/dist/mixpanel-recorder.js +6 -2
- package/dist/mixpanel-recorder.min.js +1 -1
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +50 -40
- package/dist/mixpanel-with-recorder.js +50 -40
- package/dist/mixpanel-with-recorder.min.js +1 -1
- package/dist/mixpanel.amd.js +50 -40
- package/dist/mixpanel.cjs.js +50 -40
- package/dist/mixpanel.globals.js +50 -40
- package/dist/mixpanel.min.js +145 -144
- package/dist/mixpanel.module.js +50 -40
- package/dist/mixpanel.umd.js +50 -40
- package/package.json +1 -1
- package/src/autocapture/utils.js +3 -1
- package/src/config.js +1 -1
- package/src/flags/index.js +34 -25
- package/src/mixpanel-core.js +5 -0
- package/src/mixpanel-people.js +2 -12
- package/src/utils.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
**2.65.0** (20 May 2025)
|
|
2
|
+
- `mixpanel.people.track_charge()` (deprecated) no longer sets profile property
|
|
3
|
+
- Adds page height and width tracking to autocapture click tracking
|
|
4
|
+
- Session recording now stops when mixpanel.reset() is called
|
|
5
|
+
- Support for adding arbitrary query string params to tracking requests (thanks @dylan-asos)
|
|
6
|
+
- Feature flagging API revisions
|
|
7
|
+
- Whale Browser detection
|
|
8
|
+
|
|
1
9
|
**2.64.0** (15 Apr 2025)
|
|
2
10
|
- Add `record_heatmap_data` init option for Session Recording to ensure click events are captured for Heat Maps
|
|
3
11
|
- Initial support for feature flagging
|
package/README.md
CHANGED
|
@@ -78,4 +78,4 @@ Mixpanel production releases are tested against a large matrix of browsers and o
|
|
|
78
78
|
- Publish to readme.io via the [rdme](https://www.npmjs.com/package/rdme) util: `RDME_API_KEY=<API_KEY> RDME_DOC_VERSION=<version> npm run dox-publish`
|
|
79
79
|
|
|
80
80
|
## Thanks
|
|
81
|
-
For patches and support: @bohanyang, @dehau, @drubin, @D1plo1d, @feychenie, @mogstad, @pfhayes, @sandorfr, @stefansedich, @gfx, @pkaminski, @austince, @danielbaker, @mkdai, @wolever, @dpraul, @chriszamierowski, @JoaoGomesTW, @@aliyalcinkaya, @chrisdeely
|
|
81
|
+
For patches and support: @bohanyang, @dehau, @drubin, @D1plo1d, @feychenie, @mogstad, @pfhayes, @sandorfr, @stefansedich, @gfx, @pkaminski, @austince, @danielbaker, @mkdai, @wolever, @dpraul, @chriszamierowski, @JoaoGomesTW, @@aliyalcinkaya, @chrisdeely, @dylan-asos
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var Config = {
|
|
4
4
|
DEBUG: false,
|
|
5
|
-
LIB_VERSION: '2.
|
|
5
|
+
LIB_VERSION: '2.65.0'
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
|
|
@@ -1870,6 +1870,9 @@ _.info = {
|
|
|
1870
1870
|
return 'Microsoft Edge';
|
|
1871
1871
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
1872
1872
|
return 'Facebook Mobile';
|
|
1873
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
1874
|
+
// https://user-agents.net/browsers/whale-browser
|
|
1875
|
+
return 'Whale Browser';
|
|
1873
1876
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
1874
1877
|
return 'Chrome';
|
|
1875
1878
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -1921,7 +1924,8 @@ _.info = {
|
|
|
1921
1924
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
1922
1925
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
1923
1926
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
1924
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
1927
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
1928
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
1925
1929
|
};
|
|
1926
1930
|
var regex = versionRegexs[browser];
|
|
1927
1931
|
if (regex === undefined) {
|
|
@@ -2299,7 +2303,9 @@ function getPropsForDOMEvent(ev, config) {
|
|
|
2299
2303
|
'$elements': elementsJson,
|
|
2300
2304
|
'$el_attr__href': href,
|
|
2301
2305
|
'$viewportHeight': Math.max(docElement['clientHeight'], win['innerHeight'] || 0),
|
|
2302
|
-
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0)
|
|
2306
|
+
'$viewportWidth': Math.max(docElement['clientWidth'], win['innerWidth'] || 0),
|
|
2307
|
+
'$pageHeight': document$1['body']['offsetHeight'] || 0,
|
|
2308
|
+
'$pageWidth': document$1['body']['offsetWidth'] || 0,
|
|
2303
2309
|
};
|
|
2304
2310
|
_.each(captureExtraAttrs, function(attr) {
|
|
2305
2311
|
if (!blockAttrsSet[attr] && target.hasAttribute(attr)) {
|
|
@@ -3030,19 +3036,19 @@ FeatureFlagManager.prototype.getConfig = function(key) {
|
|
|
3030
3036
|
return this.getFullConfig()[key];
|
|
3031
3037
|
};
|
|
3032
3038
|
|
|
3033
|
-
FeatureFlagManager.prototype.
|
|
3039
|
+
FeatureFlagManager.prototype.isSystemEnabled = function() {
|
|
3034
3040
|
return !!this.getMpConfig(FLAGS_CONFIG_KEY);
|
|
3035
3041
|
};
|
|
3036
3042
|
|
|
3037
|
-
FeatureFlagManager.prototype.
|
|
3038
|
-
if (!this.
|
|
3043
|
+
FeatureFlagManager.prototype.areFlagsReady = function() {
|
|
3044
|
+
if (!this.isSystemEnabled()) {
|
|
3039
3045
|
logger$3.error('Feature Flags not enabled');
|
|
3040
3046
|
}
|
|
3041
3047
|
return !!this.flags;
|
|
3042
3048
|
};
|
|
3043
3049
|
|
|
3044
3050
|
FeatureFlagManager.prototype.fetchFlags = function() {
|
|
3045
|
-
if (!this.
|
|
3051
|
+
if (!this.isSystemEnabled()) {
|
|
3046
3052
|
return;
|
|
3047
3053
|
}
|
|
3048
3054
|
|
|
@@ -3068,7 +3074,7 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
3068
3074
|
_.each(responseFlags, function(data, key) {
|
|
3069
3075
|
flags.set(key, {
|
|
3070
3076
|
'key': data['variant_key'],
|
|
3071
|
-
'
|
|
3077
|
+
'value': data['variant_value']
|
|
3072
3078
|
});
|
|
3073
3079
|
});
|
|
3074
3080
|
this.flags = flags;
|
|
@@ -3078,7 +3084,7 @@ FeatureFlagManager.prototype.fetchFlags = function() {
|
|
|
3078
3084
|
}.bind(this)).catch(function() {});
|
|
3079
3085
|
};
|
|
3080
3086
|
|
|
3081
|
-
FeatureFlagManager.prototype.
|
|
3087
|
+
FeatureFlagManager.prototype.getVariant = function(featureName, fallback) {
|
|
3082
3088
|
if (!this.fetchPromise) {
|
|
3083
3089
|
return new Promise(function(resolve) {
|
|
3084
3090
|
logger$3.critical('Feature Flags not initialized');
|
|
@@ -3087,15 +3093,15 @@ FeatureFlagManager.prototype.getFeature = function(featureName, fallback) {
|
|
|
3087
3093
|
}
|
|
3088
3094
|
|
|
3089
3095
|
return this.fetchPromise.then(function() {
|
|
3090
|
-
return this.
|
|
3096
|
+
return this.getVariantSync(featureName, fallback);
|
|
3091
3097
|
}.bind(this)).catch(function(error) {
|
|
3092
3098
|
logger$3.error(error);
|
|
3093
3099
|
return fallback;
|
|
3094
3100
|
});
|
|
3095
3101
|
};
|
|
3096
3102
|
|
|
3097
|
-
FeatureFlagManager.prototype.
|
|
3098
|
-
if (!this.
|
|
3103
|
+
FeatureFlagManager.prototype.getVariantSync = function(featureName, fallback) {
|
|
3104
|
+
if (!this.areFlagsReady()) {
|
|
3099
3105
|
logger$3.log('Flags not loaded yet');
|
|
3100
3106
|
return fallback;
|
|
3101
3107
|
}
|
|
@@ -3108,31 +3114,37 @@ FeatureFlagManager.prototype.getFeatureSync = function(featureName, fallback) {
|
|
|
3108
3114
|
return feature;
|
|
3109
3115
|
};
|
|
3110
3116
|
|
|
3111
|
-
FeatureFlagManager.prototype.
|
|
3112
|
-
return this.
|
|
3113
|
-
return feature['
|
|
3117
|
+
FeatureFlagManager.prototype.getVariantValue = function(featureName, fallbackValue) {
|
|
3118
|
+
return this.getVariant(featureName, {'value': fallbackValue}).then(function(feature) {
|
|
3119
|
+
return feature['value'];
|
|
3114
3120
|
}).catch(function(error) {
|
|
3115
3121
|
logger$3.error(error);
|
|
3116
3122
|
return fallbackValue;
|
|
3117
3123
|
});
|
|
3118
3124
|
};
|
|
3119
3125
|
|
|
3120
|
-
|
|
3121
|
-
|
|
3126
|
+
// TODO remove deprecated method
|
|
3127
|
+
FeatureFlagManager.prototype.getFeatureData = function(featureName, fallbackValue) {
|
|
3128
|
+
logger$3.critical('mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead.');
|
|
3129
|
+
return this.getVariantValue(featureName, fallbackValue);
|
|
3130
|
+
};
|
|
3131
|
+
|
|
3132
|
+
FeatureFlagManager.prototype.getVariantValueSync = function(featureName, fallbackValue) {
|
|
3133
|
+
return this.getVariantSync(featureName, {'value': fallbackValue})['value'];
|
|
3122
3134
|
};
|
|
3123
3135
|
|
|
3124
|
-
FeatureFlagManager.prototype.
|
|
3125
|
-
return this.
|
|
3126
|
-
return this.
|
|
3136
|
+
FeatureFlagManager.prototype.isEnabled = function(featureName, fallbackValue) {
|
|
3137
|
+
return this.getVariantValue(featureName).then(function() {
|
|
3138
|
+
return this.isEnabledSync(featureName, fallbackValue);
|
|
3127
3139
|
}.bind(this)).catch(function(error) {
|
|
3128
3140
|
logger$3.error(error);
|
|
3129
3141
|
return fallbackValue;
|
|
3130
3142
|
});
|
|
3131
3143
|
};
|
|
3132
3144
|
|
|
3133
|
-
FeatureFlagManager.prototype.
|
|
3145
|
+
FeatureFlagManager.prototype.isEnabledSync = function(featureName, fallbackValue) {
|
|
3134
3146
|
fallbackValue = fallbackValue || false;
|
|
3135
|
-
var val = this.
|
|
3147
|
+
var val = this.getVariantValueSync(featureName, fallbackValue);
|
|
3136
3148
|
if (val !== true && val !== false) {
|
|
3137
3149
|
logger$3.error('Feature flag "' + featureName + '" value: ' + val + ' is not a boolean; returning fallback value: ' + fallbackValue);
|
|
3138
3150
|
val = fallbackValue;
|
|
@@ -3161,13 +3173,16 @@ function minApisSupported() {
|
|
|
3161
3173
|
|
|
3162
3174
|
safewrapClass(FeatureFlagManager);
|
|
3163
3175
|
|
|
3164
|
-
FeatureFlagManager.prototype['
|
|
3165
|
-
FeatureFlagManager.prototype['
|
|
3176
|
+
FeatureFlagManager.prototype['are_flags_ready'] = FeatureFlagManager.prototype.areFlagsReady;
|
|
3177
|
+
FeatureFlagManager.prototype['get_variant'] = FeatureFlagManager.prototype.getVariant;
|
|
3178
|
+
FeatureFlagManager.prototype['get_variant_sync'] = FeatureFlagManager.prototype.getVariantSync;
|
|
3179
|
+
FeatureFlagManager.prototype['get_variant_value'] = FeatureFlagManager.prototype.getVariantValue;
|
|
3180
|
+
FeatureFlagManager.prototype['get_variant_value_sync'] = FeatureFlagManager.prototype.getVariantValueSync;
|
|
3181
|
+
FeatureFlagManager.prototype['is_enabled'] = FeatureFlagManager.prototype.isEnabled;
|
|
3182
|
+
FeatureFlagManager.prototype['is_enabled_sync'] = FeatureFlagManager.prototype.isEnabledSync;
|
|
3183
|
+
|
|
3184
|
+
// Deprecated method
|
|
3166
3185
|
FeatureFlagManager.prototype['get_feature_data'] = FeatureFlagManager.prototype.getFeatureData;
|
|
3167
|
-
FeatureFlagManager.prototype['get_feature_data_sync'] = FeatureFlagManager.prototype.getFeatureDataSync;
|
|
3168
|
-
FeatureFlagManager.prototype['get_feature_sync'] = FeatureFlagManager.prototype.getFeatureSync;
|
|
3169
|
-
FeatureFlagManager.prototype['is_feature_enabled'] = FeatureFlagManager.prototype.isFeatureEnabled;
|
|
3170
|
-
FeatureFlagManager.prototype['is_feature_enabled_sync'] = FeatureFlagManager.prototype.isFeatureEnabledSync;
|
|
3171
3186
|
|
|
3172
3187
|
/* eslint camelcase: "off" */
|
|
3173
3188
|
|
|
@@ -5051,18 +5066,8 @@ MixpanelPeople.prototype.union = addOptOutCheckMixpanelPeople(function(list_name
|
|
|
5051
5066
|
* @param {Function} [callback] If provided, the callback will be called when the server responds
|
|
5052
5067
|
* @deprecated
|
|
5053
5068
|
*/
|
|
5054
|
-
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function(
|
|
5055
|
-
|
|
5056
|
-
amount = parseFloat(amount);
|
|
5057
|
-
if (isNaN(amount)) {
|
|
5058
|
-
console.error('Invalid value passed to mixpanel.people.track_charge - must be a number');
|
|
5059
|
-
return;
|
|
5060
|
-
}
|
|
5061
|
-
}
|
|
5062
|
-
|
|
5063
|
-
return this.append('$transactions', _.extend({
|
|
5064
|
-
'$amount': amount
|
|
5065
|
-
}, properties), callback);
|
|
5069
|
+
MixpanelPeople.prototype.track_charge = addOptOutCheckMixpanelPeople(function() {
|
|
5070
|
+
console.error('mixpanel.people.track_charge() is deprecated and no longer has any effect.');
|
|
5066
5071
|
});
|
|
5067
5072
|
|
|
5068
5073
|
/*
|
|
@@ -5897,6 +5902,7 @@ var DEFAULT_API_ROUTES = {
|
|
|
5897
5902
|
var DEFAULT_CONFIG = {
|
|
5898
5903
|
'api_host': 'https://api-js.mixpanel.com',
|
|
5899
5904
|
'api_routes': DEFAULT_API_ROUTES,
|
|
5905
|
+
'api_extra_query_params': {},
|
|
5900
5906
|
'api_method': 'POST',
|
|
5901
5907
|
'api_transport': 'XHR',
|
|
5902
5908
|
'api_payload_format': PAYLOAD_TYPE_BASE64,
|
|
@@ -6484,6 +6490,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
6484
6490
|
delete data['data'];
|
|
6485
6491
|
}
|
|
6486
6492
|
|
|
6493
|
+
_.extend(data, this.get_config('api_extra_query_params'));
|
|
6494
|
+
|
|
6487
6495
|
url += '?' + _.HTTPBuildQuery(data);
|
|
6488
6496
|
|
|
6489
6497
|
var lib = this;
|
|
@@ -7400,6 +7408,8 @@ MixpanelLib.prototype.reset = function() {
|
|
|
7400
7408
|
'distinct_id': DEVICE_ID_PREFIX + uuid,
|
|
7401
7409
|
'$device_id': uuid
|
|
7402
7410
|
}, '');
|
|
7411
|
+
this.stop_session_recording();
|
|
7412
|
+
this._check_and_start_session_recording();
|
|
7403
7413
|
};
|
|
7404
7414
|
|
|
7405
7415
|
/**
|
|
@@ -13944,7 +13944,7 @@
|
|
|
13944
13944
|
}
|
|
13945
13945
|
|
|
13946
13946
|
var Config = {
|
|
13947
|
-
LIB_VERSION: '2.
|
|
13947
|
+
LIB_VERSION: '2.65.0'
|
|
13948
13948
|
};
|
|
13949
13949
|
|
|
13950
13950
|
/* eslint camelcase: "off", eqeqeq: "off" */
|
|
@@ -15377,6 +15377,9 @@
|
|
|
15377
15377
|
return 'Microsoft Edge';
|
|
15378
15378
|
} else if (_.includes(user_agent, 'FBIOS')) {
|
|
15379
15379
|
return 'Facebook Mobile';
|
|
15380
|
+
} else if (_.includes(user_agent, 'Whale/')) {
|
|
15381
|
+
// https://user-agents.net/browsers/whale-browser
|
|
15382
|
+
return 'Whale Browser';
|
|
15380
15383
|
} else if (_.includes(user_agent, 'Chrome')) {
|
|
15381
15384
|
return 'Chrome';
|
|
15382
15385
|
} else if (_.includes(user_agent, 'CriOS')) {
|
|
@@ -15428,7 +15431,8 @@
|
|
|
15428
15431
|
'Android Mobile': /android\s(\d+(\.\d+)?)/,
|
|
15429
15432
|
'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/,
|
|
15430
15433
|
'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/,
|
|
15431
|
-
'Mozilla': /rv:(\d+(\.\d+)?)
|
|
15434
|
+
'Mozilla': /rv:(\d+(\.\d+)?)/,
|
|
15435
|
+
'Whale Browser': /Whale\/(\d+(\.\d+)?)/
|
|
15432
15436
|
};
|
|
15433
15437
|
var regex = versionRegexs[browser];
|
|
15434
15438
|
if (regex === undefined) {
|