Add partytown settings for Google Analytics
This commit is contained in:
4
.vscode/astrowind/config-schema.json
vendored
4
.vscode/astrowind/config-schema.json
vendored
@ -241,6 +241,10 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"partytown": {
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["id"]
|
"required": ["id"]
|
||||||
|
@ -17,7 +17,7 @@ import { SITE_CONFIG, ANALYTICS_CONFIG } from './src/utils/config.ts';
|
|||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const whenExternalScripts = (items = []) =>
|
const whenExternalScripts = (items = []) =>
|
||||||
ANALYTICS_CONFIG.vendors.googleAnalytics.id
|
ANALYTICS_CONFIG.vendors.googleAnalytics.id && ANALYTICS_CONFIG.vendors.googleAnalytics.partytown
|
||||||
? Array.isArray(items)
|
? Array.isArray(items)
|
||||||
? items.map((item) => item())
|
? items.map((item) => item())
|
||||||
: [items()]
|
: [items()]
|
||||||
@ -33,7 +33,7 @@ export default defineConfig({
|
|||||||
|
|
||||||
integrations: [
|
integrations: [
|
||||||
tailwind({
|
tailwind({
|
||||||
applyBaseStyles: false
|
applyBaseStyles: false,
|
||||||
}),
|
}),
|
||||||
sitemap(),
|
sitemap(),
|
||||||
image({
|
image({
|
||||||
|
@ -5,6 +5,6 @@ import { ANALYTICS_CONFIG } from '~/utils/config';
|
|||||||
|
|
||||||
{
|
{
|
||||||
ANALYTICS_CONFIG?.vendors?.googleAnalytics?.id ? (
|
ANALYTICS_CONFIG?.vendors?.googleAnalytics?.id ? (
|
||||||
<GoogleAnalytics id={String(ANALYTICS_CONFIG.vendors.googleAnalytics.id)} partytown={true} />
|
<GoogleAnalytics id={String(ANALYTICS_CONFIG.vendors.googleAnalytics.id)} partytown={ANALYTICS_CONFIG?.vendors?.googleAnalytics?.partytown} />
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import fs from 'fs';
|
|||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import merge from 'lodash.merge';
|
import merge from 'lodash.merge';
|
||||||
|
|
||||||
import type { MetaSEO } from '~/types';
|
import type { MetaData } from '~/types';
|
||||||
|
|
||||||
export interface SiteConfig {
|
export interface SiteConfig {
|
||||||
name: string;
|
name: string;
|
||||||
@ -11,7 +11,7 @@ export interface SiteConfig {
|
|||||||
trailingSlash?: boolean;
|
trailingSlash?: boolean;
|
||||||
googleSiteVerificationId?: string;
|
googleSiteVerificationId?: string;
|
||||||
}
|
}
|
||||||
export interface MetaDataConfig extends Omit<MetaSEO, 'title'> {
|
export interface MetaDataConfig extends Omit<MetaData, 'title'> {
|
||||||
title?: {
|
title?: {
|
||||||
default: string;
|
default: string;
|
||||||
template: string;
|
template: string;
|
||||||
@ -61,8 +61,8 @@ export interface AppBlogConfig {
|
|||||||
export interface AnalyticsConfig {
|
export interface AnalyticsConfig {
|
||||||
vendors: {
|
vendors: {
|
||||||
googleAnalytics: {
|
googleAnalytics: {
|
||||||
isEnabled?: boolean;
|
|
||||||
id?: string;
|
id?: string;
|
||||||
|
partytown?: boolean;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -187,8 +187,8 @@ const getAnalytics = () => {
|
|||||||
const _default = {
|
const _default = {
|
||||||
vendors: {
|
vendors: {
|
||||||
googleAnalytics: {
|
googleAnalytics: {
|
||||||
isEnabled: false,
|
|
||||||
id: undefined,
|
id: undefined,
|
||||||
|
partytown: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user