Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into darkyzhou-blog
Browse files Browse the repository at this point in the history
  • Loading branch information
darkyzhou committed Mar 3, 2024
2 parents 35a0a30 + 8a84026 commit ad95c60
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
41 changes: 24 additions & 17 deletions src/components/Analytics.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@
}
</script>
{#if enabled}
{#if gaMeasurementId}
{@html `<script src="https://www.googletagmanager.com/gtag/js?id=${gaMeasurementId}" async></script><script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '${gaMeasurementId}');
</script>`}
<svelte:head>
{#if enabled}
{#if gaMeasurementId}
<script src="https://www.googletagmanager.com/gtag/js?id=${gaMeasurementId}" async></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '${gaMeasurementId}');
</script>
{/if}
{#if baiduId}
<script src="https://hm.baidu.com/hm.js?${baiduId}" async></script>
{/if}
{#if umamiId}
<script
src="https://analytics.us.umami.is/script.js"
data-website-id="${umamiId}"
async
></script>
{/if}
{/if}
{#if baiduId}
{@html `<script src="https://hm.baidu.com/hm.js?${baiduId}" async></script>`}
{/if}
{#if umamiId}
{@html `<script defer src="https://analytics.us.umami.is/script.js" data-website-id="${umamiId}"></script>`}
{/if}
{/if}
</svelte:head>
12 changes: 5 additions & 7 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@
const backgroundName = sample(Object.keys(backgroundOffsets));
</script>
<svelte:head>
<Analytics
gaMeasurementId={basicConfiguration.analytics.gaMeasurementId}
baiduId={basicConfiguration.analytics.baiduId}
umamiId={basicConfiguration.analytics.umamiId}
/>
</svelte:head>
<Analytics
gaMeasurementId={basicConfiguration.analytics.gaMeasurementId}
baiduId={basicConfiguration.analytics.baiduId}
umamiId={basicConfiguration.analytics.umamiId}
/>
<div class="relative z-10">
<LoadingProgressIndicator loading={$loading} />
Expand Down

0 comments on commit ad95c60

Please sign in to comment.