<script defer src="<?php echo PATH_SYSTEM; ?>resources/js/jquery.min.js"></script>
<script defer src="<?php echo PATH_SYSTEM; ?>resources/js/ajaxify.min.js"></script>
<script defer src="<?php echo PATH_SYSTEM; ?>resources/js/bootstrap.bundle.min.js"></script>
<!-- script custom -->
<?php
if (!empty($javascript)) {
    foreach ($javascript as $script) {
        echo '<script defer src="' . $script . '?v=' . $setting->version . '"></script>';
    }
}
?>
<script defer src="<?php echo PATH_SYSTEM; ?>resources/js/main.js?v=<?php echo $setting->version; ?>"></script>
<?php if ($setting->adsense) { ?>
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-<?php echo $setting->adsense_id; ?>" crossorigin="anonymous"></script>
<?php } ?>

<?php if ($setting->google_analytics) { ?>
    <script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo $setting->google_analytics; ?>"></script>
    <script>
        window.dataLayer = window.dataLayer || [];

        function gtag() {
            dataLayer.push(arguments);
        }
        gtag('js', new Date());
        gtag('config', '<?php echo $setting->google_analytics; ?>', {
            'page_path': location.href.replace(location.origin, "")
        });
    </script>
<?php } ?>
<script>
    var CONFIG = {
        themeMode: '<?php echo $setting->theme_mode_site; ?>', // dark, light, auto
        lang: {
            this_uses_cookies: "<?php echo $_LANG['this_uses_cookies']; ?>",
            using_agree_to_our: "<?php echo $_LANG['using_agree_to_our']; ?>",
            privacy_policy: "<?php echo $_LANG['privacy_policy']; ?>",
            to_accept: "<?php echo $_LANG['to_accept']; ?>"
        },
        pathSystem: '<?php echo PATH_SYSTEM; ?>',
        clientId: '<?php echo $clientId; ?>',
        page1: '<?php echo $page1; ?>',
        page2: '<?php echo $page2; ?>',
        page3: '<?php echo $page3; ?>'
    };
</script>
