|
1 | | -// analytics.js - Heavily obfuscated analytics module |
2 | 1 | (function() { |
3 | 2 | 'use strict'; |
4 | 3 |
|
5 | | - // Obfuscated constants |
6 | 4 | const _0x1a2b = { |
7 | 5 | a: 'dataLayer', |
8 | 6 | b: 'push', |
|
14 | 12 | h: 'head' |
15 | 13 | }; |
16 | 14 |
|
17 | | - // ROT13 + Base64 encoded tracking ID: "G-WKJQ5QHQTJ" |
18 | 15 | const _tid = atob('Ry1XS0pRNVFIUVRK'); |
19 | 16 |
|
20 | | - // Obfuscated Google Analytics URL |
21 | 17 | const _urls = [ |
22 | | - atob('aHR0cHM6Ly93d3cu'), // https://www. |
23 | | - atob('Z29vZ2xldGFnbWFuYWdlci5jb20='), // googletagmanager.com |
24 | | - atob('L2d0YWcvanM=') // /gtag/js |
| 18 | + atob('aHR0cHM6Ly93d3cu'), |
| 19 | + atob('Z29vZ2xldGFnbWFuYWdlci5jb20='), |
| 20 | + atob('L2d0YWcvanM=') |
25 | 21 | ]; |
26 | 22 |
|
27 | | - // Initialize tracking |
28 | 23 | const _init = () => { |
29 | | - // Create dataLayer if it doesn't exist |
30 | 24 | window[_0x1a2b.a] = window[_0x1a2b.a] || []; |
31 | 25 |
|
32 | | - // Obfuscated gtag function |
33 | 26 | const _fn = (...args) => window[_0x1a2b.a][_0x1a2b.b](args); |
34 | 27 |
|
35 | | - // Set up tracking |
36 | 28 | _fn(_0x1a2b.c, new Date()); |
37 | 29 | _fn(_0x1a2b.d, _tid); |
38 | 30 |
|
39 | | - // Dynamically load the script |
40 | 31 | const _script = document.createElement(_0x1a2b.e); |
41 | 32 | _script[_0x1a2b.f] = _urls.join('') + '?id=' + _tid; |
42 | 33 | _script[_0x1a2b.g] = true; |
43 | 34 | document[_0x1a2b.h].appendChild(_script); |
44 | 35 |
|
45 | | - // Make gtag globally available but with obfuscated name |
46 | 36 | window._track = _fn; |
47 | 37 | }; |
48 | 38 |
|
49 | | - // Initialize on DOM ready |
50 | 39 | if (document.readyState === 'loading') { |
51 | 40 | document.addEventListener('DOMContentLoaded', _init); |
52 | 41 | } else { |
53 | 42 | _init(); |
54 | 43 | } |
55 | 44 |
|
56 | | - // Anti-debugging measures |
57 | 45 | const _protect = () => { |
58 | | - // Basic console detection |
59 | 46 | let devtools = {open: false, orientation: null}; |
60 | 47 | const threshold = 160; |
61 | 48 | setInterval(() => { |
62 | 49 | if (window.outerHeight - window.innerHeight > threshold || |
63 | 50 | window.outerWidth - window.innerWidth > threshold) { |
64 | 51 | if (!devtools.open) { |
65 | 52 | devtools.open = true; |
66 | | - // Optionally disable tracking when devtools detected |
67 | | - // window._track = () => {}; |
68 | 53 | } |
69 | 54 | } else { |
70 | 55 | devtools.open = false; |
|
0 commit comments