Hello, I using meteor develop for GoogleAnalytics (Analytics Reporting API v4). I test with file HelloAnalytics.html
(guide of Google). When put HelloAnalytics.html
at public
folder, it worked fine. However, use with meteor + reactjs
by add <script src="https://apis.google.com/js/client:platform.js"></script>
on client/head.html, the rest code in a component. I got error gapi.auth2.getAuthInstance() = null
(meteor was not load or run correct code in client:platform.js
or …).
Somebody got same error or know solution my case, thanks!
tags: GoogleAnalytics, gapi.auth2.getAuthInstance() = null,
I was found for my proplem is load library by javasript in Meteor.startup
Meteor.startup(function(){
(function(d,p,s){
for (var i=0; i<arguments.length; i++){
c = d.createElement('script');
c.src=s;
d[p].append(c);
}
}(document, 'head', 'https://apis.google.com/js/client:platform.js'));
})