Repository navigation
feat: growth nav, blog CTAs, analytics fixes #3153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6b1f713
feat(ui): surface top nav links, fix dropdown css
smakosh afab280
feat(ui): add DevPass CTA cards to blog posts
smakosh fe70403
fix(analytics): posthog proxy, init and report
smakosh a4ee447
feat(devpass): track cap hits and pass redeems
smakosh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| "use client"; | ||
|
|
||
| import Link from "next/link"; | ||
| import { usePathname } from "next/navigation"; | ||
| import { usePostHog } from "posthog-js/react"; | ||
|
|
||
| import { Button } from "@/lib/components/button"; | ||
|
|
||
| // Conversion card embeddable in markdown content via the `BlogCta` override in | ||
| // getMarkdownOptions. The DevPass variant leans into the passport/boarding-pass | ||
| // brand language used across DevPass surfaces. | ||
| export function BlogCta({ | ||
| variant = "devpass", | ||
| location = "inline", | ||
| }: { | ||
| variant?: "devpass" | "gateway"; | ||
| location?: string; | ||
| }) { | ||
| const posthog = usePostHog(); | ||
| const pathname = usePathname(); | ||
| const post = pathname?.split("/").pop() ?? "unknown"; | ||
|
|
||
| const track = (cta: string) => { | ||
| posthog.capture("cta_clicked", { | ||
| location: `blog_${location}`, | ||
| cta, | ||
| post, | ||
| }); | ||
| }; | ||
|
|
||
| if (variant === "gateway") { | ||
| return ( | ||
| <div className="not-prose my-10 rounded-xl border bg-muted/30 p-6 sm:p-8"> | ||
| <div className="font-mono text-[10px] uppercase tracking-[0.35em] text-muted-foreground"> | ||
| LLM Gateway | ||
| </div> | ||
| <h3 className="mt-3 text-2xl font-bold tracking-tight text-foreground"> | ||
| One API key for every model. | ||
| </h3> | ||
| <p className="mt-2 max-w-xl text-sm leading-6 text-muted-foreground"> | ||
| Route to 200+ models with automatic failover, caching, and real-time | ||
| cost analytics. Free to start — no credit card required. | ||
| </p> | ||
| <div className="mt-5 flex flex-wrap items-center gap-3"> | ||
| <Button | ||
| asChild | ||
| className="bg-zinc-900 font-medium text-white hover:bg-zinc-700 dark:bg-white dark:text-black dark:hover:bg-zinc-200" | ||
| > | ||
| <Link | ||
| href="/signup" | ||
| prefetch={true} | ||
| onClick={() => track("create_free_account")} | ||
| > | ||
| Create free account | ||
| </Link> | ||
| </Button> | ||
| <Link | ||
| href="/models" | ||
| prefetch={true} | ||
| onClick={() => track("browse_models")} | ||
| className="text-sm text-muted-foreground underline underline-offset-4 transition-colors hover:text-foreground" | ||
| > | ||
| Browse all models | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="not-prose relative my-10 overflow-hidden rounded-xl border border-dashed border-stone-400/70 bg-stone-50/70 dark:border-stone-600/70 dark:bg-stone-900/30"> | ||
| <div className="p-6 sm:p-8"> | ||
| <div className="flex flex-wrap items-baseline justify-between gap-2"> | ||
| <div className="font-mono text-[10px] uppercase tracking-[0.35em] text-stone-500 dark:text-stone-400"> | ||
| DevPass · Boarding pass | ||
| </div> | ||
| <div className="font-mono text-[9px] tracking-[0.25em] text-stone-400 dark:text-stone-500"> | ||
| No. DP-{post.slice(0, 6).toUpperCase()} | ||
| </div> | ||
| </div> | ||
| <h3 className="mt-3 text-2xl font-bold tracking-tight text-foreground"> | ||
| Every frontier model. One flat rate. | ||
| </h3> | ||
| <p className="mt-2 max-w-xl text-sm leading-6 text-muted-foreground"> | ||
| Run Claude, GPT-5.5, Gemini, and 200+ more through Claude Code, | ||
| Cursor, or whatever tool you already use. From $29/mo — no token math, | ||
| no surprise invoices. | ||
| </p> | ||
| <div className="mt-5 flex flex-wrap items-center gap-3"> | ||
| <Button | ||
| asChild | ||
| className="bg-zinc-900 font-medium text-white hover:bg-zinc-700 dark:bg-white dark:text-black dark:hover:bg-zinc-200" | ||
| > | ||
| <a | ||
| href={`https://devpass.llmgateway.io/signup?utm_source=blog&utm_medium=cta&utm_campaign=${post}`} | ||
| onClick={() => track("get_devpass")} | ||
| > | ||
| Get DevPass — from $29/mo | ||
| </a> | ||
| </Button> | ||
| <a | ||
| href={`https://devpass.llmgateway.io/pricing?utm_source=blog&utm_medium=cta&utm_campaign=${post}`} | ||
| onClick={() => track("compare_devpass_plans")} | ||
| className="text-sm text-muted-foreground underline underline-offset-4 transition-colors hover:text-foreground" | ||
| > | ||
| Compare plans | ||
| </a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: theopenco/llmgateway
Length of output: 45642
🌐 Web query:
PostHog React usePostHog capture before provider initialization undefined TypeError docs💡 Result:
The TypeError: Cannot read properties of undefined (reading '...') when using the PostHog React usePostHog hook typically occurs because you are attempting to access or call methods on the posthog instance before it has fully initialized [1][2]. This often happens during the initial component render [1][2]. To resolve this issue, use the following approaches recommended by PostHog documentation: 1. Use Optional Chaining: Use the optional chaining operator (?.) when calling methods on the posthog instance returned by the usePostHog hook [1][2]. This prevents the code from throwing an error if the instance is currently undefined. posthog?.capture('event_name') 2. Check for Initialization: Wrap your calls in a conditional check to ensure the instance exists before executing any methods [1][2]. useEffect( => { if (posthog) { posthog.capture('event_name'); } }, [posthog]); 3. Ensure Correct Provider Placement: Verify that your application is wrapped by the PostHogProvider at the root of your application (e.g., in main.tsx or App.tsx) and that it is provided with a valid apiKey or a pre-initialized client [3][4][5]. Avoid importing the posthog-js singleton directly in your components for React-specific logic, as this bypasses the React context and can lead to uninitialized state errors [1][2]. If you are manually passing a client instance to the PostHogProvider, ensure you are handling the lifecycle of that client correctly, as the provider assumes you are controlling its initialization [6]. Always prefer the usePostHog hook for accessing the instance within components [1][3].
Citations:
Guard
capturebehind the PostHog instance.usePostHog()can be undefined while the provider is still initializing, so this click handler should useposthog?.capture(...)or anif (posthog)check.🤖 Prompt for AI Agents