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.6KB

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