More work on the initial loading.

This commit is contained in:
Scott Idem
2024-11-21 17:03:47 -05:00
parent d1f04e4dc3
commit 600bf7caa4
2 changed files with 21 additions and 23 deletions

View File

@@ -1,8 +1,10 @@
<script lang="ts">
// import { page } from '$app/stores'
export let log_lvl = 0;
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') {
window.dataLayer = window.dataLayer || [];
@@ -11,14 +13,10 @@ if (typeof window !== 'undefined') {
};
window.gtag('js', new Date());
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>
<svelte:head>
@@ -26,14 +24,4 @@ if (typeof window !== 'undefined') {
async
src="https://www.googletagmanager.com/gtag/js?id={site_google_tracking_id}">
</script>
<!-- <script>
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', site_google_tracking_id)
</script> -->
</svelte:head>

View File

@@ -191,16 +191,26 @@ if ($ae_loc.site_cfg_json.slct__sponsorship_cfg_id) {
// Updated 2024-11-21
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) {
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 {
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) {
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;
} 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;
}
}