您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

analytics.js 1.0KB

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