blob: f0162b1f63d5c67281fb3c4bdf28a2c4d964abdf (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// based on https://github.com/gorhill/uBlock/blob/8a1a8b103f56e4fcef1264e02dfd718a29bda006/src/web_accessible_resources/google-analytics_analytics.js
"use strict";
if (!window[window.GoogleAnalyticsObject || "ga"]) {
function ga() {
const len = arguments.length;
if (!len) {
return;
}
const args = Array.from(arguments);
let fn;
let a = args[len - 1];
if (a instanceof Object && a.hitCallback instanceof Function) {
fn = a.hitCallback;
} else {
const pos = args.indexOf("hitCallback");
if (pos !== -1 && args[pos + 1] instanceof Function) {
fn = args[pos + 1];
}
}
if (!(fn instanceof Function)) {
return;
}
try {
fn();
} catch (_) {}
}
ga.create = () => {};
ga.getByName = () => null;
ga.getAll = () => [];
ga.remove = () => {};
ga.loaded = true;
const gaName = window.GoogleAnalyticsObject || "ga";
window[gaName] = ga;
}
try {
window.dataLayer.hide.end();
} catch (_) {}
|