Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/(landing)/_components/landing-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const landingNavItems: LandingNavItem[] = [
{ href: "https://notebook.knowhereto.ai", labelKey: "playground", external: true },
{ href: "#pricing", labelKey: "pricing" },
{ href: "https://docs.knowhereto.ai/", labelKey: "docs", external: true },
{ href: "https://github.com/Ontos-AI/knowhere", labelKey: "github", external: true },
{ href: "/github", labelKey: "github" },
];

const localeLabels = {
Expand Down
26 changes: 26 additions & 0 deletions app/api/acquisition-attribution/page-view/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { captureMarketingPageView } from "@server/acquisition-attribution";
import { NextResponse } from "next/server";
import { z } from "zod";

const pageViewRequestSchema = z.object({
acquisitionSessionId: z.string().optional(),
landingUrl: z.url(),
referrer: z.string().optional(),
});

export async function POST(request: Request): Promise<Response> {
const requestBody = await request.json().catch(() => null);
const parsedRequest = pageViewRequestSchema.safeParse(requestBody);

if (!parsedRequest.success) {
return NextResponse.json({ message: "Invalid acquisition payload" }, { status: 400 });
}

const result = await captureMarketingPageView({
acquisitionSessionId: parsedRequest.data.acquisitionSessionId,
landingUrl: parsedRequest.data.landingUrl,
referrer: parsedRequest.data.referrer,
});

return NextResponse.json(result);
}
35 changes: 35 additions & 0 deletions app/github/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use client";

import Link from "next/link";
import { useEffect } from "react";

const GITHUB_REPO_URL = "https://github.com/Ontos-AI/knowhere";
const REDIRECT_DELAY_MS = 400;

export default function GithubRedirectPage() {
useEffect(() => {
const timeoutId = window.setTimeout(() => {
window.location.replace(GITHUB_REPO_URL);
}, REDIRECT_DELAY_MS);

return () => {
window.clearTimeout(timeoutId);
};
}, []);

return (
<main className="flex min-h-screen flex-col items-center justify-center gap-4 px-6 text-center">
<h1 className="text-2xl font-semibold tracking-tight">Redirecting to GitHub…</h1>
<p className="max-w-md text-sm text-muted-foreground">
Taking you to the Knowhere repository. If nothing happens, use the link below.
</p>
<Link
href={GITHUB_REPO_URL}
className="text-sm font-medium underline underline-offset-4"
rel="noopener noreferrer"
>
Continue to github.com/Ontos-AI/knowhere
</Link>
</main>
);
}
19 changes: 19 additions & 0 deletions drizzle/0009_mushy_ezekiel.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE "marketing_page_views" (
"view_id" text PRIMARY KEY NOT NULL,
"acquisition_session_id" text,
"source" text NOT NULL,
"channel" text NOT NULL,
"utm_source" text,
"utm_medium" text,
"utm_campaign" text,
"utm_content" text,
"utm_term" text,
"oppref" text,
"visited_path" text NOT NULL,
"referrer_host" text,
"viewed_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX "marketingPageView_viewedAt_idx" ON "marketing_page_views" USING btree ("viewed_at");--> statement-breakpoint
CREATE INDEX "marketingPageView_visitedPath_viewedAt_idx" ON "marketing_page_views" USING btree ("visited_path","viewed_at");--> statement-breakpoint
CREATE INDEX "marketingPageView_acquisitionSessionId_idx" ON "marketing_page_views" USING btree ("acquisition_session_id");
Loading
Loading