Skip to content

Commit

Permalink
Merge pull request #26 from nithincvpoyyil/feature/minor-docs
Browse files Browse the repository at this point in the history
added some docs
  • Loading branch information
nithincvpoyyil authored Jan 13, 2022
2 parents 55b96d5 + 3944907 commit f08b9d7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* @classname MixpanelTool
*/
class MixpanelTool {

constructor() {
this.state = {
requests: {},
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f08b9d7

Please sign in to comment.