diff --git a/apps/web/app/(landing)/home/HeroHeadingAB.tsx b/apps/web/app/(landing)/home/HeroHeadingAB.tsx
new file mode 100644
index 0000000000..ed06505b73
--- /dev/null
+++ b/apps/web/app/(landing)/home/HeroHeadingAB.tsx
@@ -0,0 +1,17 @@
+"use client";
+
+import { Skeleton } from "@/components/ui/skeleton";
+import { useFeatureFlagVariantKey } from "posthog-js/react";
+
+export function HeroHeadingAB() {
+ const variant = useFeatureFlagVariantKey("experiment-hero-heading");
+
+ if (variant === "control")
+ return <>Automate your emails with the power of AI>;
+ // if (variant === "test") return <>Automate your email support with AI>;
+ if (variant === "test")
+ return <>Open source tools to reach inbox zero fast>;
+
+ // return
;
+ return
;
+}
diff --git a/apps/web/app/(landing)/layout.tsx b/apps/web/app/(landing)/layout.tsx
new file mode 100644
index 0000000000..cfd409448a
--- /dev/null
+++ b/apps/web/app/(landing)/layout.tsx
@@ -0,0 +1,17 @@
+import React, { Suspense } from "react";
+import { PostHogPageview, PostHogProvider } from "@/providers/PostHogProvider";
+
+export default async function RootLayout({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <>
+
+
+
+
{children}
+ >
+ );
+}
diff --git a/apps/web/env.mjs b/apps/web/env.mjs
index 82034793da..82d6aae04d 100644
--- a/apps/web/env.mjs
+++ b/apps/web/env.mjs
@@ -20,11 +20,13 @@ export const env = createEnv({
client: {
NEXT_PUBLIC_PRO_PAYMENT_LINK: z.string().min(1),
NEXT_PUBLIC_ENTERPRISE_PAYMENT_LINK: z.string().min(1),
+ NEXT_PUBLIC_POSTHOG_KEY: z.string().optional(),
},
// For Next.js >= 13.4.4, you only need to destructure client variables:
experimental__runtimeEnv: {
NEXT_PUBLIC_PRO_PAYMENT_LINK: process.env.NEXT_PUBLIC_PRO_PAYMENT_LINK,
NEXT_PUBLIC_ENTERPRISE_PAYMENT_LINK:
process.env.NEXT_PUBLIC_ENTERPRISE_PAYMENT_LINK,
+ NEXT_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY,
},
});
diff --git a/apps/web/legal/privacy.md b/apps/web/legal/privacy.md
index 5cc8b429e0..0e1c58092c 100644
--- a/apps/web/legal/privacy.md
+++ b/apps/web/legal/privacy.md
@@ -1,6 +1,6 @@
---
title: Privacy Policy
-updatedAt: 2023-08-15
+updatedAt: 2023-09-14
---
## Introduction
@@ -32,6 +32,8 @@ We may share the information collected with the following parties:
**OpenAI:** We send email data to OpenAI for AI processing of each email. As per the [OpenAI data usage policies](https://openai.com/policies/api-data-usage-policies), OpenAI will not use data submitted by customers via their API to train or improve their models.
Any data sent through the API will be retained for abuse and misuse monitoring purposes for a maximum of 30 days, after which it will be deleted (unless otherwise required by law).
+**PostHog:** The landing page and pages you see when not logged in use PostHog for analytic purposes. PostHog is not used for log in gated pages and no email data is sent to PostHog.
+
## Data Security
We implement appropriate security measures to protect your information. However, no method of transmission or storage is 100% secure, and we cannot guarantee absolute security.
diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs
index 5d14aca97a..d99b40b173 100644
--- a/apps/web/next.config.mjs
+++ b/apps/web/next.config.mjs
@@ -42,6 +42,14 @@ const nextConfig = {
},
];
},
+ async rewrites() {
+ return [
+ {
+ source: "/ingest/:path*",
+ destination: "https://app.posthog.com/:path*",
+ },
+ ];
+ },
};
export default withContentlayer(nextConfig);
diff --git a/apps/web/package.json b/apps/web/package.json
index 44d96bea1a..cb8cfd67cd 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -55,6 +55,7 @@
"node-email-reply-parser": "^0.1.4",
"nodemailer": "^6.9.4",
"openai-edge": "^1.2.2",
+ "posthog-js": "^1.78.4",
"prettier": "2.8.8",
"prettier-plugin-tailwindcss": "^0.4.1",
"react": "18.2.0",
diff --git a/apps/web/providers/PostHogProvider.tsx b/apps/web/providers/PostHogProvider.tsx
new file mode 100644
index 0000000000..8e10305a8f
--- /dev/null
+++ b/apps/web/providers/PostHogProvider.tsx
@@ -0,0 +1,39 @@
+"use client";
+import posthog from "posthog-js";
+import { PostHogProvider as PHProvider } from "posthog-js/react";
+import { usePathname, useSearchParams } from "next/navigation";
+import { useEffect } from "react";
+import { env } from "@/env.mjs";
+
+// based on: https://posthog.com/docs/libraries/next-js
+
+if (typeof window !== "undefined" && env.NEXT_PUBLIC_POSTHOG_KEY) {
+ posthog.init(env.NEXT_PUBLIC_POSTHOG_KEY, {
+ // https://posthog.com/docs/advanced/proxy/nextjs
+ api_host: `${window.location.origin}/ingest`,
+ capture_pageview: false, // Disable automatic pageview capture, as we capture manually
+ });
+}
+
+export function PostHogPageview(): JSX.Element {
+ const pathname = usePathname();
+ const searchParams = useSearchParams();
+
+ useEffect(() => {
+ if (pathname) {
+ let url = window.origin + pathname;
+ if (searchParams && searchParams.toString()) {
+ url = url + `?${searchParams.toString()}`;
+ }
+ posthog.capture("$pageview", {
+ $current_url: url,
+ });
+ }
+ }, [pathname, searchParams]);
+
+ return <>>;
+}
+
+export function PostHogProvider({ children }: { children: React.ReactNode }) {
+ return
{children};
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 94a313376b..dce7b8144e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -203,6 +203,9 @@ importers:
openai-edge:
specifier: ^1.2.2
version: 1.2.2
+ posthog-js:
+ specifier: ^1.78.4
+ version: 1.78.4
prettier:
specifier: 2.8.8
version: 2.8.8
@@ -7513,6 +7516,13 @@ packages:
web-streams-polyfill: 3.2.1
dev: false
+ /fflate@0.4.8:
+ resolution:
+ {
+ integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==,
+ }
+ dev: false
+
/figures@3.2.0:
resolution:
{
@@ -11977,6 +11987,15 @@ packages:
picocolors: 1.0.0
source-map-js: 1.0.2
+ /posthog-js@1.78.4:
+ resolution:
+ {
+ integrity: sha512-+ao0/qoP8fUErrF6Y2Yugilkh4ooh8MX6n6ckYsn3yV610YrpXGR165fbq8X1ukimV4YmkWbMHOACtkOuZ/+8w==,
+ }
+ dependencies:
+ fflate: 0.4.8
+ dev: false
+
/preact-render-to-string@5.2.3(preact@10.11.3):
resolution:
{
diff --git a/turbo.json b/turbo.json
index 6cf8e4c806..0ea14b80bc 100644
--- a/turbo.json
+++ b/turbo.json
@@ -17,7 +17,8 @@
"LEMON_SQUEEZY_API_SECRET",
"LEMON_SQUEEZY_SIGNING_SECRET",
"NEXT_PUBLIC_PRO_PAYMENT_LINK",
- "NEXT_PUBLIC_ENTERPRISE_PAYMENT_LINK"
+ "NEXT_PUBLIC_ENTERPRISE_PAYMENT_LINK",
+ "NEXT_PUBLIC_POSTHOG_KEY"
],
"outputs": [".next/**", "!.next/cache/**"]
},