Skip to content

Commit 6eb4ca0

Browse files
authored
Merge branch 'main' into chore/agents-positioning-copy
2 parents 03627cb + e3a6a34 commit 6eb4ca0

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

website/src/components/Analytics.astro

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@
1212
// be production, indexable builds too, so the gates above alone would let their
1313
// traffic reach the real PostHog project. Analytics initializes ONLY on the real
1414
// site (agenta.ai / www.agenta.ai); every *.workers.dev preview host is skipped.
15-
const posthogKey = import.meta.env.PUBLIC_POSTHOG_KEY;
16-
const noindex = import.meta.env.PUBLIC_NOINDEX === "true";
15+
//
16+
// This script must stay BUNDLED (no define:vars / is:inline): an inline script's
17+
// import("posthog-js") is a bare specifier the browser cannot resolve, so
18+
// analytics silently never loads. Vite statically replaces the PUBLIC_* env
19+
// reads in bundled client code, which is why no value handoff is needed.
1720
---
1821

19-
<script define:vars={{ posthogKey, noindex }}>
22+
<script>
23+
import posthog from "posthog-js";
24+
25+
const posthogKey = import.meta.env.PUBLIC_POSTHOG_KEY;
26+
const noindex = import.meta.env.PUBLIC_NOINDEX === "true";
27+
2028
const dnt =
2129
navigator.doNotTrack === "1" ||
2230
// @ts-expect-error legacy vendor-prefixed flags
@@ -31,16 +39,14 @@ const noindex = import.meta.env.PUBLIC_NOINDEX === "true";
3139
if (posthogKey && !noindex && isRealSite && !dnt && !window.__agPosthogInit) {
3240
// @ts-expect-error one-time guard on window
3341
window.__agPosthogInit = true;
34-
import("posthog-js").then(({ default: posthog }) => {
35-
posthog.init(posthogKey, {
36-
api_host: "https://alef.agenta.ai",
37-
ui_host: "https://us.posthog.com",
38-
person_profiles: "identified_only",
39-
capture_pageview: true,
40-
capture_pageleave: true,
41-
autocapture: true,
42-
respect_dnt: true,
43-
});
42+
posthog.init(posthogKey, {
43+
api_host: "https://alef.agenta.ai",
44+
ui_host: "https://us.posthog.com",
45+
person_profiles: "identified_only",
46+
capture_pageview: true,
47+
capture_pageleave: true,
48+
autocapture: true,
49+
respect_dnt: true,
4450
});
4551
}
4652
</script>

website/src/pages/robots.txt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const GET: APIRoute = () => {
1111

1212
const body = noindex
1313
? "User-agent: *\nDisallow: /"
14-
: "# Agenta marketing site (https://agenta.ai)\n# Allow all crawlers full access; point them at the generated sitemap index.\nUser-agent: *\nAllow: /\n\nSitemap: https://agenta.ai/sitemap-index.xml\n";
14+
: "# Agenta marketing site (https://agenta.ai)\n# Allow all crawlers full access; point them at the generated sitemap index.\n# The docs sitemap is listed too because agenta.ai/docs/* proxies the docs site.\nUser-agent: *\nAllow: /\n\nSitemap: https://agenta.ai/sitemap-index.xml\nSitemap: https://agenta.ai/docs/sitemap.xml\n";
1515

1616
return new Response(body, {
1717
headers: { "Content-Type": "text/plain; charset=utf-8" },

0 commit comments

Comments
 (0)