-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathga-custom.js
More file actions
31 lines (22 loc) · 1.41 KB
/
ga-custom.js
File metadata and controls
31 lines (22 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(function(window, document, videojs) {
// map and indexOf polyfills for obsolete browsers
Array.prototype.map||(Array.prototype.map=function(r,t){var n,e,o;if(null==this)throw new TypeError(" this is null or not defined");var i=Object(this),a=i.length>>>0;if("function"!=typeof r)throw new TypeError(r+" is not a function");for(arguments.length>1&&(n=t),e=new Array(a),o=0;a>o;){var f,p;o in i&&(f=i[o],p=r.call(n,f,o,i),e[o]=p),o++}return e});
Array.prototype.indexOf||(Array.prototype.indexOf=function(r,t){var n;if(null==this)throw new TypeError('"this" is null or not defined');var e=Object(this),i=e.length>>>0;if(0===i)return-1;var a=+t||0;if(1/0===Math.abs(a)&&(a=0),a>=i)return-1;for(n=Math.max(a>=0?a:i-Math.abs(a),0);i>n;){if(n in e&&e[n]===r)return n;n++}return-1});
var gacustom = function(settings) {
var getDomain;
getDomain = function(email) {
if ( email === null ) { return ''; }
const split = email.split('@');
if (split.length > 1 ) {
const domain = split[1];
return domain;
}
return '';
}
debugger;
if ( window.HelpCenter !== undefined ) {
window.ga('gaTracker.set', 'dimension1', getDomain( window.HelpCenter.user.email ) );
}
}
videojs.registerPlugin('ga-custom', gacustom );
})(window, document, videojs);