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'}
.