Here's where SessionRecording is instantiated. It reads config.disable_persistence only once at init time:
|
var usePersistence = localStorageSupported(options.sharedLockStorage, true) && !this.getConfig('disable_persistence'); |
|
|
|
// each replay has its own batcher key to avoid conflicts between rrweb events of different recordings |
|
this.batcherKey = '__mprec_' + this.getConfig('name') + '_' + this.getConfig('token') + '_' + this.replayId; |
|
this.queueStorage = new IDBStorageWrapper(RECORDING_EVENTS_STORE_NAME); |
|
this.batcher = new RequestBatcher(this.batcherKey, { |
|
errorReporter: this.reportError.bind(this), |
|
flushOnlyOnInterval: true, |
|
libConfig: RECORDER_BATCHER_LIB_CONFIG, |
|
sendRequestFunc: this.flushEventsWithOptOut.bind(this), |
|
queueStorage: this.queueStorage, |
|
sharedLockStorage: options.sharedLockStorage, |
|
usePersistence: usePersistence, |
It's instantiated here when startRecording() is invoked:
|
this.activeRecording = new SessionRecording(sessionRecordingOptions); |
But nothing calls into active SessionRecordings when mixpanel.set_config() is called to update changes to config.disable_persistence:
|
MixpanelLib.prototype.set_config = function(config) { |
|
if (_.isObject(config)) { |
|
_.extend(this['config'], config); |
|
|
|
var new_batch_size = config['batch_size']; |
|
if (new_batch_size) { |
|
_.each(this.request_batchers, function(batcher) { |
|
batcher.resetBatchSize(); |
|
}); |
|
} |
|
|
|
if (!this.get_config('persistence_name')) { |
|
this['config']['persistence_name'] = this['config']['cookie_name']; |
|
} |
|
if (!this.get_config('disable_persistence')) { |
|
this['config']['disable_persistence'] = this['config']['disable_cookie']; |
|
} |
|
|
|
if (this['persistence']) { |
|
this['persistence'].update_config(this['config']); |
|
} |
|
Config.DEBUG = Config.DEBUG || this.get_config('debug'); |
|
|
|
if (('autocapture' in config || 'record_heatmap_data' in config) && this.autocapture) { |
|
this.autocapture.init(); |
|
} |
|
} |
|
}; |
To correctly handle consent changes (e.g., for EU GDPR users who have to provide explicit consent), I would expect changes to config.disable_persistence to be propagated to any active SessionRecording s in flight.
Here's where
SessionRecordingis instantiated. It readsconfig.disable_persistenceonly once at init time:mixpanel-js/src/recorder/session-recording.js
Lines 107 to 119 in c23600f
It's instantiated here when
startRecording()is invoked:mixpanel-js/src/recorder/recorder.js
Line 71 in c23600f
But nothing calls into active
SessionRecordings whenmixpanel.set_config()is called to update changes toconfig.disable_persistence:mixpanel-js/src/mixpanel-core.js
Lines 1864 to 1891 in c23600f
To correctly handle consent changes (e.g., for EU GDPR users who have to provide explicit consent), I would expect changes to
config.disable_persistenceto be propagated to any activeSessionRecordings in flight.