@getvitops/astro 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/dist/index.d.mts +65 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +144 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -5
- package/src/ads.ts +156 -0
- package/src/analytics.ts +22 -4
- package/src/components/Ads.astro +47 -0
- package/src/components/Analytics.astro +7 -30
- package/src/components/GatedTags.astro +46 -0
- package/src/scripts/tracking.ts +2 -0
- package/virtual.d.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/astro",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Astro integration for the Vitops design system — favicons/PWA, web-component scripts, and CSS, via a getvitops() integration + <Head /> component.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
"src/components/Seo.astro",
|
|
10
10
|
"src/seo.ts",
|
|
11
11
|
"src/components/Analytics.astro",
|
|
12
|
+
"src/components/Ads.astro",
|
|
13
|
+
"src/components/GatedTags.astro",
|
|
12
14
|
"src/components/CookieConsent.astro",
|
|
13
15
|
"src/analytics.ts",
|
|
16
|
+
"src/ads.ts",
|
|
14
17
|
"src/components/Subgrid.astro",
|
|
15
18
|
"src/components/Cards.astro",
|
|
16
19
|
"src/components/NodeRenderer.astro",
|
|
@@ -45,6 +48,7 @@
|
|
|
45
48
|
"./Head.astro": "./src/components/Head.astro",
|
|
46
49
|
"./Seo.astro": "./src/components/Seo.astro",
|
|
47
50
|
"./Analytics.astro": "./src/components/Analytics.astro",
|
|
51
|
+
"./Ads.astro": "./src/components/Ads.astro",
|
|
48
52
|
"./CookieConsent.astro": "./src/components/CookieConsent.astro",
|
|
49
53
|
"./Tracking.astro": "./src/components/Tracking.astro",
|
|
50
54
|
"./components/Subgrid.astro": "./src/components/Subgrid.astro",
|
|
@@ -66,10 +70,10 @@
|
|
|
66
70
|
"access": "public"
|
|
67
71
|
},
|
|
68
72
|
"dependencies": {
|
|
69
|
-
"@getvitops/
|
|
70
|
-
"@getvitops/
|
|
71
|
-
"@getvitops/
|
|
72
|
-
"@getvitops/utils": "4.
|
|
73
|
+
"@getvitops/core": "4.1.0",
|
|
74
|
+
"@getvitops/generator": "4.1.0",
|
|
75
|
+
"@getvitops/vite": "4.1.0",
|
|
76
|
+
"@getvitops/utils": "4.1.0"
|
|
73
77
|
},
|
|
74
78
|
"devDependencies": {
|
|
75
79
|
"@astrojs/sitemap": "^3.7.3",
|
package/src/ads.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `<Ads />` resolution layer — the site's ad properties in, the exact tags to
|
|
3
|
+
* emit out.
|
|
4
|
+
*
|
|
5
|
+
* A sibling of `analytics.ts`, deliberately not part of it. The two render the
|
|
6
|
+
* same gated markup, but they answer different questions and four things differ:
|
|
7
|
+
*
|
|
8
|
+
* - **Where they come from.** Analytics providers are integration options
|
|
9
|
+
* (`vitops({ analytics })`); ad properties are `site.ads` in the site config,
|
|
10
|
+
* because the ad account is a fact about the site that `vitops ads setup`,
|
|
11
|
+
* `vitops ads lint` and the generated cookie notice all read too.
|
|
12
|
+
* - **Who decides the consent category.** `resolveAnalytics` *derives* it from
|
|
13
|
+
* whether the provider sets cookies, so a consumer cannot mark Google Analytics
|
|
14
|
+
* `necessary` to dodge a banner. Every ad pixel sets cookies and is advertising,
|
|
15
|
+
* so the answer is `marketing` unless the config says `analytics` — a stated
|
|
16
|
+
* fact, not a derivation.
|
|
17
|
+
* - **What the key means.** `ResolvedTag['key']` is the four analytics providers,
|
|
18
|
+
* and `analytics.ts` pairs that set against the generator's processor table.
|
|
19
|
+
* Widening it to eight ad platforms would make that check answer for tags it
|
|
20
|
+
* does not govern.
|
|
21
|
+
* - **When they fire.** Analytics is gated per environment by
|
|
22
|
+
* `environments.<env>.analytics`; a preview deployment sending pageviews is
|
|
23
|
+
* survivable, one firing conversion pixels is not, so ads gets its own switch.
|
|
24
|
+
*
|
|
25
|
+
* Everything decidable is here and unit-tested; `Ads.astro` renders what this
|
|
26
|
+
* returns and chooses nothing.
|
|
27
|
+
*/
|
|
28
|
+
import { AD_PLATFORMS, AD_PROVIDER_KEYS, type AdProvider } from '@getvitops/utils/ads';
|
|
29
|
+
import type { AnalyticsStrategy, ConsentCategory, GatedTag } from './analytics.ts';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* One ad property, mirroring a `site.ads` entry field for field.
|
|
33
|
+
*
|
|
34
|
+
* Structural rather than `SiteAdProperty` imported from the generator, matching
|
|
35
|
+
* how `GetvitopsSeoOptions` and `GetvitopsTrackingOptions` already work: the
|
|
36
|
+
* component surface must stay usable by a consumer who passes a plain object.
|
|
37
|
+
*/
|
|
38
|
+
export interface GetvitopsAdProperty {
|
|
39
|
+
accountId?: string;
|
|
40
|
+
pixelId?: string;
|
|
41
|
+
conversionLabel?: string;
|
|
42
|
+
/** Default `marketing`. `analytics` for a property used purely for measurement. */
|
|
43
|
+
category?: 'marketing' | 'analytics';
|
|
44
|
+
/** False keeps the property on record without emitting its tag. */
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type GetvitopsAdsOptions = Partial<Record<AdProvider, GetvitopsAdProperty>>;
|
|
49
|
+
|
|
50
|
+
/** One ad tag. `key` is the platform, so a caller can find one without matching prose. */
|
|
51
|
+
export interface ResolvedAdTag extends GatedTag {
|
|
52
|
+
key: AdProvider;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ResolvedAds {
|
|
56
|
+
tags: ResolvedAdTag[];
|
|
57
|
+
/** Does anything here need `@getvitops/core/consent` loaded? */
|
|
58
|
+
needsRuntime: boolean;
|
|
59
|
+
/** Configuration problems, as prose. The integration logs these. */
|
|
60
|
+
warnings: string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ResolveAdsContext {
|
|
64
|
+
/** Is the consent gate enabled on this site (`vitops({ consent })`)? */
|
|
65
|
+
consent?: boolean;
|
|
66
|
+
/** Categories the banner offers, so we can catch a demand with no row. */
|
|
67
|
+
consentCategories?: readonly string[];
|
|
68
|
+
/** `environments.<env>.ads` — false switches every tag off for this build. */
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
/** When the tags load. Default `idle`: a pixel is never worth the critical path. */
|
|
71
|
+
strategy?: AnalyticsStrategy;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* IDs land inside an inline `<script>`, so they are checked rather than trusted —
|
|
76
|
+
* the same guard, for the same reason, as `analytics.ts`'s `SAFE_ID`. A `</script>`
|
|
77
|
+
* in a pixel ID is not a plausible accident; arbitrary script injection from a
|
|
78
|
+
* config file is not a plausible thing to allow either.
|
|
79
|
+
*/
|
|
80
|
+
const SAFE_ID = /^[\w.-]+$/;
|
|
81
|
+
|
|
82
|
+
/** Resolve the configured ad properties into the tags `<Ads />` emits. */
|
|
83
|
+
export function resolveAds(
|
|
84
|
+
ads: GetvitopsAdsOptions | undefined,
|
|
85
|
+
ctx: ResolveAdsContext = {},
|
|
86
|
+
): ResolvedAds {
|
|
87
|
+
const warnings: string[] = [];
|
|
88
|
+
const tags: ResolvedAdTag[] = [];
|
|
89
|
+
const strategy = ctx.strategy ?? 'idle';
|
|
90
|
+
|
|
91
|
+
const configured = AD_PROVIDER_KEYS.filter((p) => ads?.[p] != null);
|
|
92
|
+
if (configured.length === 0) return { tags, needsRuntime: false, warnings };
|
|
93
|
+
|
|
94
|
+
// A whole-environment switch, checked before anything else: a preview deploy
|
|
95
|
+
// must be able to carry the same config without firing a single pixel.
|
|
96
|
+
if (ctx.enabled === false) return { tags, needsRuntime: false, warnings };
|
|
97
|
+
|
|
98
|
+
for (const provider of configured) {
|
|
99
|
+
const entry = ads![provider]!;
|
|
100
|
+
if (entry.enabled === false) continue;
|
|
101
|
+
|
|
102
|
+
const platform = AD_PLATFORMS[provider];
|
|
103
|
+
const id = entry[platform.tag.needs];
|
|
104
|
+
if (!id) {
|
|
105
|
+
warnings.push(
|
|
106
|
+
`ads: ${provider} has no ${platform.tag.needs}, so no tag is emitted. ` +
|
|
107
|
+
`Run \`vitops ads setup\` to be prompted for it.`,
|
|
108
|
+
);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (!SAFE_ID.test(id)) {
|
|
112
|
+
warnings.push(`ads: ${provider} ${platform.tag.needs} "${id}" is not a valid ID. Skipped.`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const category: ConsentCategory = entry.category ?? 'marketing';
|
|
117
|
+
tags.push({
|
|
118
|
+
key: provider,
|
|
119
|
+
provider: platform.name,
|
|
120
|
+
category,
|
|
121
|
+
// Every platform in the table sets cookies; the tag is gated whenever the
|
|
122
|
+
// site has a gate. With no gate the tag still renders — and the warning
|
|
123
|
+
// below says what that means, rather than silently declining to advertise.
|
|
124
|
+
setsCookies: true,
|
|
125
|
+
cookies: platform.tag.cookies,
|
|
126
|
+
strategy,
|
|
127
|
+
gated: ctx.consent === true,
|
|
128
|
+
inline: platform.tag.bootstrap(id, { provider, ...entry }),
|
|
129
|
+
src: platform.tag.src ? platform.tag.src(id) : null,
|
|
130
|
+
attrs: {},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (tags.length === 0) return { tags, needsRuntime: false, warnings };
|
|
135
|
+
|
|
136
|
+
if (ctx.consent !== true) {
|
|
137
|
+
warnings.push(
|
|
138
|
+
`ads: ${tags.map((t) => t.provider).join(', ')} ${tags.length === 1 ? 'sets' : 'set'} ` +
|
|
139
|
+
'advertising cookies, and `consent` is off — so they load for every visitor with no way ' +
|
|
140
|
+
'to decline. Set `consent: true`.',
|
|
141
|
+
);
|
|
142
|
+
} else {
|
|
143
|
+
const missing = [...new Set(tags.map((t) => t.category))].filter(
|
|
144
|
+
(c) => ctx.consentCategories && !ctx.consentCategories.includes(c),
|
|
145
|
+
);
|
|
146
|
+
if (missing.length)
|
|
147
|
+
warnings.push(
|
|
148
|
+
`ads: the tags demand the ${missing.join(', ')} consent categor${missing.length === 1 ? 'y' : 'ies'}, ` +
|
|
149
|
+
`but the banner offers ${ctx.consentCategories?.join(', ') || 'nothing'}. Add ` +
|
|
150
|
+
`${missing.join(', ')} to \`consent.categories\`, or the tags wait on a question the ` +
|
|
151
|
+
'banner never asks.',
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return { tags, needsRuntime: true, warnings };
|
|
156
|
+
}
|
package/src/analytics.ts
CHANGED
|
@@ -105,9 +105,22 @@ export interface GetvitopsConsentOptions {
|
|
|
105
105
|
policyUrl?: string;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
/**
|
|
109
|
+
* A third-party tag, fully resolved — everything `<GatedTags />` needs to render
|
|
110
|
+
* one, with nothing left to decide.
|
|
111
|
+
*
|
|
112
|
+
* Shared by `<Analytics />` and `<Ads />` on purpose: the inert-markup rule
|
|
113
|
+
* (`type="text/plain"`, the URL on `data-src`, never a live `src`) is the whole
|
|
114
|
+
* consent gate, and it must have exactly one implementation. What differs between
|
|
115
|
+
* the two is where the tag comes from and who decides its category, which is why
|
|
116
|
+
* they have separate resolvers over one shape rather than one resolver over two
|
|
117
|
+
* vocabularies.
|
|
118
|
+
*
|
|
119
|
+
* `key` is left to each resolver: analytics keys are its four providers, ads keys
|
|
120
|
+
* are `AdProvider`. Widening it into one union here would let a provider from
|
|
121
|
+
* either side satisfy a check meant for the other.
|
|
122
|
+
*/
|
|
123
|
+
export interface GatedTag {
|
|
111
124
|
/** The provider as a reader would recognise it — used in warnings. */
|
|
112
125
|
provider: string;
|
|
113
126
|
category: ConsentCategory;
|
|
@@ -127,6 +140,11 @@ export interface ResolvedTag {
|
|
|
127
140
|
attrs: Record<string, string>;
|
|
128
141
|
}
|
|
129
142
|
|
|
143
|
+
/** One analytics tag. */
|
|
144
|
+
export interface ResolvedTag extends GatedTag {
|
|
145
|
+
key: 'googleAnalytics' | 'clarity' | 'matomo' | 'plausible';
|
|
146
|
+
}
|
|
147
|
+
|
|
130
148
|
export interface ResolvedAnalytics {
|
|
131
149
|
tags: ResolvedTag[];
|
|
132
150
|
/** Does anything here need `@getvitops/core/consent` loaded? */
|
|
@@ -316,7 +334,7 @@ export function resolveAnalytics(
|
|
|
316
334
|
}
|
|
317
335
|
|
|
318
336
|
/** Which optional categories a set of tags actually needs a visitor to decide. */
|
|
319
|
-
export function consentCategories(tags:
|
|
337
|
+
export function consentCategories(tags: GatedTag[]): OptionalConsentCategory[] {
|
|
320
338
|
const used = new Set<OptionalConsentCategory>();
|
|
321
339
|
for (const tag of tags) {
|
|
322
340
|
if (tag.category !== 'necessary') used.add(tag.category);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* <Ads /> — the site's advertising pixels, off the critical path and behind the
|
|
4
|
+
* consent gate. Place in your layout's <head>; requires the vitops()
|
|
5
|
+
* integration, which supplies `virtual:getvitops/head`.
|
|
6
|
+
*
|
|
7
|
+
* A dumb renderer over `resolveAds()` (src/ads.ts) — which properties, which
|
|
8
|
+
* consent category, which cookies and whether this environment fires at all are
|
|
9
|
+
* decided there and unit-tested. Nothing in this file chooses anything.
|
|
10
|
+
*
|
|
11
|
+
* The properties come from the site config's `site.ads` block, not from an
|
|
12
|
+
* integration option: the ad account is a fact about the site, and the same block
|
|
13
|
+
* drives `vitops ads setup` (the domain-verification record), `vitops ads lint`
|
|
14
|
+
* and the cookie notice `vitops legal` generates. One source, so a pixel cannot be
|
|
15
|
+
* running while the site's own notice omits it.
|
|
16
|
+
*
|
|
17
|
+
* Pairs with <Tracking />, which captures the click ID the pixel's platform
|
|
18
|
+
* stamped on the landing URL. Neither implies the other — attribution works with
|
|
19
|
+
* no pixel, and a pixel works with no attribution — but a site running ads
|
|
20
|
+
* normally wants both.
|
|
21
|
+
*/
|
|
22
|
+
import { resolveAds } from '../ads.ts';
|
|
23
|
+
import type { AnalyticsStrategy } from '../analytics.ts';
|
|
24
|
+
import GatedTags from './GatedTags.astro';
|
|
25
|
+
// @ts-ignore — virtual module provided by the vitops() integration at build time
|
|
26
|
+
import head from 'virtual:getvitops/head';
|
|
27
|
+
|
|
28
|
+
interface Props {
|
|
29
|
+
/** Render nothing on this page. Defaults to true (the per-environment switch is `environments.<env>.ads`). */
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
/** Override the load strategy for this page. */
|
|
32
|
+
strategy?: AnalyticsStrategy;
|
|
33
|
+
}
|
|
34
|
+
const { enabled = true, strategy } = Astro.props;
|
|
35
|
+
|
|
36
|
+
// `head.ads` is already environment-resolved by the integration; `enabled` here is
|
|
37
|
+
// the per-page override on top of it.
|
|
38
|
+
const { tags } = enabled
|
|
39
|
+
? resolveAds(head.ads?.properties, {
|
|
40
|
+
consent: head.consent,
|
|
41
|
+
enabled: head.ads?.enabled,
|
|
42
|
+
...(strategy ? { strategy } : {}),
|
|
43
|
+
})
|
|
44
|
+
: { tags: [] };
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
<GatedTags tags={tags} />
|
|
@@ -8,17 +8,14 @@
|
|
|
8
8
|
* about which tag, which consent category and which cookies lives there and is
|
|
9
9
|
* unit-tested. Nothing in this file chooses anything.
|
|
10
10
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* them when their category is granted and their strategy has fired.
|
|
17
|
-
*
|
|
18
|
-
* Emits no `preconnect` on purpose: warming a connection at parse time is exactly
|
|
19
|
-
* the critical-path cost the `idle` strategy exists to avoid.
|
|
11
|
+
* The markup itself is <GatedTags />, shared with <Ads />: the inert
|
|
12
|
+
* `type="text/plain"` + `data-src` shape is the whole gate, and it has exactly one
|
|
13
|
+
* implementation. <Ads /> is a sibling rather than part of this component because
|
|
14
|
+
* ad properties come from the site config, state their own consent category and
|
|
15
|
+
* switch per environment separately — see src/ads.ts.
|
|
20
16
|
*/
|
|
21
17
|
import { type AnalyticsStrategy, resolveAnalytics } from '../analytics.ts';
|
|
18
|
+
import GatedTags from './GatedTags.astro';
|
|
22
19
|
// @ts-ignore — virtual module provided by the vitops() integration at build time
|
|
23
20
|
import head from 'virtual:getvitops/head';
|
|
24
21
|
|
|
@@ -36,24 +33,4 @@ const { tags } = enabled
|
|
|
36
33
|
: { tags: [] };
|
|
37
34
|
---
|
|
38
35
|
|
|
39
|
-
{tags
|
|
40
|
-
? (
|
|
41
|
-
<script
|
|
42
|
-
is:inline
|
|
43
|
-
type="text/plain"
|
|
44
|
-
data-vitops-tag
|
|
45
|
-
data-consent={tag.category}
|
|
46
|
-
data-strategy={tag.strategy}
|
|
47
|
-
data-src={tag.src}
|
|
48
|
-
data-consent-cookies={tag.cookies.length ? tag.cookies.join(',') : undefined}
|
|
49
|
-
{...tag.attrs}
|
|
50
|
-
set:html={tag.inline}
|
|
51
|
-
/>
|
|
52
|
-
)
|
|
53
|
-
: (
|
|
54
|
-
<>
|
|
55
|
-
{tag.inline && <script is:inline set:html={tag.inline} />}
|
|
56
|
-
{tag.src && <script is:inline async src={tag.src} {...tag.attrs}></script>}
|
|
57
|
-
</>
|
|
58
|
-
)
|
|
59
|
-
)}
|
|
36
|
+
<GatedTags tags={tags} />
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* <GatedTags /> — the one place a third-party tag becomes markup.
|
|
4
|
+
*
|
|
5
|
+
* Shared by <Analytics /> and <Ads />, and shared deliberately: the gate is
|
|
6
|
+
* `type="text/plain"` with the URL on `data-src`, so the browser never parses the
|
|
7
|
+
* body as script and never fetches the library. An undecided or declining
|
|
8
|
+
* visitor's page issues no third-party request at all. Consent implemented by
|
|
9
|
+
* *asking a tracker not to track* is a promise; this is a fact about the document
|
|
10
|
+
* — and a fact with two implementations is one rewrite away from being neither.
|
|
11
|
+
*
|
|
12
|
+
* Decides nothing. Every tag arrives fully resolved from `analytics.ts` or
|
|
13
|
+
* `ads.ts`, both of which are pure and unit-tested.
|
|
14
|
+
*
|
|
15
|
+
* Emits no `preconnect` on purpose: warming a connection at parse time is exactly
|
|
16
|
+
* the critical-path cost the `idle` strategy exists to avoid.
|
|
17
|
+
*/
|
|
18
|
+
import type { GatedTag } from '../analytics.ts';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
tags: GatedTag[];
|
|
22
|
+
}
|
|
23
|
+
const { tags } = Astro.props;
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
{tags.map((tag) => tag.gated
|
|
27
|
+
? (
|
|
28
|
+
<script
|
|
29
|
+
is:inline
|
|
30
|
+
type="text/plain"
|
|
31
|
+
data-vitops-tag
|
|
32
|
+
data-consent={tag.category}
|
|
33
|
+
data-strategy={tag.strategy}
|
|
34
|
+
data-src={tag.src}
|
|
35
|
+
data-consent-cookies={tag.cookies.length ? tag.cookies.join(',') : undefined}
|
|
36
|
+
{...tag.attrs}
|
|
37
|
+
set:html={tag.inline}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
: (
|
|
41
|
+
<>
|
|
42
|
+
{tag.inline && <script is:inline set:html={tag.inline} />}
|
|
43
|
+
{tag.src && <script is:inline async src={tag.src} {...tag.attrs}></script>}
|
|
44
|
+
</>
|
|
45
|
+
)
|
|
46
|
+
)}
|
package/src/scripts/tracking.ts
CHANGED
|
@@ -39,6 +39,8 @@ const CLICK_ID_PARAMS = [
|
|
|
39
39
|
'rdt_cid', // Reddit
|
|
40
40
|
'ScCid', // Snapchat
|
|
41
41
|
'msclkid', // Microsoft/Bing
|
|
42
|
+
'li_fat_id', // LinkedIn
|
|
43
|
+
'epik', // Pinterest
|
|
42
44
|
] as const;
|
|
43
45
|
|
|
44
46
|
const UTM_PARAMS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'] as const;
|
package/virtual.d.ts
CHANGED
|
@@ -52,6 +52,12 @@ declare module 'virtual:getvitops/head' {
|
|
|
52
52
|
// the others, and the offered consent categories it checks against are known
|
|
53
53
|
// only there.
|
|
54
54
|
tracking: { enabled: boolean; category: string; cookies: string[] } | null;
|
|
55
|
+
// The site config's `site.ads` block plus this environment's switch —
|
|
56
|
+
// structurally `{ enabled, properties }` (src/ads.ts), re-typed by <Ads /> on
|
|
57
|
+
// the way into `resolveAds`. Read in the integration because that is where the
|
|
58
|
+
// site config is already parsed, and because a pixel is a `marketing` demand
|
|
59
|
+
// the banner must have a row for.
|
|
60
|
+
ads: { enabled: boolean; properties: Record<string, unknown> } | null;
|
|
55
61
|
}
|
|
56
62
|
const data: HeadData;
|
|
57
63
|
export default data;
|