Releases: mixpanel/mixpanel-js
Config option for extra request headers
Set option xhr_headers
to pass extra headers with each request (for instance, to authenticate through a proxy):
mixpanel.init('MY-TOKEN', {
xhr_headers: {
'X-Foo': 'Bar',
'X-Baz': 'Qux',
},
});
GDPR improvements
- Add
cookie_prefix
option to GDPR opt-out utils, allowing customization of cookie name - Automatically delete user profile and charge data on GDPR opt-out (if specified)
GDPR opt in/out utility methods
Add set of opt in/out utility methods in preparation for GDPR See https://mixpanel.com/help/reference/javascript-full-api-reference for details
Remove obsolete autotrack event count metrics
v2.20.0 v2.20.0
Better error-handling and server-side support
- Exceptions when decoding JSON now throw a real
SyntaxError
rather than a Plain Old JavaScript Object. - Loading the SDK and running basic operations (init, identify, track) no longer causes exceptions in non-browser environments (although it doesn't actually send tracking calls over the network). This is useful for allowing
mixpanel-js
code to run unmodified in contexts like server-side rendering and non-browser tests.
Prevent Autotrack collecting attrs from input, textarea, select, contenteditable elements
Bug fix for Autotrack inadvertently removing form.inputs in certain cases
v2.16.0 made it possible for replace to be called on an input element if it has id="name" or name="id". This revision guards against this by ensuring type is string before calling any replace.
Prevent Autotrack collecting attrs from password or hidden fields
Always track via HTTPS.
Previously, track calls to api.mixpanel.com would be made using whatever protocol the page was loaded with. Now they will always use HTTPS.
people.unset() and miscellaneous fixes
The library now supports people.unset()
; see https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.people.unset for documentation.
NB: If using the embed code "snippet" for your mixpanel installation, please upgrade to the latest snippet to use people.unset()
safely.
Other fixes:
- Identify Chrome OS correctly (for $os property)
- Bugfix:
register_once()
no longer overwrites previously-registered but falsey values - Stub parts of DOM API when loading in non-browser environments (thanks @gfx)
- Log full "Implementation error" exceptions when DEBUG mode is on