feat: add out of the box support for Splitbee Analytics

This commit is contained in:
Liran Tal
2022-10-11 11:18:35 +00:00
parent e7fd6cc72c
commit 45850cbd70
3 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import defaultImageSrc from '~/assets/images/default.png';
import { SITE } from '~/config.mjs';
import Fonts from '../atoms/Fonts.astro';
import ExtraMetaTags from '../atoms/ExtraMetaTags.astro';
import SplitbeeAnalytics from "./SplitbeeAnalytics.astro";
const { src: defaultImage } = await getImage({
src: defaultImageSrc,
@ -76,4 +77,6 @@ const image =
<!-- Google Analytics -->
{SITE.googleAnalyticsId && <GoogleAnalytics id={String(SITE.googleAnalyticsId)} partytown={true} />}
{SITE.splitbeeAnalytics?.enabled && <SplitbeeAnalytics {...SITE.splitbeeAnalytics} />}
<ExtraMetaTags />

View File

@ -0,0 +1,6 @@
<!-- Splitbee Analytics -->
<script
data-respect-dnt={Astro.props.doNotTrack}
data-no-cookie={Astro.props.noCookieMode}
async src="https://cdn.splitbee.io/sb.js">
</script>

View File

@ -9,6 +9,12 @@ export const SITE = {
googleAnalyticsId: false, // or "G-XXXXXXXXXX",
googleSiteVerificationId: 'orcPxI47GSa-cRvY11tUe6iGg2IO_RPvnA1q95iEM3M',
splitbeeAnalytics: {
enabled: false,
doNotTrack: true,
noCookieMode: false,
}
};
export const BLOG = {