Skip to content

Instantly share code, notes, and snippets.

@jasonferrier
Created December 9, 2015 20:53
Show Gist options
  • Select an option

  • Save jasonferrier/878861cb89bd84b4bbda to your computer and use it in GitHub Desktop.

Select an option

Save jasonferrier/878861cb89bd84b4bbda to your computer and use it in GitHub Desktop.
Chrome Extension: base64 decode query string data
/**
* This is the beginnings of a Chrome Extension that will extend the Chrome Developer Tools Network panel using
* the webRequest and devTools APIs.
* This will be very useful for debugging the calls that the Mixpanel snippet makes out when you make
* Mixpanel API calls in your code
*/
function d64json(data){console.info(JSON.stringify(JSON.parse(atob(data)),null,2));}
/*
* Then call the d64json function with your pasted in data from a Mixpanel call from the query string parameter named `data`
*
* d64json("eyIkc2V0IjogeyIkb3MiOiAiTWFjIE9TIFgiLCIkYnJvd3NlciI6ICJDaHJvbWUiLCIkYnJvd3Nlcl92ZXJzaW9uIjogNDcsIiRpbml0aWFsX3JlZmVycmVyIjogIiRkaXJlY3QiLCIkaW5pdGlhbF9yZWZlcnJpbmdfZG9tYWluIjogIiRkaXJlY3QiLCJwcm9kdWN0IjogIkJ1c2luZXNzX1F1YXJ0ZXJseV8xIiwiJGVtYWlsIjogImphc29uKzIwMTUxMjA5KzExMjFAZ2xpZmZ5LmNvbSJ9LCIkdG9rZW4iOiAiZTdhZTg3MjZlYzliZjIyODhlMDA3ODczOTY0OWVhOWYiLCIkZGlzdGluY3RfaWQiOiA5MDAxMn0=");
*
* Results in:
* {
* "$set": {
* "$os": "Mac OS X",
* "$browser": "Chrome",
* "$browser_version": 47,
* "$initial_referrer": "$direct",
* "$initial_referring_domain": "$direct",
* "product": "Business_Quarterly_1",
* "$email": "jason+20151209+1121@gliffy.com"
* },
* "$token": "e7ae8726ec9bf2288e0078739649ea9f",
* "$distinct_id": 90012
* }
@jasonferrier
Copy link
Copy Markdown
Author

Placed on hold for now as I have enabled debug mode for non-production with Mixpanel:

mixpanel.init('ID', {debug:true});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment