Hacker News new | ask | show | jobs
by skotzko 4705 days ago
2 main reasons why I thought it was necessary:

1) It's not clear at all by reading minified code that this is what's going on -- I could only really see it when I got my hands on unminified code. Since not covered in the docs, it's just hard to know.

2) It has tightly coupled queueing and loading of the library, which I don't want: the snippet links instantiation / fetching of the library with the queueing function and wraps them all together so they can't be separated in the overall page load sequence. Combined with the fact that Mixpanel does not use as simple of a data structure as something like GA (simple array), I wanted a way to separate queueing (what my wrapper does) from later instantiation. Granted, the Mixpanel snippet is async but at the time of writing this, we didn't want to source our external JS in the head of our pages if at all possible. So even with the built in async / queueing structure, the Mixpanel snippet still doesn't fully meet what we're looking for (separation of queuing / instantiation).