πΈ Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Replace the docs intro iframe with illustrated navigation cards (#1188)
Goldflagc415c55c8ce1
diff --git a/docs/content/docs/(docs)/index.mdx b/docs/content/docs/(docs)/index.mdxindex 52faa937c..6b2c8579a 100644--- a/docs/content/docs/(docs)/index.mdx+++ b/docs/content/docs/(docs)/index.mdx@@ -4,58 +4,9 @@ description: Introduction to Rybbitfull: true----import { Cards, Card } from 'fumadocs-ui/components/card';-import Image from 'next/image';-import { Check, X, AlertTriangle } from 'lucide-react';-import {- SiAngular,- SiAstro,- SiBigcommerce,- SiCarrd,- SiContentful,- SiDocusaurus,- SiDrupal,- SiFramer,- SiGatsby,- SiGhost,- SiGitbook,- SiGoogletagmanager,- SiHugo,- SiJekyll,- SiJoomla,- SiLaravel,- SiMintlify,- SiNextdotjs,- SiNuxt,- SiPrestashop,- SiReact,- SiRemix,- SiSanity,- SiShopify,- SiSquarespace,- SiStrapi,- SiSvelte,- SiVitepress,- SiVuedotjs,- SiWebflow,- SiWix,- SiWoocommerce,- SiWordpress,-} from '@icons-pack/react-simple-icons';+**Rybbit** is a powerful open source web and product analytics platform. Check out our [live demo](https://demo.rybbit.com/81) using a real production site.-**Rybbit** is a powerful open source web and products analytics platform. Check out our [live demo](https://demo.rybbit.com/81) using a real production site.--{/* md+: render the demo at a 117.6% viewport and scale to 0.85 so it shows- its desktop layout at preview size. Keep 1:1 on mobile β a scaled viewport- would land between the demo's responsive breakpoints. The two values must- stay reciprocal. */}-<div className="relative rounded-lg overflow-hidden border-8 border-neutral-100/5 shadow-2xl shadow-emerald-900/10 h-[600px] md:h-[700px] lg:h-[750px]">- <iframe- src="https://demo.rybbit.com/81"- className="block w-full h-full border-none md:w-[117.6%] md:h-[117.6%] md:origin-top-left md:scale-[0.85]"- title="Rybbit Analytics Demo"- ></iframe>-</div>+<DocsHomeCards />## Getting Started@@ -66,230 +17,10 @@ Choose the option that's right for you:And then learn how to add the [tracking script](/docs/script) to your website to start collecting data.-## Integration Guides--<Cards>- <Card- icon={<SiAngular />}- title="Angular"- href="/docs/guides/angular"- className="flex items-center gap-2"- />- <Card- icon={<SiAstro />}- title="Astro"- href="/docs/guides/astro"- className="flex items-center gap-2"- />- <Card- icon={<SiBigcommerce />}- title="BigCommerce"- href="/docs/guides/bigcommerce"- className="flex items-center gap-2"- />- <Card- title="Bubble"- href="/docs/guides/bubble"- className="flex items-center gap-2"- />- <Card- icon={<SiCarrd />}- title="Carrd"- href="/docs/guides/carrd"- className="flex items-center gap-2"- />- <Card- icon={<SiContentful />}- title="Contentful"- href="/docs/guides/contentful"- className="flex items-center gap-2"- />- <Card- icon={<SiDocusaurus />}- title="Docusaurus"- href="/docs/guides/docusaurus"- className="flex items-center gap-2"- />- <Card- icon={<SiDrupal />}- title="Drupal"- href="/docs/guides/drupal"- className="flex items-center gap-2"- />- <Card- icon={<SiFramer />}- title="Framer"- href="/docs/guides/framer"- className="flex items-center gap-2"- />- <Card- icon={<SiGatsby />}- title="Gatsby"- href="/docs/guides/react/gatsby"- className="flex items-center gap-2"- />- <Card- icon={<SiGhost />}- title="Ghost"- href="/docs/guides/ghost"- className="flex items-center gap-2"- />- <Card- icon={<SiGitbook />}- title="GitBook"- href="/docs/guides/gitbook"- className="flex items-center gap-2"- />- <Card- icon={<SiGoogletagmanager />}- title="Google Tag Manager"- href="/docs/guides/google-tag-manager"- className="flex items-center gap-2"- />- <Card- icon={<SiHugo />}- title="Hugo"- href="/docs/guides/hugo"- className="flex items-center gap-2"- />- <Card- icon={<SiJekyll />}- title="Jekyll"- href="/docs/guides/jekyll"- className="flex items-center gap-2"- />- <Card- icon={<SiJoomla />}- title="Joomla"- href="/docs/guides/joomla"- className="flex items-center gap-2"- />- <Card- icon={<SiLaravel />}- title="Laravel"- href="/docs/guides/laravel"- className="flex items-center gap-2"- />- <Card- icon={<SiMintlify className="w-5 h-5" />}- title="Mintlify"- href="/docs/guides/mintlify"- className="flex items-center gap-2"- />- <Card- icon={<SiNextdotjs />}- title="Next.js"- href="/docs/guides/react/next-js"- className="flex items-center gap-2"- />- <Card- icon={<SiNuxt />}- title="Nuxt"- href="/docs/guides/vue/nuxt"- className="flex items-center gap-2"- />- <Card- icon={<SiPrestashop />}- title="PrestaShop"- href="/docs/guides/prestashop"- className="flex items-center gap-2"- />- <Card- icon={<SiReact />}- title="React"- href="/docs/guides/react/vite-cra"- className="flex items-center gap-2"- />- <Card- icon={<SiRemix />}- title="Remix"- href="/docs/guides/react/remix"- className="flex items-center gap-2"- />- <Card- icon={<SiSanity />}- title="Sanity"- href="/docs/guides/sanity"- className="flex items-center gap-2"- />- <Card- icon={<SiShopify />}- title="Shopify"- href="/docs/guides/shopify"- className="flex items-center gap-2"- />- <Card- icon={<SiSquarespace />}- title="Squarespace"- href="/docs/guides/squarespace"- className="flex items-center gap-2"- />- <Card- icon={<SiStrapi />}- title="Strapi"- href="/docs/guides/strapi"- className="flex items-center gap-2"- />- <Card- icon={<SiSvelte />}- title="Svelte"- href="/docs/guides/svelte/vite"- className="flex items-center gap-2"- />- <Card- icon={<SiSvelte />}- title="SvelteKit"- href="/docs/guides/svelte/sveltekit"- className="flex items-center gap-2"- />- <Card- icon={<Image src="/platforms/thrivecart.svg" alt="ThriveCart" width={16} height={16} className="grayscale" />}- title="ThriveCart"- href="/docs/guides/thrivecart"- className="flex items-center gap-2"- />- <Card- icon={<SiVitepress />}- title="VitePress"- href="/docs/guides/vitepress"- className="flex items-center gap-2"- />- <Card- icon={<SiVuedotjs />}- title="Vue"- href="/docs/guides/vue/vite"- className="flex items-center gap-2"- />- <Card- icon={<SiWebflow />}- title="Webflow"- href="/docs/guides/webflow"- className="flex items-center gap-2"- />- <Card- icon={<SiWix />}- title="Wix"- href="/docs/guides/wix"- className="flex items-center gap-2"- />- <Card- icon={<SiWoocommerce />}- title="WooCommerce"- href="/docs/guides/woocommerce"- className="flex items-center gap-2"- />- <Card- icon={<SiWordpress />}- title="WordPress"- href="/docs/guides/wordpress"- className="flex items-center gap-2"- />-</Cards>-## CodeRybbit is open sourced under the AGPL-3.0 license. You can find the code on [GitHub](https://github.com/rybbit-io/rybbit).## Community-Join our [Discord server](https://discord.gg/DEhGb4hYBj) or talk to me on [X](https://x.com/yang_frog). I'm always looking for feedback and ideas to make Rybbit as awesome as possible.\ No newline at end of file+Join our [Discord server](https://discord.gg/DEhGb4hYBj) or talk to me on [X](https://x.com/yang_frog). I'm always looking for feedback and ideas to make Rybbit as awesome as possible.diff --git a/docs/src/components/DocsHomeCards.tsx b/docs/src/components/DocsHomeCards.tsxnew file mode 100644index 000000000..f44c5064d--- /dev/null+++ b/docs/src/components/DocsHomeCards.tsx@@ -0,0 +1,240 @@+import {+ SiAstro,+ SiGoogletagmanager,+ SiNextdotjs,+ SiNuxt,+ SiShopify,+ SiSvelte,+ SiVuedotjs,+ SiWebflow,+ SiWordpress,+} from '@icons-pack/react-simple-icons';+import { ArrowRight } from 'lucide-react';+import { getLocale } from 'next-intl/server';+import Link from 'next/link';+import type { ReactNode } from 'react';+import { source } from '@/lib/source';++/* ββ Card stills βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+ Each card opens with a small static picture of the page it leads to: the+ real snippet, the real setup command, a chart, an event call, an MCP+ answer, the platform logos. The still is the description; keep them+ static so they never compete with the reading below. */++const artClass =+ 'relative h-[92px] overflow-hidden rounded-md border border-fd-border bg-fd-background';+const codeClass =+ 'whitespace-pre px-3 py-2.5 font-mono text-[10.5px] leading-[1.6] text-fd-muted-foreground';++function ScriptArt() {+ return (+ <div className={artClass} aria-hidden="true">+ <pre className={codeClass}>+ {'<'}+ <span className="text-emerald-700 dark:text-emerald-400">script</span>+ {'\n src='}+ <span className="text-[var(--dataviz)]">"https://app.rybbit.io/api/script.js</span>+ {'\n '}+ <span className="text-[var(--dataviz)]">?siteId=YOUR_SITE_ID"</span>+ {'\n async>'}+ {'</'}+ <span className="text-emerald-700 dark:text-emerald-400">script</span>+ {'>'}+ </pre>+ </div>+ );+}++function SelfHostArt() {+ const ok = <span className="text-emerald-700 dark:text-emerald-400">β</span>;+ return (+ <div className={artClass} aria-hidden="true">+ <pre className={codeClass}>+ <span className="text-fd-foreground">$</span> ./setup.sh analytics.example.com{'\n'}+ {ok} Caddy TLS ready{'\n'}+ {ok} ClickHouse Β· Postgres Β· Redis up{'\n'}+ {ok} https://analytics.example.com+ </pre>+ </div>+ );+}++function ChartArt() {+ const line =+ 'M0 78 L30 74 L60 76 L90 62 L120 58 L150 44 L180 48 L210 30 L240 26 L270 18 L300 12';+ return (+ <div className={artClass} aria-hidden="true">+ <svg viewBox="0 0 300 92" preserveAspectRatio="none" className="block size-full">+ <defs>+ <linearGradient id="docs-home-chart-fill" x1="0" y1="0" x2="0" y2="1">+ <stop offset="0" stopColor="var(--dataviz)" stopOpacity="0.3" />+ <stop offset="1" stopColor="var(--dataviz)" stopOpacity="0" />+ </linearGradient>+ </defs>+ <path d={`${line} L300 92 L0 92 Z`} fill="url(#docs-home-chart-fill)" />+ <path+ d={line}+ fill="none"+ stroke="var(--dataviz)"+ strokeWidth="1.75"+ strokeLinejoin="round"+ vectorEffect="non-scaling-stroke"+ />+ </svg>+ <div className="absolute left-3 top-2.5">+ <div className="text-[10px] font-medium text-fd-muted-foreground">Visitors</div>+ <div className="text-base font-semibold leading-tight tracking-tight text-fd-foreground">48.2K</div>+ </div>+ </div>+ );+}++function EventsArt() {+ const v = 'text-[var(--dataviz)]';+ return (+ <div className={artClass} aria-hidden="true">+ <pre className={codeClass}>+ <span className="text-fd-foreground">window.rybbit</span>.event(<span className={v}>"signup"</span>, {'{'}+ {'\n plan: '}+ <span className={v}>"pro"</span>,{'\n source: '}+ <span className={v}>"pricing"</span>+ {'\n});'}+ </pre>+ </div>+ );+}++function McpArt() {+ return (+ <div className={artClass} aria-hidden="true">+ <div className="flex flex-col gap-1.5 px-3 py-2.5 text-[10.5px] leading-[1.35]">+ <span className="max-w-[78%] self-end rounded-md bg-fd-secondary px-2 py-1 text-fd-foreground">+ why did signups drop on Tuesday?+ </span>+ <span className="max-w-[82%] self-start rounded-md border border-fd-border px-2 py-1 text-fd-muted-foreground">+ <span className="font-medium text-fd-foreground">/pricing</span> traffic from HN fell 62% after the post+ left the front page; conversion held at 4.1%.+ </span>+ </div>+ </div>+ );+}++const platformLogos = [+ { name: 'Next.js', Icon: SiNextdotjs },+ { name: 'WordPress', Icon: SiWordpress },+ { name: 'Shopify', Icon: SiShopify },+ { name: 'Astro', Icon: SiAstro },+ { name: 'Vue', Icon: SiVuedotjs },+ { name: 'Google Tag Manager', Icon: SiGoogletagmanager },+ { name: 'Nuxt', Icon: SiNuxt },+ { name: 'Webflow', Icon: SiWebflow },+ { name: 'Svelte', Icon: SiSvelte },+];++function GuidesArt({ more }: { more: number }) {+ return (+ <div className={artClass} aria-hidden="true">+ <div className="grid h-full grid-cols-5 content-center gap-1.5 p-3">+ {platformLogos.map(({ name, Icon }) => (+ <span+ key={name}+ title={name}+ className="grid h-[26px] place-items-center rounded-[5px] border border-fd-border bg-fd-card text-fd-muted-foreground"+ >+ <Icon className="size-3.5" />+ </span>+ ))}+ <span className="grid h-[26px] place-items-center rounded-[5px] border border-fd-border bg-fd-card text-[9px] font-semibold text-fd-muted-foreground">+ +{more}+ </span>+ </div>+ </div>+ );+}++/* ββ Cards βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */++type HomeCard = {+ slugs: string[];+ title: string;+ description: string;+ art: ReactNode;+};++/**+ * The six cards at the top of /docs. Every href is resolved through the+ * content source for the current locale, so a renamed page fails the build+ * here instead of shipping a dead card.+ */+export async function DocsHomeCards() {+ const locale = await getLocale();+ const guideCount = source+ .getPages(locale)+ .filter(p => p.slugs[0] === 'guides' && p.slugs.length > 1).length;++ const cards: HomeCard[] = [+ {+ slugs: ['script'],+ title: 'Add the tracking script',+ description: 'One tag before </head>. Options, verification, troubleshooting.',+ art: <ScriptArt />,+ },+ {+ slugs: ['self-hosting'],+ title: 'Self-host with Docker',+ description: 'One command on a 2 GB VPS. Nginx, Pangolin and manual guides too.',+ art: <SelfHostArt />,+ },+ {+ slugs: ['feature-guides', 'main-tab'],+ title: 'Read the dashboard',+ description: 'Feature guides for every tab: main, pages, sessions, replay, errors, globe.',+ art: <ChartArt />,+ },+ {+ slugs: ['track-events'],+ title: 'Track events & users',+ description: 'Custom events, autocapture, identify, goals and funnels.',+ art: <EventsArt />,+ },+ {+ slugs: ['mcp'],+ title: 'MCP for AI agents',+ description: 'Query your analytics from Claude Code, Cursor, Codex, VS Code and more.',+ art: <McpArt />,+ },+ {+ slugs: ['guides'],+ title: 'Integration guides',+ description: `Step-by-step for ${guideCount} platforms, from WordPress to SvelteKit.`,+ art: <GuidesArt more={Math.max(0, guideCount - platformLogos.length)} />,+ },+ ];++ return (+ <div className="not-prose grid grid-cols-1 gap-3.5 sm:grid-cols-2 lg:grid-cols-3">+ {cards.map(card => {+ const page = source.getPage(card.slugs, locale);+ if (!page) throw new Error(`DocsHomeCards: no page for /${card.slugs.join('/')}`);+ return (+ <Link+ key={page.url}+ href={page.url}+ className="group flex min-w-0 flex-col gap-2.5 rounded-lg border border-fd-border bg-fd-card p-4 no-underline transition-colors hover:border-fd-muted-foreground/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-primary focus-visible:ring-offset-2 focus-visible:ring-offset-fd-background"+ >+ {card.art}+ <div className="flex items-center gap-1.5 pt-1 text-[15px] font-semibold tracking-tight text-fd-foreground">+ {card.title}+ <ArrowRight+ className="ml-auto size-4 shrink-0 text-fd-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-fd-foreground motion-reduce:transition-none"+ aria-hidden="true"+ />+ </div>+ <p className="text-[13.5px] leading-normal text-fd-muted-foreground">{card.description}</p>+ </Link>+ );+ })}+ </div>+ );+}diff --git a/docs/src/mdx-components.tsx b/docs/src/mdx-components.tsxindex 01766f84c..eb8d7f066 100644--- a/docs/src/mdx-components.tsx+++ b/docs/src/mdx-components.tsx@@ -1,5 +1,6 @@import defaultMdxComponents from "fumadocs-ui/mdx";import type { MDXComponents } from "mdx/types";+import { DocsHomeCards } from "@/components/DocsHomeCards";import { GuideIndex } from "@/components/GuideIndex";import { Mermaid } from "@/components/Mermaid";import * as TabsComponents from "fumadocs-ui/components/tabs";@@ -10,6 +11,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {return {...defaultMdxComponents,...TabsComponents,+ DocsHomeCards,GuideIndex,Mermaid,img: props => <ImageZoom {...(props as any)} />,