/******* Do not edit this file *******
Simple Custom CSS and JS - by Silkypress.com
Saved: Sep 19 2024 | 07:49:12 */
        function generateRandomId() {
            return 'link-' + Math.random().toString(36).substr(2, 9);
        }

        function redirectToRandomSite() {
            var sites = [
                { url: 'https://h5.pk7788.cc/?superior=428110', name: 'pklive' },
                                { url: 'https://www.lvrich.com/', name: 'lvbet' },
                                { url: 'https://www.sm2024.online', name: 'smbet' },
                                { url: 'https://www.voslot888.com/?pid=pk777', name: 'voslot' },
                                { url: 'https://www.ph6777.com/a/324525', name: 'sg' }
            ];
            var randomIndex = Math.floor(Math.random() * sites.length);
            var selectedSite = sites[randomIndex];
            var linkId = generateRandomId();

            trackGAEvent(linkId, selectedSite.url, selectedSite.name);
            setTimeout(function() {
                window.open(selectedSite.url, '_blank');
            }, 100);  // Adding a delay to ensure GA event is tracked before opening new tab
        }

        function trackGAEvent(linkId, selectedSiteUrl, selectedSiteName) {
            // Google Analytics tracking code
            // Replace 'GA_TRACKING_ID' with your actual tracking ID
            gtag('event', selectedSiteName, {  // Use selectedSiteName as the event action
                'event_category': 'Outbound Link',  // The category of the event
                'event_label': linkId,  // The label, here is the random generated ID
                'value': selectedSiteUrl  // The value, here is the selected site URL
            });
        }

        // Load Google Analytics library
        window.dataLayer = window.dataLayer || [];
        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());
        gtag('config', 'G-6C2H3DCH8J');  // Replace 'GA_TRACKING_ID' with your actual tracking ID

        // Bind the click event to the button with id 'randomSiteButton'
        window.onload = function() {
            var buttons = document.getElementsByClassName('randomSiteButton');
            for (var i = 0; i < buttons.length; i++) {
                buttons[i].addEventListener('click', redirectToRandomSite);
            }
        }