Skip to content

Support for non-base64 request payloads

Compare
Choose a tag to compare
@tdumitrescu tdumitrescu released this 06 Jan 23:10
· 588 commits to master since this release

The new api_payload_format configuration option controls whether request payloads are base64-encoded before sending (base64 option) or sent as plain JSON (json option).

When the tracking server (api_host) is Mixpanel's own API servers (*.mixpanel.com), this value now defaults to json. This setting reduces payload size, simplifies inspection of request content with browser dev tools, and supports emoji content πŸ”₯ seamlessly:

mixpanel.track('Signed up πŸ‘', {name: 'πŸ‘ΎπŸ’»πŸ‘ΎπŸ’»πŸ‘Ύ'});

For backwards compatibility with proxy server implementations, if api_host is NOT a mixpanel.com server, then the default format remains base64. To force plain JSON encoding with a custom proxy host, initialize with option {api_payload_format: 'json'}.