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