403Webshell
Server IP : 213.255.246.8  /  Your IP : 216.73.217.138
Web Server : Apache
System : Linux dublin.stapolin.com 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64
User : stapolin ( 1019)
PHP Version : 8.4.24
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/stapolin/public_html/tracking.stapolin.com/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/stapolin/public_html/tracking.stapolin.com/tracker.js
(function () {
    'use strict';

    var script = document.currentScript;
    if (!script) {
        var scripts = document.querySelectorAll('script[data-site-id]');
        script = scripts[scripts.length - 1];
    }
    if (!script) {
        return;
    }

    var siteId = script.getAttribute('data-site-id');
    if (!siteId) {
        return;
    }

    var endpoint = new URL('api/collect.php', script.src).toString();
    var storagePrefix = 'analytics_' + siteId + '_';
    var consent = window.analyticsConsent !== false;
    var pageStartedAt = Date.now();
    var pageViewId = uuid();
    var maxScrollDepth = 0;
    var sentScrollDepths = {};

    function uuid() {
        if (window.crypto && window.crypto.randomUUID) {
            return window.crypto.randomUUID();
        }
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
            var r = Math.random() * 16 | 0;
            var v = c === 'x' ? r : (r & 0x3 | 0x8);
            return v.toString(16);
        });
    }

    function getStored(key) {
        try {
            return window.localStorage.getItem(storagePrefix + key);
        } catch (error) {
            return null;
        }
    }

    function setStored(key, value) {
        try {
            window.localStorage.setItem(storagePrefix + key, value);
        } catch (error) {
            return;
        }
    }

    function sessionId() {
        var existing = getStored('session_id');
        var lastSeen = parseInt(getStored('last_seen') || '0', 10);
        var now = Date.now();
        if (!existing || now - lastSeen > 30 * 60 * 1000) {
            existing = uuid();
            setStored('session_id', existing);
        }
        setStored('last_seen', String(now));
        return existing;
    }

    function visitorId() {
        if (!consent) {
            return null;
        }
        var existing = getStored('visitor_id');
        if (!existing) {
            existing = uuid();
            setStored('visitor_id', existing);
        }
        return existing;
    }

    function metadata(extra) {
        var data = {
            site_id: siteId,
            event_uuid: uuid(),
            page_view_uuid: pageViewId,
            url: window.location.href,
            path: window.location.pathname || '/',
            title: document.title || '',
            referrer: document.referrer || '',
            timestamp: new Date().toISOString(),
            screen: window.screen ? window.screen.width + 'x' + window.screen.height : '',
            viewport: window.innerWidth + 'x' + window.innerHeight,
            language: navigator.language || '',
            do_not_track: navigator.doNotTrack === '1' || window.doNotTrack === '1' || navigator.msDoNotTrack === '1',
            visitor_id: visitorId(),
            session_id: sessionId(),
            consent_mode: consent ? 'persistent' : 'session'
        };
        for (var key in extra) {
            if (Object.prototype.hasOwnProperty.call(extra, key)) {
                data[key] = extra[key];
            }
        }
        return data;
    }

    function send(payload) {
        var body = JSON.stringify(payload);
        if (navigator.sendBeacon) {
            try {
                if (navigator.sendBeacon(endpoint, new Blob([body], { type: 'text/plain' }))) {
                    return;
                }
            } catch (error) {
                return;
            }
        }
        try {
            window.fetch(endpoint, {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: body,
                keepalive: true,
                credentials: 'omit'
            }).catch(function () {});
        } catch (error) {
            return;
        }
    }

    function trackPageView() {
        if (!consent && window.analyticsConsent === false) {
            return;
        }
        pageStartedAt = Date.now();
        pageViewId = uuid();
        maxScrollDepth = 0;
        sentScrollDepths = {};
        send(metadata({ type: 'page_view' }));
    }

    function track(name, properties) {
        if (!consent && window.analyticsConsent === false) {
            return;
        }
        properties = properties && typeof properties === 'object' ? properties : {};
        send(metadata({
            type: 'custom_event',
            event_name: String(name || '').slice(0, 80),
            category: String(properties.category || '').slice(0, 120),
            label: String(properties.label || '').slice(0, 190),
            value: typeof properties.value === 'number' ? properties.value : null,
            properties: safeProperties(properties)
        }));
    }

    function safeProperties(properties) {
        var allowed = {};
        Object.keys(properties).slice(0, 20).forEach(function (key) {
            var value = properties[key];
            if (value === null || ['string', 'number', 'boolean'].indexOf(typeof value) !== -1) {
                allowed[String(key).slice(0, 60)] = typeof value === 'string' ? value.slice(0, 300) : value;
            }
        });
        return allowed;
    }

    function sendExit() {
        send(metadata({
            type: 'page_exit',
            time_on_page: Math.max(0, Math.round((Date.now() - pageStartedAt) / 1000)),
            scroll_depth: maxScrollDepth
        }));
    }

    function updateScrollDepth() {
        var doc = document.documentElement;
        var body = document.body;
        var scrollTop = window.scrollY || doc.scrollTop || body.scrollTop || 0;
        var height = Math.max(body.scrollHeight, doc.scrollHeight, body.offsetHeight, doc.offsetHeight) - window.innerHeight;
        if (height <= 0) {
            return;
        }
        maxScrollDepth = Math.max(maxScrollDepth, Math.min(100, Math.round((scrollTop / height) * 100)));
        [25, 50, 75, 100].forEach(function (depth) {
            if (maxScrollDepth >= depth && !sentScrollDepths[depth]) {
                sentScrollDepths[depth] = true;
                track('scroll_depth', { category: 'engagement', label: String(depth), value: depth });
            }
        });
    }

    function patchHistory(method) {
        var original = history[method];
        history[method] = function () {
            var result = original.apply(this, arguments);
            setTimeout(trackPageView, 0);
            return result;
        };
    }

    window.analyticsTracker = {
        track: track,
        trackPageView: trackPageView,
        identify: function (externalId) {
            if (consent && externalId) {
                setStored('external_id', String(externalId).slice(0, 190));
            }
        },
        setConsent: function (allowed) {
            consent = allowed === true;
            window.analyticsConsent = consent;
            if (consent) {
                trackPageView();
            }
        }
    };

    document.addEventListener('click', function (event) {
        var link = event.target.closest && event.target.closest('a[href]');
        if (!link) {
            return;
        }
        var href = link.href || '';
        var isOutbound = link.hostname && link.hostname !== window.location.hostname;
        var isDownload = /\.(pdf|zip|csv|docx?|xlsx?|pptx?|jpg|jpeg|png|gif|webp)$/i.test(link.pathname || '');
        if (isOutbound) {
            track('outbound_link', { category: 'link', label: href });
        }
        if (isDownload) {
            track('file_download', { category: 'download', label: href });
        }
    }, true);

    window.addEventListener('scroll', updateScrollDepth, { passive: true });
    window.addEventListener('pagehide', sendExit);
    window.addEventListener('popstate', trackPageView);
    patchHistory('pushState');
    patchHistory('replaceState');

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', trackPageView);
    } else {
        trackPageView();
    }
})();

Youez - 2016 - github.com/yon3zu
LinuXploit