kuhnza / angular-mixpanel

Mixpanel module for Angular JS
MIT License
54 stars 29 forks source link

Init question #27

Open swrocket opened 8 years ago

swrocket commented 8 years ago

` function init() { if (!Object.prototype.hasOwnProperty.call(window, 'mixpanel')) { throw 'Global mixpanel not available. Did you forget to include the library on the page?'; }

        mixpanel.init(apiKey);            

        waitTillAsyncApiLoaded(function () {
            if (superProperties) mixpanel.register(superProperties);
        });
    }

` In the above function, should it not call mixpanel.init(apiKey) inside the waitTillAsyncApiLoaded callback? I get weird cases where no events or properties are sent to Mixpanel and I'm wondering if in some cases the init is called before the library is fully loaded...