mixpanel-js
mixpanel-js copied to clipboard
Do not allow crash if track was called before init
We implemented mixpanel in our script which is distributed for thousands of clients to incorporate in their website. Under a specific condition, the track()
method was being called before we called init()
, triggering the following error:
This caused a major outage in our company, where our script stopped working for all our clients. The mixpanel library should not allow such crashes where a whole javascript build will stop working because a token wasn't passed. It should be straighforward to detect if init was called or not and display a better error message instead of letting a crash to happen.