I am using analytics.js. However, I do not load Google Analytics along with the analytics.js script as I am waiting for some data to come in first.
Hence I call ga('create', googleKey, 'auto');
at some point later. This script should always execute, but I want to be 100% sure. Thus, I want to invoke the function in my controller but only in case it has not been called before.
Thus, how can I make sure that it has been called and executed before?
I thought that window.GoogleAnalyticsObject
helps me here. But it seems, that this only tells me that ga is in use and not exactly when it is loaded and if it is loaded.
Is there any work around?