From 3944907509451b214bd51d9b55afcf77a2c1229c Mon Sep 17 00:00:00 2001 From: nithin Date: Thu, 13 Jan 2022 18:47:19 +0530 Subject: [PATCH] added some docs --- src/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/index.js b/src/index.js index 2818153..9dfb0b6 100644 --- a/src/index.js +++ b/src/index.js @@ -8,6 +8,7 @@ * @classname MixpanelTool */ class MixpanelTool { + constructor() { this.state = { requests: {}, @@ -198,10 +199,16 @@ class MixpanelTool { } } + /* + Ref: https://github.com/mixpanel/mixpanel-js/releases/tag/v2.43.0 + Mixpanel has changed the payload ecoding format, by default JSON string will be + passed, unless api_payload_format:true is specified. + */ base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; getProperties(dataParam) { let dataStr = decodeURIComponent(dataParam); + // if Base64 if(this.base64regex.test(dataStr)) { dataStr = atob(dataStr); }