First attempt to add Google Analytics to SvelteKit. This should be per site.
This commit is contained in:
@@ -53,6 +53,7 @@ import { storePopup } from '@skeletonlabs/skeleton';
|
||||
storePopup.set({ computePosition, autoUpdate, flip, shift, offset, arrow });
|
||||
|
||||
|
||||
import Analytics from '$lib/analytics.svelte'
|
||||
// import { api } from '$lib/api';
|
||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { events_loc, events_slct } from '$lib/ae_events_stores';
|
||||
@@ -101,7 +102,9 @@ if ($ae_loc?.site_cfg_json.slct__event_id) {
|
||||
// console.log(`Event ID already set:`, $events_slct.event_id);
|
||||
$events_loc.event_id = $events_slct.event_id;
|
||||
} else {
|
||||
console.log(`No Event ID set!`);
|
||||
if (log_lvl) {
|
||||
console.log(`No Event ID set!`);
|
||||
}
|
||||
}
|
||||
|
||||
// This is mainly for Precon CHOW
|
||||
@@ -112,7 +115,9 @@ if ($ae_loc.site_cfg_json.slct__sponsorship_cfg_id) {
|
||||
$slct.sponsorship_cfg_id = $ae_loc.sponsorship_cfg_id;
|
||||
$ae_loc.mod.sponsorships.cfg_id = $ae_loc.sponsorship_cfg_id;
|
||||
} else {
|
||||
console.log(`No Sponsorship Config ID set.`);
|
||||
if (log_lvl) {
|
||||
console.log(`No Sponsorship Config ID set.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -356,6 +361,10 @@ onMount(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- {#if ae_acct.loc.site_google_tracking_id} -->
|
||||
{#if $ae_loc?.site_google_tracking_id && $ae_loc?.site_google_tracking_id.length > 0}
|
||||
<Analytics bind:site_google_tracking_id={$ae_loc.site_google_tracking_id} />
|
||||
{/if}
|
||||
|
||||
<svelte:head>
|
||||
<title>{$ae_loc.title ?? 'Æ loading...'}</title>
|
||||
|
||||
Reference in New Issue
Block a user