# Website analytics: website-tracking-sdk in an Astro document shell. # The SDK owns the GA4 tag; the site owns its route exclusions and privacy policy. --- // src/layouts/BaseLayout.astro import GoogleAnalytics from "website-tracking-sdk/astro"; const path = Astro.url.pathname; const analyticsEnabled = !path.startsWith("/auth/") && !path.startsWith("/account/"); --- # Replace the sample exclusions with the site's documented route policy. # Render the component once. It renders no tag in development builds. # Remove any old tag or manual page-view handler that would duplicate tracking. # Error format: not applicable. This SDK emits no HTTP response or structured error payload. # Invalid production or enabled values throw TypeError("production and enabled must be booleans"). # Example: shouldRenderGoogleAnalytics({ production: "yes", enabled: true }) throws that TypeError. # Analytics network failures are not returned through this SDK. # Full contract: https://github.com/a44238587-sudo/website-tracking-sdk/blob/main/README.md