proposed snippet for multiple GA for Unity WebVR Assets
(function () {
if (navigator.doNotTrack === '1') { // TODO: Also check `localStorage` for the user-defined value from our custom opt-out.
return;
}
var MY_GA_ID = ''; // Note to developers: put your Google Analytics ID here (e.g., `UA-XXXXXXXX-Y`).
var MOZILLA_MAINTAINERS_GA_ID = 'UA-77033033-6'; // It's totally optional, but Mozilla Research would like to anonymously know of usage of the Unity WebVR Assets project in the wild so we can gauge interest.
(function(i,s,o,g,r,a,m){i.GoogleAnalyticsObject=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments);},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
function gaCreate () {
if (MY_GA_ID) {
ga('create', MY_GA_ID, 'auto');
}
if (MOZILLA_MAINTAINERS_GA_ID) {
ga('create', MOZILLA_MAINTAINERS_GA_ID, 'auto', 'maintainers');
}
}
function gaSendEvent (name, value) {
if (MY_GA_ID) {
ga('send', 'event', name, value);
}
if (MOZILLA_MAINTAINERS_GA_ID) {
ga('maintainers.send', 'event', name, value);
}
}
gaCreate();
gaSendEvent('supports.webvr', 'getVRDisplays' in navigator);
gaSendEvent('supports.webxr', 'xr' in navigator);
gaSendEvent('supports.gamepad', 'getGamepads' in navigator);
})();