More work on the initial loading.
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// import { page } from '$app/stores'
|
export let log_lvl = 0;
|
||||||
|
|
||||||
export let site_google_tracking_id: string = '';
|
export let site_google_tracking_id: string = '';
|
||||||
console.log(`site_google_tracking_id = `, site_google_tracking_id);
|
if (log_lvl) {
|
||||||
|
console.log(`AE Analytics: site_google_tracking_id = `, site_google_tracking_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
@@ -11,14 +13,10 @@ if (typeof window !== 'undefined') {
|
|||||||
};
|
};
|
||||||
window.gtag('js', new Date());
|
window.gtag('js', new Date());
|
||||||
window.gtag('config', site_google_tracking_id);
|
window.gtag('config', site_google_tracking_id);
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`AE Analytics: Google Analytics Tracking ID = `, site_google_tracking_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $: if (typeof gtag !== 'undefined') {
|
|
||||||
// gtag('config', site_google_tracking_id, {
|
|
||||||
// page_title: document.title,
|
|
||||||
// page_path: $page.url.pathname,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -26,14 +24,4 @@ if (typeof window !== 'undefined') {
|
|||||||
async
|
async
|
||||||
src="https://www.googletagmanager.com/gtag/js?id={site_google_tracking_id}">
|
src="https://www.googletagmanager.com/gtag/js?id={site_google_tracking_id}">
|
||||||
</script>
|
</script>
|
||||||
<!-- <script>
|
|
||||||
window.dataLayer = window.dataLayer || []
|
|
||||||
|
|
||||||
function gtag() {
|
|
||||||
dataLayer.push(arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
gtag('js', new Date())
|
|
||||||
gtag('config', site_google_tracking_id)
|
|
||||||
</script> -->
|
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|||||||
@@ -191,16 +191,26 @@ if ($ae_loc.site_cfg_json.slct__sponsorship_cfg_id) {
|
|||||||
|
|
||||||
// Updated 2024-11-21
|
// Updated 2024-11-21
|
||||||
if ($ae_loc.site_access_key || $ae_loc.site_domain_access_key) {
|
if ($ae_loc.site_access_key || $ae_loc.site_domain_access_key) {
|
||||||
console.log(`We need to do a current check against the allow_access value.`);
|
if (log_lvl > 1) {
|
||||||
|
console.log(`We need to do a current check against the allow_access value. site key: ${$ae_loc.site_access_key}, domain key: ${$ae_loc.site_domain_access_key}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $ae_loc.allow_access is set to they key if passed in the URL. It is set to true if they are just "trusted".
|
||||||
if ($ae_loc.site_access_key === $ae_loc.allow_access || $ae_loc.site_domain_access_key === $ae_loc.allow_access) {
|
if ($ae_loc.site_access_key === $ae_loc.allow_access || $ae_loc.site_domain_access_key === $ae_loc.allow_access) {
|
||||||
console.log(`PASS: The access key was checked earlier and we just now checked the key.`);
|
if (log_lvl > 1) {
|
||||||
|
console.log(`PASS: The allow_access was checked earlier and just now checked against the site or domain key.`);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`FAIL: The access key was checked earlier, but just now failed.`);
|
// console.log(`FAIL: The access key was checked earlier, but just now failed. Checking if they are trusted...`);
|
||||||
if ($ae_loc.trusted_access) {
|
if ($ae_loc.trusted_access) {
|
||||||
console.log(`FAIL: The access key was checked earlier and failed, but we have trusted access.`);
|
if (log_lvl > 1) {
|
||||||
|
console.log(`PASS: The access key was checked and failed, but we have trusted access.`);
|
||||||
|
}
|
||||||
$ae_loc.allow_access = true;
|
$ae_loc.allow_access = true;
|
||||||
} else {
|
} else {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`FAIL: The site and domain access key was checked and failed, and we do not have trusted access.`);
|
||||||
|
}
|
||||||
$ae_loc.allow_access = false;
|
$ae_loc.allow_access = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user