From 0c4ee0091e43a69e981f021441373849829bba3a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 13 Feb 2020 10:47:50 +0000 Subject: [PATCH] Update comment and clear up localstorage on disabling Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Analytics.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index fc1b7c5827..e95887a810 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -195,8 +195,7 @@ class Analytics { } /** - * Disable Analytics calls, will not fully unload Piwik until a refresh, - * but this is second best, Piwik should not pull anything implicitly. + * Disable Analytics, stop the heartbeat and clear identifiers from localStorage */ disable() { if (this.disabled) return; @@ -204,6 +203,10 @@ class Analytics { window.clearInterval(this._heartbeatIntervalID); this.baseUrl = null; this.visitVariables = {}; + localStorage.removeItem(UID_KEY); + localStorage.removeItem(CREATION_TS_KEY); + localStorage.removeItem(VISIT_COUNT_KEY); + localStorage.removeItem(LAST_VISIT_TS_KEY); } async _track(data) {