I develop a firefox extension and I want to track events in the extension using Google analytics.
I tried to add the extension and fire an event but it didn't work:
var _gaq = _gaq || [];
var _AnalyticsCode = 'UA-1234567-9';
_gaq.push(['_setAccount', _AnalyticsCode]);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = 'https://ssl.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
function googleAnalyticsTrackEvent(category, action) {
_gaq.push(['_trackEvent', category, action]);
}
googleAnalyticsTrackEvent('category','action');
Is there any other way I could track events in my plugin?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.