Skip to content

Commit 39048be

Browse files
Added record_capture_interactions option
1 parent 5f29076 commit 39048be

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/autocapture/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ Autocapture.prototype.trackDomEvent = function(ev, mpEventName) {
171171
Autocapture.prototype.initClickTracking = function() {
172172
window.removeEventListener(EV_CLICK, this.listenerClick);
173173

174-
if (!this.getConfig(CONFIG_TRACK_CLICK)) {
174+
if (!this.getConfig(CONFIG_TRACK_CLICK) && !this.mp.get_active_record_capture_interactions()) {
175175
return;
176176
}
177177
logger.log('Initializing click tracking');
178178

179179
this.listenerClick = window.addEventListener(EV_CLICK, function(ev) {
180-
if (!this.getConfig(CONFIG_TRACK_CLICK)) {
180+
if (!this.getConfig(CONFIG_TRACK_CLICK) && !this.mp.get_active_record_capture_interactions()) {
181181
return;
182182
}
183183
this.trackDomEvent(ev, MP_EV_CLICK);

src/mixpanel-core.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ var DEFAULT_CONFIG = {
152152
'record_mask_text_selector': '*',
153153
'record_max_ms': MAX_RECORDING_MS,
154154
'record_min_ms': 0,
155+
'record_capture_interactions': false,
155156
'record_sessions_percent': 0,
156157
'recorder_src': 'https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js'
157158
};
@@ -487,6 +488,13 @@ MixpanelLib.prototype.resume_session_recording = function () {
487488
}
488489
};
489490

491+
MixpanelLib.prototype.get_active_record_capture_interactions = function () {
492+
if (this._recorder) {
493+
return this._recorder['getActiveReplayId']() && this.get_config('record_capture_interactions');
494+
}
495+
return false;
496+
};
497+
490498
MixpanelLib.prototype.get_session_recording_properties = function () {
491499
var props = {};
492500
var replay_id = this._get_session_replay_id();
@@ -1842,7 +1850,7 @@ MixpanelLib.prototype.set_config = function(config) {
18421850
}
18431851
Config.DEBUG = Config.DEBUG || this.get_config('debug');
18441852

1845-
if ('autocapture' in config && this.autocapture) {
1853+
if (('autocapture' in config || this.get_config('record_capture_interactions')) && this.autocapture) {
18461854
this.autocapture.init();
18471855
}
18481856
}

0 commit comments

Comments
 (0)