feat(site): meter TrustedSite trustmark to order+healthcare pages only (free tier 500 impr/mo); auto-detect by path; CSP allows cdn.ywxi.net

This commit is contained in:
justin 2026-06-06 00:32:46 -05:00
parent 780b4219d3
commit 113c73b392

View file

@ -10,9 +10,21 @@ import TrustStrip from "../components/TrustStrip.astro";
export interface Props { export interface Props {
title: string; title: string;
description?: string; description?: string;
/** Opt in to the TrustedSite trustmark (order/checkout + top landing pages
only, to stay under the free 500 impressions/mo). */
trustedsite?: boolean;
} }
const { title, description = "" } = Astro.props; const { title, description = "", trustedsite } = Astro.props;
// TrustedSite trustmark is metered (free tier = 500 impressions/mo), so load it
// ONLY where it lifts conversions: order/checkout flows + healthcare landing
// pages (our paid/cold-traffic destinations). Auto-detected from the path so no
// per-page wiring is needed; an explicit `trustedsite` prop can still override.
const path = Astro.url?.pathname || "";
const showTrustedSite =
trustedsite ??
(path.startsWith("/order") || path.startsWith("/services/healthcare"));
// Read the nav + footer partials (extracted from prod homepage) // Read the nav + footer partials (extracted from prod homepage)
let navHtml = ""; let navHtml = "";
@ -34,6 +46,12 @@ try {
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<script defer src="https://analytics.performancewest.net/script.js" data-website-id="55250014-ee15-44ac-a1f6-81dabad3fe0f"></script> <script defer src="https://analytics.performancewest.net/script.js" data-website-id="55250014-ee15-44ac-a1f6-81dabad3fe0f"></script>
<script defer src="/js/pw-analytics.js"></script> <script defer src="/js/pw-analytics.js"></script>
{/* TrustedSite trustmark loads ONLY on pages that opt in (order/checkout +
top campaign landing pages) to stay under the free 500 impressions/mo.
Gated via the `trustedsite` flag, set by those pages. */}
{showTrustedSite && (
<script type="text/javascript" src="https://cdn.ywxi.net/js/1.js" async></script>
)}
<link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" /> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
@ -63,6 +81,6 @@ try {
<main class="flex-1"> <main class="flex-1">
<slot /> <slot />
</main> </main>
<TrustStrip /> <TrustStrip trustedsite={showTrustedSite} />
<Fragment set:html={footerHtml} /> <Fragment set:html={footerHtml} />
</html> </html>