mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

Do not allow crash if track was called before init

Open pietrofxq opened this issue 5 years ago • 0 comments

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:

image

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.

pietrofxq avatar Feb 03 '20 16:02 pietrofxq