You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

analytics.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* global ga */
  2. /* eslint-disable indent */
  3. (function(ctx) {
  4. /**
  5. *
  6. */
  7. function Analytics() {
  8. /* eslint-disable */
  9. /**
  10. * Google Analytics
  11. */
  12. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  13. (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)
  14. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  15. ga('create', 'UA-319188-14', 'jit.si');
  16. ga('send', 'pageview');
  17. /* eslint-enable */
  18. }
  19. Analytics.prototype.sendEvent = function(action, data) {
  20. // empty label if missing value for it and add the value,
  21. // the value should be integer or null
  22. let value = data.value;
  23. value = value ? Math.round(parseFloat(value)) : null;
  24. const label = data.label || '';
  25. ga('send', 'event', 'jit.si',
  26. `${action}.${data.browserName}`, label, value);
  27. };
  28. if (typeof ctx.JitsiMeetJS === 'undefined') {
  29. ctx.JitsiMeetJS = {};
  30. }
  31. if (typeof ctx.JitsiMeetJS.app === 'undefined') {
  32. ctx.JitsiMeetJS.app = {};
  33. }
  34. if (typeof ctx.JitsiMeetJS.app.analyticsHandlers === 'undefined') {
  35. ctx.JitsiMeetJS.app.analyticsHandlers = [];
  36. }
  37. ctx.JitsiMeetJS.app.analyticsHandlers.push(Analytics);
  38. })(window);