🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
add free tools (#723)
Bill Yangb52dbafc343f
diff --git a/.gitignore b/.gitignoreindex a1c03fb80..7245dc5f0 100644--- a/.gitignore+++ b/.gitignore@@ -45,5 +45,4 @@ coverage/.cursor/-.claude/-CLAUDE.md\ No newline at end of file+.claude/\ No newline at end of filediff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 000000000..5186f3a79--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,24 @@+# CLAUDE.md++This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.++## Commands++- Client: `cd client && npm run dev` (NextJS with Turbopack on port 3002)+- Server: `cd server && npm run dev` (TypeScript backend)+- Lint: `cd client && npm run lint` or `cd server && npm run build`+- TypeCheck: `cd client && tsc --noEmit` or `cd server && tsc`+- Database: `cd server && npm run db:push` (update DB schema)++## Code Conventions++- TypeScript with strict typing throughout both client and server+- Client: React functional components with minimal useEffect and inline functions+- Frontend: Next.js, Tailwind CSS, Shadcn UI, Tanstack Query, Zustand, Luxon, Nivo, react-hook-form+- Backend: Fastify, Drizzle ORM (Postgres), ClickHouse, Zod+- Error handling: Use try/catch blocks with specific error types+- Naming: camelCase for variables/functions, PascalCase for components/types+- Imports: Group by external, then internal (alphabetical within groups)+- File organization: Related functionality in same directory+- Dark mode is default theme+- Never run any database migration scriptsdiff --git a/docs/CLAUDE.md b/docs/CLAUDE.mdnew file mode 100644index 000000000..6bd188ffe--- /dev/null+++ b/docs/CLAUDE.md@@ -0,0 +1,81 @@+# CLAUDE.md++This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.++## Commands++- Dev: `npm run dev` (Next.js with Turbopack on port 3003)+- Build: `npm run build`+- Production: `npm start`+- Type Check: `tsc --noEmit`+- Content Processing: `fumadocs-mdx` (runs automatically on postinstall)++## Project Overview++This is the documentation and marketing website for Rybbit, built with Next.js 16 and Fumadocs. The site includes:++- Documentation pages (using Fumadocs MDX)+- Blog (separate content collection)+- Marketing pages (home, pricing, features, comparison pages)+- Analytics tools (SEO, ROI calculators, privacy policy builder, etc.)+- LLM-friendly documentation endpoints+- The domain is rybbit.com++## Code Architecture++### Content Management++- **Fumadocs MDX**: Documentation system using `fumadocs-mdx` for MDX processing+- **Source Configuration**: `source.config.ts` defines two content collections:+ - `docs`: Documentation pages in `content/docs/`+ - `blog`: Blog posts in `content/blog/` with extended frontmatter (date, author, image, tags)+- **Source Adapters**:+ - `src/lib/source.ts`: Docs source loader (base URL: `/docs`)+ - `src/lib/blog-source.ts`: Blog source loader (base URL: `/blog`)+- **Auto-generated**: `.source/` directory contains generated TypeScript from MDX files++### Route Structure++- `app/(home)/*`: Marketing pages (landing, pricing, features, comparison pages, tools)+- `app/docs/[[...slug]]/`: Documentation pages using catch-all routing+- `app/blog/`: Blog listing and individual posts+- `app/api/search/`: Documentation search powered by Orama+- `app/api/tools/`: API endpoints for tool functionality (SEO generators, analytics detector, etc.)+- `app/llms.mdx/` and `app/llms-full.txt/`: LLM-optimized documentation endpoints++### Key Components++- **Layout**: `app/layout.config.tsx` defines shared navigation and links for Fumadocs+- **Tools**: Various analytics and SEO tools in `app/(home)/tools/` with form components and API routes+- **Cards**: Feature demonstration components in `src/components/Cards/`+- **UI Components**: Radix UI-based components in `src/components/ui/`++### External Integrations++- **OpenRouter**: LLM API integration via `src/lib/openrouter.ts` for tool functionality+ - Uses `OPENROUTER_API_KEY` and `OPENROUTER_MODEL` environment variables+ - Model: `z-ai/glm-4.6` (configurable)+- **Search**: Fumadocs search with Orama, English language support+- **Analytics**: Event tracking via `src/lib/trackAdEvent.ts`++### Path Aliases++- `@/*`: Maps to `src/*`+- `@/.source`: Maps to `.source/index.ts` (generated MDX content)++## Code Conventions++- TypeScript with strict mode enabled+- React 19 functional components+- Next.js App Router with route groups+- Fumadocs for documentation infrastructure+- Tailwind CSS v4 with dark mode support+- Path-based imports using `@/` alias+- MDX components defined in `src/mdx-components.tsx`++## Important Notes++- Content files in `content/docs/` and `content/blog/` are processed by Fumadocs MDX+- The `.source/` directory is auto-generated and should not be edited manually+- Next.js rewrites map `/docs/:path*.mdx` to `/llms.mdx/:path*` for LLM consumption+- Remote images allowed from: pbs.twimg.com, abs.twimg.com, ui-avatars.com, cdn.outrank.so, www.google.comdiff --git a/docs/src/app/(home)/oss-friends/page.tsx b/docs/src/app/(home)/oss-friends/page.tsxindex a0ab8108b..a45062cf6 100644--- a/docs/src/app/(home)/oss-friends/page.tsx+++ b/docs/src/app/(home)/oss-friends/page.tsx@@ -39,7 +39,7 @@ export default async function OSSFriendsPage() {const friends = await getOSSFriends();return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">+ <div className="min-h-screen"><div className="max-w-[1300px] mx-auto px-6 py-20">{/* Header */}<div className="text-center mb-16">diff --git a/docs/src/app/(home)/tools/CLAUDE.md b/docs/src/app/(home)/tools/CLAUDE.mdnew file mode 100644index 000000000..ffa694cb0--- /dev/null+++ b/docs/src/app/(home)/tools/CLAUDE.md@@ -0,0 +1,458 @@+# Adding a New Tool to Rybbit Docs++This guide explains how to add a new tool page to the Rybbit documentation site.++## Overview++All tools use the `ToolPageLayout` component which enforces a consistent 6-section structure:++1. Header (badge, title, description)+2. The actual tool (interactive component)+3. Educational content+4. FAQ section+5. Related tools+6. CTA (call-to-action)++## Quick Start++### Step 1: Create Tool Directory++Create a new directory for your tool in `/docs/src/app/(home)/tools/`:++```bash+mkdir /docs/src/app/(home)/tools/your-tool-name+```++### Step 2: Create the Tool Form Component++Create `YourToolForm.tsx` in your tool directory:++```tsx+"use client";++import { useState } from "react";++export function YourToolForm() {+ const [input, setInput] = useState("");+ const [result, setResult] = useState<string | null>(null);++ const handleCalculate = () => {+ // Your tool logic here+ const calculatedResult = `Result for ${input}`;+ setResult(calculatedResult);+ };++ return (+ <div className="bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-6">+ <div className="space-y-4">+ <div>+ <label className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2">Input Label</label>+ <input+ type="text"+ value={input}+ onChange={e => setInput(e.target.value)}+ className="w-full px-4 py-2 border border-neutral-300 dark:border-neutral-700 rounded-lg focus:ring-2 focus:ring-emerald-500 dark:bg-neutral-800"+ placeholder="Enter value..."+ />+ </div>++ <button+ onClick={handleCalculate}+ className="w-full bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-6 py-3 rounded-lg transition-colors"+ >+ Calculate+ </button>++ {result && (+ <div className="mt-4 p-4 bg-emerald-50 dark:bg-emerald-900/20 border border-emerald-200 dark:border-emerald-800 rounded-lg">+ <p className="text-neutral-900 dark:text-white font-semibold">{result}</p>+ </div>+ )}+ </div>+ </div>+ );+}+```++### Step 3: Create the Page Component++Create `page.tsx` in your tool directory:++```tsx+import { ToolPageLayout } from "../components/ToolPageLayout";+import { YourToolForm } from "./YourToolForm";+import Link from "next/link";+import type { Metadata } from "next";++export const metadata: Metadata = {+ title: "Free Your Tool Name | Description for SEO",+ description: "Your tool description that will appear in search results and social media previews.",+ openGraph: {+ title: "Free Your Tool Name | Short Description",+ description: "Social media description for your tool.",+ type: "website",+ url: "https://rybbit.com/tools/your-tool-name",+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Your Tool Name",+ description: "Twitter card description.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/your-tool-name",+ },+};++const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Your Tool Name",+ description: "Tool description for schema.org",+ url: "https://rybbit.com/tools/your-tool-name",+ applicationCategory: "Utility",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is this tool?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Answer to the question.",+ },+ },+ // Add more FAQ items here+ ],+ },+ ],+};++const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What is Your Tool?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Explain what your tool does and why it's useful. This section should provide context and help users understand the+ value of the tool.+ </p>++ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Use This Tool</h2>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Step 1:</strong> Description of first step+ </li>+ <li>+ <strong>Step 2:</strong> Description of second step+ </li>+ <li>+ <strong>Step 3:</strong> Description of third step+ </li>+ </ol>++ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Best Practices</h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Best practice 1:</strong> Explanation+ </li>+ <li>+ <strong>Best practice 2:</strong> Explanation+ </li>+ </ul>+ </>+);++const faqs = [+ {+ question: "What is this tool for?",+ answer: "This tool helps you calculate/generate/analyze X by doing Y. It's useful for Z.",+ },+ {+ question: "How does it work?",+ answer:+ "The tool works by taking your input and processing it using [methodology]. The result shows you [what the result means].",+ },+ {+ question: "Can I use this with Rybbit?",+ answer: (+ <>+ Yes! Use{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to track [relevant metric] and see how your results compare over time.+ </>+ ),+ },+ // Add more FAQs - aim for 4-6 total+];++export default function YourToolPage() {+ return (+ <ToolPageLayout+ toolSlug="your-tool-name"+ title="Your Tool Name"+ description="Brief description of what your tool does and why it's useful for users."+ badge="Free Tool" // or "AI-Powered Tool"+ toolComponent={<YourToolForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics" // or "seo" or "privacy"+ ctaTitle="Track your [metric] with Rybbit"+ ctaDescription="Monitor [specific metrics] in real-time with privacy-first analytics."+ ctaEventLocation="your_tool_name_cta"+ structuredData={structuredData}+ />+ );+}+```++## Component Props Reference++### Required Props++| Prop | Type | Description | Example |+| ---------------------- | ----------------------------------- | ----------------------------------------------- | --------------------------------- |+| `toolSlug` | `string` | URL-friendly identifier matching directory name | `"bounce-rate-calculator"` |+| `title` | `string` | Page title shown in header | `"Bounce Rate Calculator"` |+| `description` | `string` | Brief description below title | `"Calculate your bounce rate..."` |+| `toolComponent` | `ReactNode` | Your interactive tool form | `<YourToolForm />` |+| `educationalContent` | `ReactNode` | Educational sections as JSX | See example above |+| `faqs` | `FAQItem[]` | Array of FAQ objects | See example above |+| `relatedToolsCategory` | `"seo" \| "analytics" \| "privacy"` | Category for related tools | `"analytics"` |+| `ctaTitle` | `string` | CTA section title | `"Track with Rybbit"` |+| `ctaDescription` | `string` | CTA section description | `"Monitor metrics..."` |+| `ctaEventLocation` | `string` | Event tracking identifier | `"your_tool_cta"` |++### Optional Props++| Prop | Type | Default | Description |+| ---------------- | -------- | --------------------------- | ---------------------- |+| `badge` | `string` | `"Free Tool"` | Badge text above title |+| `ctaButtonText` | `string` | `"Start tracking for free"` | CTA button text |+| `structuredData` | `object` | `undefined` | JSON-LD for SEO |++## Choosing the Right Category++Your tool should be categorized based on its primary purpose:++- **`analytics`** - Tools for measuring, calculating, or analyzing metrics++ - Examples: bounce-rate-calculator, ctr-calculator, funnel-visualizer++- **`seo`** - Tools for search engine optimization++ - Examples: seo-title-generator, meta-description-generator, og-tag-generator++- **`privacy`** - Tools related to privacy, compliance, or data protection+ - Examples: analytics-detector, privacy-policy-builder++## Choosing the Right Badge++- **`"Free Tool"`** - For calculators, analyzers, and standard tools+- **`"AI-Powered Tool"`** - For tools that use AI/LLM features to generate content++## Educational Content Guidelines++The `educationalContent` section should be comprehensive and helpful:++1. **Start with "What is X?"** - Define the concept or metric+2. **Explain "Why it Matters"** - Business value and use cases+3. **Provide "How to Use"** - Step-by-step instructions+4. **Include "Best Practices"** - Tips and recommendations+5. **Add "Common Mistakes"** - What to avoid++### Content Structure Tips++- Use h2 for main sections, h3 for subsections+- Include code examples in `<code>` tags where relevant+- Use lists (ul/ol) for easy scanning+- Keep paragraphs concise and scannable+- Add examples to illustrate concepts++## FAQ Guidelines++Aim for 4-6 FAQs that cover:++1. What the tool does+2. How it works+3. Why the metric/concept matters+4. Common questions or misconceptions+5. How to integrate with Rybbit (when relevant)++FAQs can include JSX for links:++```tsx+{+ question: "How do I track this with Rybbit?",+ answer: (+ <>+ Use{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to track your metrics automatically.+ </>+ ),+}+```++## Metadata Best Practices++### Title Tag++- Format: `"Free [Tool Name] | [Benefit/Description]"`+- Keep under 60 characters+- Include primary keyword++### Description++- 150-160 characters+- Include value proposition+- Use action words++### Keywords++- 8-12 relevant keywords+- Include variations and long-tail terms+- Don't keyword stuff++## Styling Guidelines++### Colors++- Primary action: `bg-emerald-600 hover:bg-emerald-500`+- Success states: `bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-800`+- Backgrounds: `bg-white dark:bg-neutral-900`+- Borders: `border-neutral-200 dark:border-neutral-800`+- Text: `text-neutral-900 dark:text-white` (headings), `text-neutral-700 dark:text-neutral-300` (body)++### Spacing++- Section spacing: `mb-16` or `mt-8 mb-6`+- Element spacing: `mb-4`, `mb-6`+- List items: `space-y-2` or `space-y-4`++## Testing Your Tool++Before submitting, verify:++- [ ] Tool renders correctly in light and dark mode+- [ ] All interactive elements work as expected+- [ ] Educational content is comprehensive and helpful+- [ ] FAQs answer common questions+- [ ] No TypeScript errors+- [ ] Metadata is complete and accurate+- [ ] Links work correctly (especially Rybbit links)+- [ ] Tool slug matches directory name+- [ ] Related tools show correct category+- [ ] CTA section appears and works++## Example Tools for Reference++Good examples to reference:++- **Simple calculator**: `utm-builder` or `bounce-rate-calculator`+- **AI-powered tool**: `seo-title-generator` or `meta-description-generator`+- **Complex tool**: `funnel-visualizer` or `sample-size-calculator`++## Common Patterns++### Loading States++```tsx+const [isLoading, setIsLoading] = useState(false);++const handleSubmit = async () => {+ setIsLoading(true);+ try {+ // Your logic+ } finally {+ setIsLoading(false);+ }+};++<button disabled={isLoading}>{isLoading ? "Processing..." : "Calculate"}</button>;+```++### Error Handling++```tsx+const [error, setError] = useState<string | null>(null);++{+ error && (+ <div className="p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">+ <p className="text-red-900 dark:text-red-200">{error}</p>+ </div>+ );+}+```++### Copy to Clipboard++```tsx+const handleCopy = async () => {+ try {+ await navigator.clipboard.writeText(result);+ setCopied(true);+ setTimeout(() => setCopied(false), 2000);+ } catch (err) {+ console.error("Failed to copy:", err);+ }+};+```++## API Integration (if needed)++If your tool needs a backend API:++1. Create API route in `/docs/src/app/api/tools/your-tool-name/route.ts`+2. Use POST method for tool calculations+3. Validate input with Zod+4. Handle errors gracefully+5. Return structured JSON responses++Example API route:++```ts+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const schema = z.object({+ input: z.string().min(1),+});++export async function POST(request: NextRequest) {+ try {+ const body = await request.json();+ const { input } = schema.parse(body);++ // Your tool logic here+ const result = processInput(input);++ return NextResponse.json({ result });+ } catch (error) {+ return NextResponse.json({ error: "Invalid input" }, { status: 400 });+ }+}+```++## Need Help?++- Check existing tools in `/docs/src/app/(home)/tools/` for examples+- Read the migration guide at `MIGRATION_GUIDE.md`+- Review the `ToolPageLayout` component at `components/ToolPageLayout.tsx`+- Ask questions in the team channeldiff --git a/docs/src/app/(home)/tools/MIGRATION_GUIDE.md b/docs/src/app/(home)/tools/MIGRATION_GUIDE.mdnew file mode 100644index 000000000..fe0c2dbef--- /dev/null+++ b/docs/src/app/(home)/tools/MIGRATION_GUIDE.md@@ -0,0 +1,370 @@+# Tool Pages Migration Guide++This guide explains how to migrate existing tool pages to use the new `ToolPageLayout` component, which enforces a consistent 6-section structure across all tool pages.++## Why Migrate?++The `ToolPageLayout` component ensures all tools follow this consistent structure:+1. **Header** - Title, badge, description+2. **The Actual Tool** - Interactive tool component+3. **Educational Content** - How-to guides, explanations, best practices+4. **FAQ** - Frequently asked questions in accordion format+5. **Related Tools** - Links to similar tools+6. **CTA** - Call-to-action for Rybbit signup++## Example: utm-builder (Fully Migrated)++See `/tools/utm-builder/page.tsx` for a complete working example of a migrated tool.++## Migration Steps++### Step 1: Import the Layout Component++Replace individual component imports with the `ToolPageLayout`:++```tsx+// Before+import { Breadcrumbs } from "@/components/Breadcrumbs";+import { RelatedTools } from "@/components/RelatedTools";+import { ToolCTA } from "../components/ToolCTA";+import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";++// After+import { ToolPageLayout } from "../components/ToolPageLayout";+```++### Step 2: Extract Educational Content into a Constant++Move all educational/informational content into a single JSX constant:++```tsx+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">+ Section Title+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Your educational content here...+ </p>++ {/* Include all your educational sections */}+ </>+);+```++### Step 3: Convert FAQs to Array Format++Transform your FAQ Accordion into a simple array:++```tsx+// Before (inline Accordion)+<Accordion type="single" collapsible className="w-full">+ <AccordionItem value="item-1">+ <AccordionTrigger>What is...?</AccordionTrigger>+ <AccordionContent>Answer here</AccordionContent>+ </AccordionItem>+ {/* ... more items */}+</Accordion>++// After (array of objects)+const faqs = [+ {+ question: "What is...?",+ answer: "Answer here",+ },+ {+ question: "Another question?",+ answer: "Another answer", // Can also be JSX with <Link>, etc.+ },+];+```++**Note**: FAQ answers can be either strings or JSX (ReactNode):++```tsx+const faqs = [+ {+ question: "How do I track with Rybbit?",+ answer: (+ <>+ Use{" "}+ <Link href="https://rybbit.com" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit+ </Link>{" "}+ to track your analytics.+ </>+ ),+ },+];+```++### Step 4: Use ToolPageLayout in Your Default Export++Replace the entire JSX structure with the layout component:++```tsx+export default function YourToolPage() {+ return (+ <ToolPageLayout+ // Basic info+ toolSlug="your-tool-slug"+ title="Your Tool Title"+ description="Brief description of what your tool does and why it's useful."+ badge="Free Tool" // or "AI-Powered Tool"++ // Content sections+ toolComponent={<YourToolForm />}+ educationalContent={educationalContent}+ faqs={faqs}++ // Navigation+ relatedToolsCategory="analytics" // or "seo", "privacy", etc.++ // CTA+ ctaTitle="Track with Rybbit"+ ctaDescription="See detailed analytics in real-time."+ ctaEventLocation="your_tool_cta"+ ctaButtonText="Start tracking for free" // Optional, has default++ // Optional structured data+ structuredData={structuredData} // Your existing JSON-LD+ />+ );+}+```++## Complete Before/After Example++### Before Migration++```tsx+export default function ExampleToolPage() {+ return (+ <>+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }} />++ <div className="min-h-screen">+ <div className="max-w-4xl mx-auto px-6 py-20">+ <Breadcrumbs items={[...]} />++ {/* Header */}+ <div className="mb-16">+ <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 ...">+ <span>Free Tool</span>+ </div>+ <h1>Tool Title</h1>+ <p>Description</p>+ </div>++ {/* Tool */}+ <ToolForm />++ {/* Educational Content */}+ <div className="mb-16">+ <h2>How It Works</h2>+ <p>Content...</p>+ </div>++ {/* FAQ */}+ <div className="mb-16">+ <Accordion>...</Accordion>+ </div>++ <RelatedTools currentToolHref="/tools/example" category="analytics" />+ </div>++ <ToolCTA title="..." description="..." eventLocation="example_cta" />+ </div>+ </>+ );+}+```++### After Migration++```tsx+import { ToolPageLayout } from "../components/ToolPageLayout";+import { ToolForm } from "./ToolForm";+import type { Metadata } from "next";++export const metadata: Metadata = { /* same as before */ };++const structuredData = { /* same as before */ };++const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">How It Works</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">Content...</p>+ </>+);++const faqs = [+ {+ question: "First question?",+ answer: "First answer",+ },+ {+ question: "Second question?",+ answer: "Second answer",+ },+];++export default function ExampleToolPage() {+ return (+ <ToolPageLayout+ toolSlug="example"+ title="Tool Title"+ description="Description"+ badge="Free Tool"+ toolComponent={<ToolForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Track with Rybbit"+ ctaDescription="Get detailed analytics."+ ctaEventLocation="example_cta"+ structuredData={structuredData}+ />+ );+}+```++## Props Reference++### Required Props++| Prop | Type | Description |+|------|------|-------------|+| `toolSlug` | `string` | URL-friendly tool identifier (e.g., "utm-builder") |+| `title` | `string` | Page title shown in header |+| `description` | `string` | Brief description below title |+| `toolComponent` | `ReactNode` | Your interactive tool form/component |+| `educationalContent` | `ReactNode` | Educational content section (JSX) |+| `faqs` | `FAQItem[]` | Array of FAQ objects |+| `relatedToolsCategory` | `string` | Category for related tools ("seo", "analytics", "privacy") |+| `ctaTitle` | `string` | CTA section title |+| `ctaDescription` | `string` | CTA section description |+| `ctaEventLocation` | `string` | Event tracking location identifier |++### Optional Props++| Prop | Type | Default | Description |+|------|------|---------|-------------|+| `badge` | `string` | `"Free Tool"` | Badge text shown above title |+| `ctaButtonText` | `string` | `"Start tracking for free"` | CTA button text |+| `structuredData` | `object` | `undefined` | JSON-LD structured data for SEO |++### FAQItem Type++```typescript+interface FAQItem {+ question: string;+ answer: ReactNode; // Can be string or JSX+}+```++## Common Issues++### Issue: FAQ answers with links++**Solution**: Use JSX in the answer field:++```tsx+const faqs = [+ {+ question: "How do I use this with Rybbit?",+ answer: (+ <>+ Visit{" "}+ <Link href="https://rybbit.com" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit+ </Link>{" "}+ to get started.+ </>+ ),+ },+];+```++### Issue: Complex educational content with multiple sections++**Solution**: Keep all sections in the single `educationalContent` constant:++```tsx+const educationalContent = (+ <>+ <h2>Section 1</h2>+ <p>Content 1...</p>++ <h2 className="mt-8">Section 2</h2>+ <p>Content 2...</p>++ <h3 className="mt-6">Subsection</h3>+ <ul>+ <li>Item 1</li>+ <li>Item 2</li>+ </ul>+ </>+);+```++### Issue: Tool needs custom wrapper or additional context++**Solution**: Wrap your tool component when passing it:++```tsx+toolComponent={+ <div className="custom-wrapper">+ <h2 className="text-2xl font-bold mb-6">Try the Tool</h2>+ <YourToolForm />+ </div>+}+```++## Migration Checklist++For each tool page, verify:++- [ ] Imports updated to use `ToolPageLayout`+- [ ] Educational content extracted to `educationalContent` constant+- [ ] FAQs converted to array format+- [ ] All 6 sections are present and populated+- [ ] `toolSlug` matches the directory name+- [ ] `relatedToolsCategory` is correct ("seo", "analytics", or "privacy")+- [ ] CTA event location follows naming convention: `{tool_slug}_cta`+- [ ] Page renders correctly in development+- [ ] Structured data is passed through (if it exists)+- [ ] No TypeScript errors++## Tools to Migrate++Current tools in `/tools/`:+- [ ] analytics-detector+- [ ] bounce-rate-calculator+- [ ] ctr-calculator+- [ ] funnel-visualizer+- [ ] marketing-roi-calculator+- [ ] meta-description-generator+- [ ] og-tag-generator+- [ ] page-speed-calculator+- [ ] privacy-policy-builder+- [ ] sample-size-calculator+- [ ] seo-title-generator+- [ ] traffic-value-calculator+- [x] utm-builder (completed as example)++## Benefits of Migration++1. **Consistency**: All tools follow the exact same structure+2. **Maintainability**: Update layout in one place for all tools+3. **Type Safety**: TypeScript ensures required sections are present+4. **Developer Experience**: Clear interface for what's needed+5. **SEO**: Consistent structure improves search rankings+6. **User Experience**: Familiar navigation patterns across tools++## Questions?++If you encounter issues during migration, check:+1. The working example at `/tools/utm-builder/page.tsx`+2. The component at `/tools/components/ToolPageLayout.tsx`+3. TypeScript types: `ToolPageLayoutProps` and `FAQItem`diff --git a/docs/src/app/(home)/tools/ai-privacy-policy-generator/page.tsx b/docs/src/app/(home)/tools/ai-privacy-policy-generator/page.tsxdeleted file mode 100644index daa58c2d2..000000000--- a/docs/src/app/(home)/tools/ai-privacy-policy-generator/page.tsx+++ /dev/null@@ -1,277 +0,0 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { CheckCircle, Copy, Loader2 } from "lucide-react";-import { useState } from "react";--export default function AIPrivacyPolicyGeneratorPage() {- const [websiteName, setWebsiteName] = useState("");- const [websiteUrl, setWebsiteUrl] = useState("");- const [contactEmail, setContactEmail] = useState("");- const [siteDescription, setSiteDescription] = useState("");- const [generatedPolicy, setGeneratedPolicy] = useState("");- const [isLoading, setIsLoading] = useState(false);- const [error, setError] = useState("");- const [copied, setCopied] = useState(false);- const [remainingRequests, setRemainingRequests] = useState<number | null>(null);-- const generatePolicy = async () => {- if (!websiteName || !websiteUrl || !contactEmail || !siteDescription) {- setError("Please fill in all fields");- return;- }-- setIsLoading(true);- setError("");- setGeneratedPolicy("");-- try {- const response = await fetch("/api/tools/generate-privacy-policy", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({- websiteName,- websiteUrl,- contactEmail,- siteDescription,- }),- });-- const remaining = response.headers.get("X-RateLimit-Remaining");- if (remaining) setRemainingRequests(parseInt(remaining));-- if (!response.ok) {- const data = await response.json();- throw new Error(data.error || "Failed to generate policy");- }-- const data = await response.json();- setGeneratedPolicy(data.policy);- } catch (err) {- setError(err instanceof Error ? err.message : "An error occurred");- } finally {- setIsLoading(false);- }- };-- const copyToClipboard = async () => {- await navigator.clipboard.writeText(generatedPolicy);- setCopied(true);- setTimeout(() => setCopied(false), 2000);- };-- const downloadPolicy = () => {- const blob = new Blob([generatedPolicy], { type: "text/markdown" });- const url = URL.createObjectURL(blob);- const a = document.createElement("a");- a.href = url;- a.download = "privacy-policy.md";- document.body.appendChild(a);- a.click();- document.body.removeChild(a);- URL.revokeObjectURL(url);- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">AI-Powered Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- AI Privacy Policy Generator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Generate a comprehensive, GDPR-compliant privacy policy tailored to your website using AI. Just describe your site and we'll handle the rest.- </p>- {remainingRequests !== null && (- <p className="text-sm text-neutral-500 dark:text-neutral-400 mt-4">- {remainingRequests} requests remaining this minute- </p>- )}- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Website Name <span className="text-red-500">*</span>- </label>- <input- type="text"- value={websiteName}- onChange={e => setWebsiteName(e.target.value)}- placeholder="Acme Inc."- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Website URL <span className="text-red-500">*</span>- </label>- <input- type="url"- value={websiteUrl}- onChange={e => setWebsiteUrl(e.target.value)}- placeholder="https://example.com"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Contact Email <span className="text-red-500">*</span>- </label>- <input- type="email"- value={contactEmail}- onChange={e => setContactEmail(e.target.value)}- placeholder="[email protected]"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Describe Your Website <span className="text-red-500">*</span>- </label>- <textarea- value={siteDescription}- onChange={e => setSiteDescription(e.target.value)}- placeholder="We run an e-commerce store selling handmade jewelry. We collect email addresses for newsletters, process payments through Stripe, and use cookies for shopping cart functionality..."- disabled={isLoading}- rows={6}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Describe what your site does, what data you collect, how you use it, and any third-party services- </p>- </div>-- {error && (- <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">- <p className="text-sm text-red-900 dark:text-red-200">{error}</p>- </div>- )}-- <button- onClick={generatePolicy}- disabled={isLoading}- className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"- >- {isLoading ? (- <>- <Loader2 className="w-5 h-5 animate-spin" />- Generating Policy...- </>- ) : (- "Generate Privacy Policy"- )}- </button>-- {generatedPolicy && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">- <div className="flex items-center justify-between mb-3">- <label className="block text-sm font-medium text-neutral-900 dark:text-white">- Your Generated Privacy Policy- </label>- <div className="flex gap-2">- <button- onClick={copyToClipboard}- className="px-4 py-2 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2"- >- {copied ? <CheckCircle className="w-4 h-4" /> : <Copy className="w-4 h-4" />}- {copied ? "Copied!" : "Copy"}- </button>- <button- onClick={downloadPolicy}- className="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition-colors"- >- Download- </button>- </div>- </div>- <div className="max-h-96 overflow-y-auto p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg">- <pre className="text-xs text-neutral-900 dark:text-neutral-100 whitespace-pre-wrap font-mono">- {generatedPolicy}- </pre>- </div>- </div>- )}- </div>- </div>-- {/* Warning */}- <div className="bg-yellow-50 dark:bg-yellow-950/30 border border-yellow-200 dark:border-yellow-900 rounded-xl p-6 mb-16">- <p className="text-sm text-yellow-900 dark:text-yellow-200">- <strong>Disclaimer:</strong> This AI-generated privacy policy is a starting point. While it's tailored to your description, you should have it reviewed by a legal professional to ensure compliance with all applicable laws and regulations in your jurisdiction.- </p>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">About AI-Generated Policies</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How is this different from the template generator?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- This AI-powered tool understands your specific business description and generates a customized policy that addresses your unique use case. It's more comprehensive and tailored than a simple template, and includes a section about Rybbit's privacy-focused analytics.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Is this legally binding?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- The generated policy is a comprehensive starting point based on common legal requirements (GDPR, CCPA). However, you should always have a lawyer review any legal document before publishing it. Laws vary by jurisdiction and your specific circumstances.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Why does it mention Rybbit?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- If you use analytics on your site, you need to disclose it in your privacy policy. The generated policy includes a section about Rybbit's privacy-focused, cookieless analytics as an example of responsible data collection that respects user privacy.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Privacy-first analytics with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- No cookies, no tracking, full GDPR compliance. Get powerful analytics without compromising your users' privacy. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "ai_privacy_policy_generator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>- );-}diff --git a/docs/src/app/(home)/tools/analytics-detector/AnalyticsDetectorForm.tsx b/docs/src/app/(home)/tools/analytics-detector/AnalyticsDetectorForm.tsxnew file mode 100644index 000000000..eaa2c1efc--- /dev/null+++ b/docs/src/app/(home)/tools/analytics-detector/AnalyticsDetectorForm.tsx@@ -0,0 +1,182 @@+"use client";++import { AlertCircle, Loader2, Shield } from "lucide-react";+import { useState } from "react";++interface Platform {+ name: string;+ category: string;+ privacy: string;+ identifier?: string;+}++interface DetectionResult {+ platforms: Platform[];+ summary: string;+ privacyScore: string;+}++export function AnalyticsDetectorForm() {+ const [url, setUrl] = useState("");+ const [result, setResult] = useState<DetectionResult | null>(null);+ const [isLoading, setIsLoading] = useState(false);+ const [error, setError] = useState("");+ const [remainingRequests, setRemainingRequests] = useState<number | null>(null);++ const detectAnalytics = async () => {+ if (!url) {+ setError("Please enter a website URL");+ return;+ }++ setIsLoading(true);+ setError("");+ setResult(null);++ try {+ const response = await fetch("/api/tools/detect-analytics", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ url }),+ });++ const remaining = response.headers.get("X-RateLimit-Remaining");+ if (remaining) setRemainingRequests(parseInt(remaining));++ if (!response.ok) {+ const data = await response.json();+ throw new Error(data.error || "Failed to detect analytics");+ }++ const data = await response.json();+ setResult(data);+ } catch (err) {+ setError(err instanceof Error ? err.message : "An error occurred");+ } finally {+ setIsLoading(false);+ }+ };++ const getPrivacyScoreColor = (score: string) => {+ switch (score.toLowerCase()) {+ case "low":+ return "text-emerald-600 dark:text-emerald-400";+ case "medium":+ return "text-orange-600 dark:text-orange-400";+ case "high":+ return "text-red-600 dark:text-red-400";+ default:+ return "text-neutral-600 dark:text-neutral-400";+ }+ };++ return (+ <div className="space-y-6">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Website URL <span className="text-red-500">*</span>+ </label>+ <input+ type="url"+ value={url}+ onChange={(e) => setUrl(e.target.value)}+ placeholder="https://example.com"+ disabled={isLoading}+ onKeyDown={(e) => e.key === "Enter" && detectAnalytics()}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Enter the full URL including https://+ </p>+ </div>++ {error && (+ <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg flex items-start gap-2">+ <AlertCircle className="w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5" />+ <p className="text-sm text-red-900 dark:text-red-200">{error}</p>+ </div>+ )}++ <button+ onClick={detectAnalytics}+ disabled={isLoading}+ className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"+ >+ {isLoading ? (+ <>+ <Loader2 className="w-5 h-5 animate-spin" />+ Analyzing Website...+ </>+ ) : (+ "Detect Analytics"+ )}+ </button>++ {result && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-6">+ {/* Summary */}+ <div className="p-6 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">+ <div className="flex items-start gap-3 mb-3">+ <Shield className="w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5" />+ <div className="flex-1">+ <h3 className="font-semibold text-blue-900 dark:text-blue-200 mb-1">+ Privacy Score+ </h3>+ <p className={`text-2xl font-bold ${getPrivacyScoreColor(result.privacyScore)}`}>+ {result.privacyScore}+ </p>+ </div>+ </div>+ <p className="text-sm text-blue-900 dark:text-blue-200">{result.summary}</p>+ </div>++ {/* Detected Platforms */}+ {result.platforms.length > 0 ? (+ <div>+ <h3 className="text-lg font-semibold text-neutral-900 dark:text-white mb-4">+ Detected Platforms ({result.platforms.length})+ </h3>+ <div className="space-y-3">+ {result.platforms.map((platform, index) => (+ <div+ key={index}+ className="p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg"+ >+ <div className="flex items-start justify-between mb-2">+ <h4 className="font-semibold text-neutral-900 dark:text-white">+ {platform.name}+ </h4>+ <span className="px-2 py-1 text-xs font-medium bg-neutral-100 dark:bg-neutral-700 text-neutral-700 dark:text-neutral-300 rounded-full">+ {platform.category}+ </span>+ </div>+ <p className="text-sm text-neutral-600 dark:text-neutral-300 mb-2">+ {platform.privacy}+ </p>+ {platform.identifier && (+ <p className="text-xs text-neutral-500 dark:text-neutral-400 font-mono">+ ID: {platform.identifier}+ </p>+ )}+ </div>+ ))}+ </div>+ </div>+ ) : (+ <div className="p-6 text-center bg-neutral-100 dark:bg-neutral-800 rounded-lg">+ <p className="text-neutral-600 dark:text-neutral-400">+ No analytics platforms detected on this website.+ </p>+ </div>+ )}+ </div>+ )}++ {remainingRequests !== null && (+ <p className="text-sm text-neutral-500 dark:text-neutral-400">+ {remainingRequests} requests remaining this minute+ </p>+ )}+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/analytics-detector/page.tsx b/docs/src/app/(home)/tools/analytics-detector/page.tsxindex 03a472b29..19895d18a 100644--- a/docs/src/app/(home)/tools/analytics-detector/page.tsx+++ b/docs/src/app/(home)/tools/analytics-detector/page.tsx@@ -1,258 +1,286 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { AlertCircle, Loader2, Shield } from "lucide-react";+import { ToolPageLayout } from "../components/ToolPageLayout";+import { AnalyticsDetectorForm } from "./AnalyticsDetectorForm";import Link from "next/link";-import { useState } from "react";+import { Metadata } from "next";-interface Platform {- name: string;- category: string;- privacy: string;- identifier?: string;-}+export const metadata: Metadata = {+ title: "Free Analytics Detector | Website Analytics & Tracking Tool Finder",+ description:+ "Discover what analytics and tracking tools any website is using. Analyze privacy implications, understand data collection practices, and learn about privacy-focused alternatives.",+ openGraph: {+ title: "Free Analytics Detector | Website Analytics & Tracking Tool Finder",+ description:+ "Discover what analytics and tracking tools any website is using. Analyze privacy implications and understand data collection practices.",+ type: "website",+ url: "https://rybbit.com/tools/analytics-detector",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Analytics Detector | Website Analytics & Tracking Tool Finder",+ description: "Discover what analytics and tracking tools any website is using.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/analytics-detector",+ },+};-interface DetectionResult {- platforms: Platform[];- summary: string;- privacyScore: string;-}--export default function AnalyticsDetectorPage() {- const [url, setUrl] = useState("");- const [result, setResult] = useState<DetectionResult | null>(null);- const [isLoading, setIsLoading] = useState(false);- const [error, setError] = useState("");- const [remainingRequests, setRemainingRequests] = useState<number | null>(null);+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ "@id": "https://rybbit.com/tools/analytics-detector",+ name: "Analytics Detector",+ description: "Free tool to detect and analyze analytics platforms and tracking tools used on any website",+ url: "https://rybbit.com/tools/analytics-detector",+ applicationCategory: "UtilityApplication",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ creator: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "How does the Analytics Detector tool work?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "This tool fetches the website's HTML, analyzes the scripts and tags, and uses AI to identify analytics platforms, tag managers, and tracking technologies. It looks for common patterns, script URLs, and tracking identifiers to provide a comprehensive overview of the tracking infrastructure.",+ },+ },+ {+ "@type": "Question",+ name: "What do the privacy scores mean?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Privacy scores indicate tracking intensity: Low (minimal tracking, privacy-focused tools), Medium (moderate tracking, some cookies), High (extensive tracking, multiple third-party services). This helps you understand data collection practices and the privacy implications of each analytics tool.",+ },+ },+ {+ "@type": "Question",+ name: "Which analytics tools are privacy-focused?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Privacy-focused analytics tools like Rybbit, Fathom, Plausible, and Shynet don't use cookies, don't track users across sites, and are GDPR compliant by default. These alternatives provide valuable insights without compromising user privacy or requiring cookie banners.",+ },+ },+ {+ "@type": "Question",+ name: "What is GDPR compliance and why does it matter for analytics?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "GDPR (General Data Protection Regulation) is EU legislation protecting user privacy. Analytics tools that are GDPR compliant don't require user consent through cookie banners because they don't collect personally identifiable information or engage in cross-site tracking. This simplifies compliance and improves user experience.",+ },+ },+ {+ "@type": "Question",+ name: "Can I switch from traditional analytics to privacy-first alternatives?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Yes, switching is straightforward. Privacy-first analytics tools provide similar insights without the tracking overhead. Most offer data export features and API access. You can typically remove traditional analytics code and replace it with privacy-focused alternatives in minutes.",+ },+ },+ ],+ },+ ],+};- const detectAnalytics = async () => {- if (!url) {- setError("Please enter a website URL");- return;- }+const educationalContent = (+ <>+ <section>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What Analytics Tools Exist?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ Modern websites use various analytics platforms to understand user behavior, measure performance, and optimize+ their content. These tools range from traditional universal analytics solutions that track individual users+ across the web to privacy-focused alternatives that aggregate data without identifying users.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">Common analytics platforms include:</p>+ <ul className="list-disc list-inside space-y-2 text-neutral-700 dark:text-neutral-300 ml-4">+ <li>+ <strong>Google Analytics</strong> - The most widely used analytics platform with comprehensive tracking+ </li>+ <li>+ <strong>Facebook Pixel</strong> - Tracks user behavior for ad targeting and conversion measurement+ </li>+ <li>+ <strong>Tag Managers</strong> - Google Tag Manager, Tealium, and others that deploy multiple tracking codes+ </li>+ <li>+ <strong>Privacy-focused alternatives</strong> - Rybbit, Plausible, Fathom Analytics that prioritize user+ privacy+ </li>+ <li>+ <strong>Specialized tools</strong> - Heatmap tools, session recording, A/B testing platforms+ </li>+ </ul>+ </section>- setIsLoading(true);- setError("");- setResult(null);+ <section className="mt-8">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">+ Understanding Privacy Concerns with Analytics+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ Traditional analytics tools often create privacy concerns because they:+ </p>+ <ul className="list-disc list-inside space-y-2 text-neutral-700 dark:text-neutral-300 ml-4">+ <li>+ <strong>Track users across the web</strong> - Using cookies and identifiers to follow users across multiple+ websites+ </li>+ <li>+ <strong>Collect personally identifiable information</strong> - Building detailed profiles about individual+ users+ </li>+ <li>+ <strong>Share data with third parties</strong> - Selling or sharing user data with advertisers and brokers+ </li>+ <li>+ <strong>Require consent</strong> - Mandating cookie banners due to GDPR and privacy regulations+ </li>+ <li>+ <strong>Store data indefinitely</strong> - Maintaining user profiles for extended periods+ </li>+ </ul>+ <p className="text-neutral-700 dark:text-neutral-300 mt-4 leading-relaxed">+ Privacy-focused alternatives address these concerns by using anonymous tracking that never identifies+ individuals, avoiding cookies, being GDPR compliant by default, and respecting user privacy while still+ providing valuable insights.+ </p>+ </section>- try {- const response = await fetch("/api/tools/detect-analytics", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ url }),- });+ <section className="mt-8">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">How Analytics Detection Works</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ The Analytics Detector analyzes a website to identify tracking tools through several methods:+ </p>+ <ul className="list-disc list-inside space-y-2 text-neutral-700 dark:text-neutral-300 ml-4">+ <li>+ <strong>Script analysis</strong> - Examines JavaScript files and tags loaded on the page+ </li>+ <li>+ <strong>Pattern recognition</strong> - Identifies common URLs and code patterns used by analytics platforms+ </li>+ <li>+ <strong>Identifier detection</strong> - Looks for tracking IDs and configuration parameters+ </li>+ <li>+ <strong>HTTP header inspection</strong> - Analyzes server responses for tracking pixels and redirects+ </li>+ <li>+ <strong>AI classification</strong> - Uses machine learning to categorize detected tools and assess privacy+ impact+ </li>+ </ul>+ <p className="text-neutral-700 dark:text-neutral-300 mt-4 leading-relaxed">+ The detection happens client-side without storing data about the websites you analyze, ensuring your own privacy+ while using this tool.+ </p>+ </section>- const remaining = response.headers.get("X-RateLimit-Remaining");- if (remaining) setRemainingRequests(parseInt(remaining));+ <section className="mt-8">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">+ How to Choose the Right Analytics Tool for Your Website+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ When selecting an analytics tool for your website, consider these factors:+ </p>+ <ul className="list-disc list-inside space-y-2 text-neutral-700 dark:text-neutral-300 ml-4">+ <li>+ <strong>Privacy compliance</strong> - Ensure GDPR, CCPA, and other privacy regulation compliance+ </li>+ <li>+ <strong>User experience</strong> - Choose tools that don't require intrusive cookie banners+ </li>+ <li>+ <strong>Feature set</strong> - Match the tool's capabilities to your analytical needs+ </li>+ <li>+ <strong>Performance impact</strong> - Consider script size and loading time implications+ </li>+ <li>+ <strong>Data retention</strong> - Understand how long data is stored and when it's deleted+ </li>+ <li>+ <strong>Cost structure</strong> - Evaluate pricing based on your traffic volume and needs+ </li>+ <li>+ <strong>Support and documentation</strong> - Ensure good integration support and resources+ </li>+ </ul>+ <p className="text-neutral-700 dark:text-neutral-300 mt-4 leading-relaxed">+ Privacy-first analytics solutions have gained significant traction because they eliminate the privacy-compliance+ trade-off: you get excellent insights without the tracking overhead.+ </p>+ </section>+ </>+);- if (!response.ok) {- const data = await response.json();- throw new Error(data.error || "Failed to detect analytics");- }-- const data = await response.json();- setResult(data);- } catch (err) {- setError(err instanceof Error ? err.message : "An error occurred");- } finally {- setIsLoading(false);- }- };-- const getPrivacyScoreColor = (score: string) => {- switch (score.toLowerCase()) {- case "low":- return "text-emerald-600 dark:text-emerald-400";- case "medium":- return "text-orange-600 dark:text-orange-400";- case "high":- return "text-red-600 dark:text-red-400";- default:- return "text-neutral-600 dark:text-neutral-400";- }- };+const faqs = [+ {+ question: "How does the Analytics Detector tool work?",+ answer:+ "This tool fetches the website's HTML, analyzes the scripts and tags, and uses AI to identify analytics platforms, tag managers, and tracking technologies. It looks for common patterns, script URLs, and tracking identifiers to provide a comprehensive overview of the tracking infrastructure installed on any website.",+ },+ {+ question: "What do the privacy scores mean?",+ answer: (+ <>+ Privacy scores indicate tracking intensity: <strong>Low</strong> (minimal tracking, privacy-focused tools that+ use anonymous data), <strong>Medium</strong> (moderate tracking, some cookies and user-level analytics),{" "}+ <strong>High</strong> (extensive tracking, multiple third-party services and cross-site tracking). This helps+ you understand data collection practices and the privacy implications of each analytics tool detected.+ </>+ ),+ },+ {+ question: "Which analytics tools are most privacy-focused?",+ answer: (+ <>+ Privacy-focused analytics tools like{" "}+ <Link href="https://rybbit.com" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit+ </Link>+ , Plausible, Fathom Analytics, and Shynet don't use cookies, don't track users across sites, and are GDPR+ compliant by default. These alternatives provide valuable insights without compromising user privacy or+ requiring cookie banners. They use anonymous aggregated data instead of identifying individual users.+ </>+ ),+ },+ {+ question: "What is GDPR and why does it matter for analytics?",+ answer:+ "GDPR (General Data Protection Regulation) is EU legislation protecting user privacy. Analytics tools that are GDPR compliant don't require user consent through cookie banners because they don't collect personally identifiable information or engage in cross-site tracking. This simplifies compliance, eliminates the need for cookie consent dialogs, and improves user experience while still providing the analytics you need.",+ },+ {+ question: "Can I switch from traditional analytics to privacy-first alternatives?",+ answer:+ "Yes, switching is straightforward and can be done gradually. Privacy-first analytics tools provide similar insights without the tracking overhead. Most offer data export features, API access, and detailed migration guides. You can typically remove traditional analytics code and replace it with privacy-focused alternatives in minutes. Many websites run both in parallel during the transition period.",+ },+];+export default function AnalyticsDetectorPage() {return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">AI-Powered Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Analytics Platform Detector- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Discover what analytics and tracking tools any website is using. Analyze privacy implications and understand data collection practices.- </p>- {remainingRequests !== null && (- <p className="text-sm text-neutral-500 dark:text-neutral-400 mt-4">- {remainingRequests} requests remaining this minute- </p>- )}- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Website URL <span className="text-red-500">*</span>- </label>- <input- type="url"- value={url}- onChange={e => setUrl(e.target.value)}- placeholder="https://example.com"- disabled={isLoading}- onKeyDown={e => e.key === "Enter" && detectAnalytics()}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Enter the full URL including https://- </p>- </div>-- {error && (- <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg flex items-start gap-2">- <AlertCircle className="w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5" />- <p className="text-sm text-red-900 dark:text-red-200">{error}</p>- </div>- )}-- <button- onClick={detectAnalytics}- disabled={isLoading}- className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"- >- {isLoading ? (- <>- <Loader2 className="w-5 h-5 animate-spin" />- Analyzing Website...- </>- ) : (- "Detect Analytics"- )}- </button>-- {result && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-6">- {/* Summary */}- <div className="p-6 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">- <div className="flex items-start gap-3 mb-3">- <Shield className="w-5 h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5" />- <div className="flex-1">- <h3 className="font-semibold text-blue-900 dark:text-blue-200 mb-1">Privacy Score</h3>- <p className={`text-2xl font-bold ${getPrivacyScoreColor(result.privacyScore)}`}>- {result.privacyScore}- </p>- </div>- </div>- <p className="text-sm text-blue-900 dark:text-blue-200">{result.summary}</p>- </div>-- {/* Detected Platforms */}- {result.platforms.length > 0 ? (- <div>- <h3 className="text-lg font-semibold text-neutral-900 dark:text-white mb-4">- Detected Platforms ({result.platforms.length})- </h3>- <div className="space-y-3">- {result.platforms.map((platform, index) => (- <div- key={index}- className="p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg"- >- <div className="flex items-start justify-between mb-2">- <h4 className="font-semibold text-neutral-900 dark:text-white">{platform.name}</h4>- <span className="px-2 py-1 text-xs font-medium bg-neutral-100 dark:bg-neutral-700 text-neutral-700 dark:text-neutral-300 rounded-full">- {platform.category}- </span>- </div>- <p className="text-sm text-neutral-600 dark:text-neutral-300 mb-2">{platform.privacy}</p>- {platform.identifier && (- <p className="text-xs text-neutral-500 dark:text-neutral-400 font-mono">- ID: {platform.identifier}- </p>- )}- </div>- ))}- </div>- </div>- ) : (- <div className="p-6 text-center bg-neutral-100 dark:bg-neutral-800 rounded-lg">- <p className="text-neutral-600 dark:text-neutral-400">- No analytics platforms detected on this website.- </p>- </div>- )}- </div>- )}- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding Analytics Detection</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How does this tool work?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- This tool fetches the website's HTML, analyzes the scripts and tags, and uses AI to identify analytics platforms, tag managers, and tracking technologies. It looks for common patterns, script URLs, and tracking identifiers.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What do the privacy scores mean?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Privacy scores indicate tracking intensity: Low (minimal tracking, privacy-focused tools), Medium (moderate tracking, some cookies), High (extensive tracking, multiple third-party services). This helps you understand data collection practices.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Why choose privacy-focused analytics?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Privacy-focused analytics like{" "}- <Link href="https://rybbit.com" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit- </Link>{" "}- don't use cookies, don't track users across sites, and are GDPR compliant by default. You get the insights you need while respecting user privacy—no cookie banners required.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Privacy-first analytics with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- No cookies, no cross-site tracking, full GDPR compliance. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "analytics_detector_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="analytics-detector"+ title="Analytics Platform Detector"+ description="Discover what analytics and tracking tools any website is using. Analyze privacy implications and understand data collection practices."+ badge="AI-Powered Tool"+ toolComponent={<AnalyticsDetectorForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="privacy"+ ctaTitle="Privacy-first analytics with Rybbit"+ ctaDescription="No cookies, no cross-site tracking, full GDPR compliance."+ ctaEventLocation="analytics_detector_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/bounce-rate-calculator/BounceRateForm.tsx b/docs/src/app/(home)/tools/bounce-rate-calculator/BounceRateForm.tsxnew file mode 100644index 000000000..8c032761a--- /dev/null+++ b/docs/src/app/(home)/tools/bounce-rate-calculator/BounceRateForm.tsx@@ -0,0 +1,233 @@+"use client";++import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";+import Link from "next/link";+import { useState } from "react";++const industryBenchmarks: Record<string, { low: number; average: number; high: number }> = {+ "E-commerce": { low: 20, average: 45, high: 70 },+ "Blog/Content": { low: 40, average: 65, high: 90 },+ "Lead Generation": { low: 30, average: 50, high: 70 },+ "SaaS": { low: 10, average: 35, high: 60 },+ "Landing Pages": { low: 60, average: 75, high: 90 },+ "News/Media": { low: 40, average: 60, high: 80 },+ "Other": { low: 26, average: 55, high: 80 },+};++export function BounceRateForm() {+ const [totalSessions, setTotalSessions] = useState("");+ const [bouncedSessions, setBouncedSessions] = useState("");+ const [industry, setIndustry] = useState("E-commerce");++ const calculateBounceRate = () => {+ const total = parseFloat(totalSessions);+ const bounced = parseFloat(bouncedSessions);+ if (!total || !bounced || total === 0) return null;+ return (bounced / total) * 100;+ };++ const bounceRate = calculateBounceRate();+ const benchmark = industryBenchmarks[industry];++ const getPerformanceLevel = (rate: number) => {+ if (rate <= benchmark.low) return { label: "Excellent", color: "emerald" };+ if (rate <= benchmark.average) return { label: "Good", color: "blue" };+ if (rate <= benchmark.high) return { label: "Needs Improvement", color: "orange" };+ return { label: "Poor", color: "red" };+ };++ const clearForm = () => {+ setTotalSessions("");+ setBouncedSessions("");+ setIndustry("E-commerce");+ };++ return (+ <>+ {/* Tool Section */}+ <div className="mb-16">+ <div className="space-y-6">+ {/* Total Sessions */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Total Sessions <span className="text-red-500">*</span>+ </label>+ <input+ type="number"+ value={totalSessions}+ onChange={e => setTotalSessions(e.target.value)}+ placeholder="10000"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total number of sessions in the time period</p>+ </div>++ {/* Bounced Sessions */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Bounced Sessions <span className="text-red-500">*</span>+ </label>+ <input+ type="number"+ value={bouncedSessions}+ onChange={e => setBouncedSessions(e.target.value)}+ placeholder="4500"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Sessions with only one pageview (single-page visits)</p>+ </div>++ {/* Industry */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Industry Type</label>+ <select+ value={industry}+ onChange={e => setIndustry(e.target.value)}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"+ >+ {Object.keys(industryBenchmarks).map(ind => (+ <option key={ind} value={ind}>+ {ind}+ </option>+ ))}+ </select>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Select your industry to compare with benchmarks+ </p>+ </div>++ {/* Results */}+ {bounceRate !== null && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Your Bounce Rate</label>+ <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">+ <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">{bounceRate.toFixed(2)}%</div>+ </div>+ </div>++ <div className="grid grid-cols-3 gap-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Excellent+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-xl font-bold text-neutral-900 dark:text-white">≤{benchmark.low}%</div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Average+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-xl font-bold text-neutral-900 dark:text-white">~{benchmark.average}%</div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Needs Work+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-xl font-bold text-neutral-900 dark:text-white">≥{benchmark.high}%</div>+ </div>+ </div>+ </div>++ {(() => {+ const perf = getPerformanceLevel(bounceRate);+ const colorClasses = {+ emerald: "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900 text-emerald-900 dark:text-emerald-200",+ blue: "bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-900 text-blue-900 dark:text-blue-200",+ orange: "bg-orange-50 dark:bg-orange-950/30 border-orange-200 dark:border-orange-900 text-orange-900 dark:text-orange-200",+ red: "bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-900 text-red-900 dark:text-red-200"+ };++ return (+ <div className={`p-4 rounded-lg border ${colorClasses[perf.color as keyof typeof colorClasses]}`}>+ <p className="text-sm">+ <strong>{perf.label}!</strong> {+ perf.label === "Excellent" ? `Your bounce rate is well below the ${industry.toLowerCase()} average of ${benchmark.average}%. You're doing great at keeping visitors engaged!` :+ perf.label === "Good" ? `Your bounce rate is close to the ${industry.toLowerCase()} average of ${benchmark.average}%. There's room for improvement.` :+ perf.label === "Needs Improvement" ? `Your bounce rate is above the ${industry.toLowerCase()} average of ${benchmark.average}%. Consider improving page load speed, content quality, or user experience.` :+ `Your bounce rate is significantly higher than the ${industry.toLowerCase()} average of ${benchmark.average}%. Focus on improving content relevance, page speed, and user experience.`+ }+ </p>+ </div>+ );+ })()}+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ </div>++ {/* FAQ Section */}+ <div className="mb-12">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Frequently Asked Questions</h2>+ <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">+ <Accordion type="single" collapsible className="w-full">+ <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What is bounce rate?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Bounce rate is the percentage of visitors who leave your website after viewing only one page without any interaction. A high bounce rate might indicate that your landing pages aren't relevant to visitors or your site has usability issues.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What's a good bounce rate?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ A "good" bounce rate varies by industry and page type. E-commerce sites typically aim for 20-45%, while blogs may see 65-90% and still be healthy. Landing pages naturally have higher bounce rates (60-90%) since they're designed for a single action.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-3" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ How can I reduce my bounce rate?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ To reduce bounce rate: improve page load speed, ensure mobile responsiveness, create compelling content, add clear calls-to-action, use internal linking, improve content readability, and ensure your pages match visitor intent. Track your improvements with{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to see what works.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-4" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ Does bounce rate affect SEO?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ While bounce rate isn't a direct Google ranking factor, it can indirectly impact SEO. A high bounce rate suggests poor user experience or irrelevant content, which can lead to lower engagement signals. Google may interpret this as lower quality, potentially affecting your rankings over time.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-5">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ Why is bounce rate different in different tools?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Different analytics tools may calculate bounce rate differently based on how they track sessions, handle direct traffic, and count interactions. Some tools exclude certain traffic sources or implement different session timeouts. Always use the same tool consistently for accurate comparisons.+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsx b/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsxindex 4edf1dcb8..52b0d55d1 100644--- a/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsx+++ b/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsx@@ -1,252 +1,261 @@-"use client";+import { ToolPageLayout } from "../components/ToolPageLayout";+import { BounceRateForm } from "./BounceRateForm";+import type { Metadata } from "next";-import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import Link from "next/link";-import { useState } from "react";--const industryBenchmarks: Record<string, { low: number; average: number; high: number }> = {- "E-commerce": { low: 20, average: 45, high: 70 },- "Blog/Content": { low: 40, average: 65, high: 90 },- "Lead Generation": { low: 30, average: 50, high: 70 },- "SaaS": { low: 10, average: 35, high: 60 },- "Landing Pages": { low: 60, average: 75, high: 90 },- "News/Media": { low: 40, average: 60, high: 80 },- "Other": { low: 26, average: 55, high: 80 },+export const metadata: Metadata = {+ title: "Free Bounce Rate Calculator | Website Bounce Rate Analysis Tool",+ description:+ "Calculate your website's bounce rate and compare it to industry benchmarks. Understand bounce rate metrics, see what's healthy for your industry, and learn how to improve visitor engagement.",+ openGraph: {+ title: "Free Bounce Rate Calculator | Website Bounce Rate Analysis Tool",+ description:+ "Calculate and analyze your website's bounce rate compared to industry benchmarks. Get actionable insights to improve visitor engagement.",+ type: "website",+ url: "https://rybbit.com/tools/bounce-rate-calculator",+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Bounce Rate Calculator | Website Bounce Rate Analysis Tool",+ description: "Calculate your bounce rate and see how you compare to industry averages.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/bounce-rate-calculator",+ },};-export default function BounceRateCalculatorPage() {- const [totalSessions, setTotalSessions] = useState("");- const [bouncedSessions, setBouncedSessions] = useState("");- const [industry, setIndustry] = useState("E-commerce");-- const calculateBounceRate = () => {- const total = parseFloat(totalSessions);- const bounced = parseFloat(bouncedSessions);- if (!total || !bounced || total === 0) return null;- return (bounced / total) * 100;- };-- const bounceRate = calculateBounceRate();- const benchmark = industryBenchmarks[industry];-- const getPerformanceLevel = (rate: number) => {- if (rate <= benchmark.low) return { label: "Excellent", color: "emerald" };- if (rate <= benchmark.average) return { label: "Good", color: "blue" };- if (rate <= benchmark.high) return { label: "Needs Improvement", color: "orange" };- return { label: "Poor", color: "red" };- };-- const clearForm = () => {- setTotalSessions("");- setBouncedSessions("");- setIndustry("E-commerce");- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Bounce Rate Calculator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Calculate your website's bounce rate and compare it to industry benchmarks. See how well you're keeping visitors engaged.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Total Sessions */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Total Sessions <span className="text-red-500">*</span>- </label>- <input- type="number"- value={totalSessions}- onChange={e => setTotalSessions(e.target.value)}- placeholder="10000"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total number of sessions in the time period</p>- </div>-- {/* Bounced Sessions */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Bounced Sessions <span className="text-red-500">*</span>- </label>- <input- type="number"- value={bouncedSessions}- onChange={e => setBouncedSessions(e.target.value)}- placeholder="4500"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Sessions with only one pageview (single-page visits)</p>- </div>-- {/* Industry */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Industry Type</label>- <select- value={industry}- onChange={e => setIndustry(e.target.value)}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"- >- {Object.keys(industryBenchmarks).map(ind => (- <option key={ind} value={ind}>- {ind}- </option>- ))}- </select>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Select your industry to compare with benchmarks- </p>- </div>-- {/* Results */}- {bounceRate !== null && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Your Bounce Rate</label>- <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">- <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">{bounceRate.toFixed(2)}%</div>- </div>- </div>-- <div className="grid grid-cols-3 gap-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Excellent- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-xl font-bold text-neutral-900 dark:text-white">≤{benchmark.low}%</div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Average- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-xl font-bold text-neutral-900 dark:text-white">~{benchmark.average}%</div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Needs Work- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-xl font-bold text-neutral-900 dark:text-white">≥{benchmark.high}%</div>- </div>- </div>- </div>+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Bounce Rate Calculator",+ description: "Free tool to calculate and analyze website bounce rate with industry benchmarks",+ url: "https://rybbit.com/tools/bounce-rate-calculator",+ applicationCategory: "Utility",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is bounce rate?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Bounce rate is the percentage of visitors who leave your website after viewing only one page without any interaction. A high bounce rate might indicate that your landing pages aren't relevant to visitors or your site has usability issues.",+ },+ },+ {+ "@type": "Question",+ name: "What's a good bounce rate?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "A good bounce rate varies by industry and page type. E-commerce sites typically aim for 20-45%, while blogs may see 65-90% and still be healthy. Landing pages naturally have higher bounce rates (60-90%) since they're designed for a single action.",+ },+ },+ {+ "@type": "Question",+ name: "How can I reduce my bounce rate?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "To reduce bounce rate: improve page load speed, ensure mobile responsiveness, create compelling content, add clear calls-to-action, use internal linking, improve content readability, and ensure your pages match visitor intent.",+ },+ },+ {+ "@type": "Question",+ name: "Does bounce rate affect SEO?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "While bounce rate isn't a direct Google ranking factor, it can indirectly impact SEO. A high bounce rate suggests poor user experience or irrelevant content, which can lead to lower engagement signals. Google may interpret this as lower quality, potentially affecting your rankings over time.",+ },+ },+ {+ "@type": "Question",+ name: "Why is bounce rate different in different tools?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Different analytics tools may calculate bounce rate differently based on how they track sessions, handle direct traffic, and count interactions. Some tools exclude certain traffic sources or implement different session timeouts. Always use the same tool consistently for accurate comparisons.",+ },+ },+ ],+ },+ ],+};- {(() => {- const perf = getPerformanceLevel(bounceRate);- const colorClasses = {- emerald: "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900 text-emerald-900 dark:text-emerald-200",- blue: "bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-900 text-blue-900 dark:text-blue-200",- orange: "bg-orange-50 dark:bg-orange-950/30 border-orange-200 dark:border-orange-900 text-orange-900 dark:text-orange-200",- red: "bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-900 text-red-900 dark:text-red-200"- };+const educationalContent = (+ <>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4">What is Bounce Rate?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-6 leading-relaxed">+ Bounce rate is a key web analytics metric that measures the percentage of visitors who leave your website after+ viewing only a single page without taking any action. These visitors are called "bounced" sessions because they+ don't proceed to view additional pages or interact with your site in any meaningful way.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-8">+ For example, if you have 1,000 sessions in a month and 450 of those visitors leave after viewing only one page,+ your bounce rate would be 45%. Understanding your bounce rate is critical to evaluating whether your content is+ meeting visitor expectations and whether your site provides a good user experience.+ </p>- return (- <div className={`p-4 rounded-lg border ${colorClasses[perf.color as keyof typeof colorClasses]}`}>- <p className="text-sm">- <strong>{perf.label}!</strong> {- perf.label === "Excellent" ? `Your bounce rate is well below the ${industry.toLowerCase()} average of ${benchmark.average}%. You're doing great at keeping visitors engaged!` :- perf.label === "Good" ? `Your bounce rate is close to the ${industry.toLowerCase()} average of ${benchmark.average}%. There's room for improvement.` :- perf.label === "Needs Improvement" ? `Your bounce rate is above the ${industry.toLowerCase()} average of ${benchmark.average}%. Consider improving page load speed, content quality, or user experience.` :- `Your bounce rate is significantly higher than the ${industry.toLowerCase()} average of ${benchmark.average}%. Focus on improving content relevance, page speed, and user experience.`- }- </p>- </div>- );- })()}- </div>- )}+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-6 mt-8">Why Does Bounce Rate Matter?</h2>+ <ul className="space-y-4 text-neutral-700 dark:text-neutral-300 mb-8">+ <li>+ <strong>Indicator of Content Relevance:</strong> A high bounce rate often indicates that your landing page+ content doesn't match what visitors expect based on the link they clicked or search query they used. This+ mismatch can signal a need to improve your messaging, headlines, or targeting.+ </li>+ <li>+ <strong>User Experience Signal:</strong> Visitors who bounce quickly may be experiencing poor user experience+ factors like slow page load times, confusing navigation, intrusive pop-ups, or mobile responsiveness issues.+ Monitoring bounce rate helps you identify these problems.+ </li>+ <li>+ <strong>Conversion Opportunity:</strong> Reducing bounce rate means more visitors stay on your site longer and+ have the opportunity to convert into customers, subscribers, or leads. Even small improvements in bounce rate+ can significantly impact your bottom line.+ </li>+ <li>+ <strong>Marketing Effectiveness:</strong> Bounce rates by traffic source (paid ads, email, organic search)+ reveal which marketing channels are driving quality traffic. High bounce rates from specific sources may+ indicate wasted ad spend or poor targeting.+ </li>+ </ul>- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-6 mt-8">Bounce Rate Formula</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ <code>Bounce Rate = (Bounced Sessions / Total Sessions) × 100</code>+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ To calculate your bounce rate manually, divide the number of sessions where visitors viewed only one page by your+ total number of sessions, then multiply by 100 to get a percentage.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-8">+ <strong>Example:</strong> If your website had 10,000 total sessions last month and 4,500 of those were single-page+ sessions (bounces), your bounce rate would be (4,500 / 10,000) × 100 = 45%.+ </p>- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding Bounce Rate</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is bounce rate?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Bounce rate is the percentage of visitors who leave your website after viewing only one page without any interaction. A high bounce rate might indicate that your landing pages aren't relevant to visitors or your site has usability issues.- </AccordionContent>- </AccordionItem>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-6 mt-8">+ What's a Good Bounce Rate by Industry?+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-6 leading-relaxed">+ Bounce rates vary significantly by industry, page type, and traffic source. Here are typical benchmarks to help+ you understand how your site compares:+ </p>+ <ul className="space-y-4 text-neutral-700 dark:text-neutral-300 mb-8">+ <li>+ <strong>E-commerce - Excellent: 20-30% | Good: 30-45% | Needs Work: 45-70%:</strong> E-commerce sites benefit+ from engaged shoppers exploring multiple products. Lower bounce rates indicate successful product discovery.+ </li>+ <li>+ <strong>Blog/Content - Excellent: 40-50% | Good: 50-65% | Needs Work: 65-90%:</strong> Blogs naturally have+ higher bounce rates since visitors often arrive for specific articles and leave once they've finished reading.+ </li>+ <li>+ <strong>SaaS/Software - Excellent: 10-25% | Good: 25-35% | Needs Work: 35-60%:</strong> SaaS sites should have+ very low bounce rates. High rates indicate unclear value proposition or poor onboarding experience.+ </li>+ <li>+ <strong>Landing Pages - Excellent: 60-70% | Good: 70-75% | Needs Work: 75-90%:</strong> Landing pages are+ designed for a single action, so higher bounce rates are normal and often expected.+ </li>+ <li>+ <strong>Lead Generation - Excellent: 30-40% | Good: 40-50% | Needs Work: 50-70%:</strong> Lead generation sites+ need visitors to complete forms or take action. Good rates mean effective persuasion and targeting.+ </li>+ <li>+ <strong>News/Media - Excellent: 40-50% | Good: 50-60% | Needs Work: 60-80%:</strong> News sites see high bounce+ rates because readers often come for specific articles via search or social media.+ </li>+ </ul>- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What's a good bounce rate?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A "good" bounce rate varies by industry and page type. E-commerce sites typically aim for 20-45%, while blogs may see 65-90% and still be healthy. Landing pages naturally have higher bounce rates (60-90%) since they're designed for a single action.- </AccordionContent>- </AccordionItem>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-6 mt-8">How to Reduce Your Bounce Rate</h2>+ <ol className="space-y-4 text-neutral-700 dark:text-neutral-300">+ <li>+ <strong>Improve Page Load Speed:</strong> Slow-loading pages are one of the top reasons visitors bounce.+ Optimize images, leverage browser caching, minify CSS/JavaScript, and use a content delivery network (CDN) to+ ensure pages load in under 3 seconds.+ </li>+ <li>+ <strong>Ensure Mobile Responsiveness:</strong> More than half of web traffic is now mobile. Make sure your site+ is responsive and provides an excellent experience on smartphones and tablets. Test on real devices to identify+ usability issues.+ </li>+ <li>+ <strong>Create Compelling Content:</strong> Write for your audience with clear headlines, engaging+ introductions, and valuable information. Use subheadings, bullet points, and images to break up text. Ensure+ your content matches the search intent of visitors.+ </li>+ <li>+ <strong>Add Clear Calls-to-Action:</strong> Tell visitors what to do next. Use prominent, action-oriented+ buttons and clear instructions. Make it easy for interested visitors to take the next step, whether that's+ signing up, purchasing, or contacting you.+ </li>+ <li>+ <strong>Implement Internal Linking:</strong> Link to related content within your site. This gives visitors a+ reason to stay and explore more pages. Well-placed internal links improve both user engagement and SEO+ performance.+ </li>+ <li>+ <strong>Remove Distracting Elements:</strong> Reduce intrusive pop-ups, auto-playing videos, and excessive ads+ that frustrate visitors. If you must use pop-ups, make them easy to close and wait for visitors to show interest+ before displaying them.+ </li>+ </ol>+ </>+);- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How can I reduce my bounce rate?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- To reduce bounce rate: improve page load speed, ensure mobile responsiveness, create compelling content, add clear calls-to-action, use internal linking, improve content readability, and ensure your pages match visitor intent. Track your improvements with{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to see what works.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>+const faqs = [+ {+ question: "What is bounce rate?",+ answer:+ "Bounce rate is the percentage of visitors who leave your website after viewing only one page without any interaction. A high bounce rate might indicate that your landing pages aren't relevant to visitors or your site has usability issues.",+ },+ {+ question: "What's a good bounce rate?",+ answer:+ "A good bounce rate varies by industry and page type. E-commerce sites typically aim for 20-45%, while blogs may see 65-90% and still be healthy. Landing pages naturally have higher bounce rates (60-90%) since they're designed for a single action.",+ },+ {+ question: "How can I reduce my bounce rate?",+ answer:+ "To reduce bounce rate: improve page load speed, ensure mobile responsiveness, create compelling content, add clear calls-to-action, use internal linking, improve content readability, and ensure your pages match visitor intent.",+ },+ {+ question: "Does bounce rate affect SEO?",+ answer:+ "While bounce rate isn't a direct Google ranking factor, it can indirectly impact SEO. A high bounce rate suggests poor user experience or irrelevant content, which can lead to lower engagement signals. Google may interpret this as lower quality, potentially affecting your rankings over time.",+ },+ {+ question: "Why is bounce rate different in different tools?",+ answer:+ "Different analytics tools may calculate bounce rate differently based on how they track sessions, handle direct traffic, and count interactions. Some tools exclude certain traffic sources or implement different session timeouts. Always use the same tool consistently for accurate comparisons.",+ },+];- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track bounce rate in real-time with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- Monitor bounce rate by page, source, and device. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "bounce_rate_calculator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+export default function BounceRateCalculatorPage() {+ return (+ <ToolPageLayout+ toolSlug="bounce-rate-calculator"+ title="Bounce Rate Calculator"+ description="Calculate your website's bounce rate and compare it to industry benchmarks. See how well you're keeping visitors engaged."+ badge="Free Tool"+ toolComponent={<BounceRateForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Track bounce rate in real-time with Rybbit"+ ctaDescription="Monitor bounce rate by page, source, and device."+ ctaEventLocation="bounce_rate_calculator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/components/ToolCTA.tsx b/docs/src/app/(home)/tools/components/ToolCTA.tsxnew file mode 100644index 000000000..28e69144c--- /dev/null+++ b/docs/src/app/(home)/tools/components/ToolCTA.tsx@@ -0,0 +1,38 @@+import { TrackedButton } from "@/components/TrackedButton";+import { DEFAULT_EVENT_LIMIT } from "@/lib/const";++interface ToolCTAProps {+ title: string;+ description: string;+ eventLocation: string;+ buttonText?: string;+}++export function ToolCTA({+ title,+ description,+ eventLocation,+ buttonText = "Start tracking for free"+}: ToolCTAProps) {+ return (+ <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">+ <div className="max-w-4xl mx-auto px-6 text-center">+ <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">+ {title}+ </h2>+ <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">+ {description} Get started for free with up to{" "}+ {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.+ </p>+ <TrackedButton+ href="https://app.rybbit.io/signup"+ eventName="signup"+ eventProps={{ location: eventLocation }}+ className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"+ >+ {buttonText}+ </TrackedButton>+ </div>+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/components/ToolPageLayout.tsx b/docs/src/app/(home)/tools/components/ToolPageLayout.tsxnew file mode 100644index 000000000..1a9225df9--- /dev/null+++ b/docs/src/app/(home)/tools/components/ToolPageLayout.tsx@@ -0,0 +1,126 @@+import { ReactNode } from "react";+import { Breadcrumbs } from "@/components/Breadcrumbs";+import { RelatedTools } from "@/components/RelatedTools";+import { ToolCTA } from "./ToolCTA";+import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";++export interface FAQItem {+ question: string;+ answer: ReactNode;+}++export interface ToolPageLayoutProps {+ // Required sections+ toolSlug: string;+ title: string;+ description: string;+ badge?: string; // e.g., "AI-Powered Tool", "Free Tool"+ toolComponent: ReactNode;+ educationalContent: ReactNode;+ faqs: FAQItem[];+ relatedToolsCategory: "seo" | "analytics" | "privacy";++ // CTA section+ ctaTitle: string;+ ctaDescription: string;+ ctaEventLocation: string;+ ctaButtonText?: string;++ // Optional metadata for structured data (passed through)+ structuredData?: object;+}++export function ToolPageLayout({+ toolSlug,+ title,+ description,+ badge = "Free Tool",+ toolComponent,+ educationalContent,+ faqs,+ relatedToolsCategory,+ ctaTitle,+ ctaDescription,+ ctaEventLocation,+ ctaButtonText,+ structuredData,+}: ToolPageLayoutProps) {+ return (+ <>+ {structuredData && (+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }} />+ )}++ <div className="min-h-screen">+ <div className="max-w-4xl mx-auto px-6 py-20">+ <Breadcrumbs+ items={[+ { label: "Home", href: "/" },+ { label: "Tools", href: "/tools" },+ { label: title },+ ]}+ />++ {/* 1. Header */}+ <div className="mb-16">+ <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">+ <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">{badge}</span>+ </div>+ <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">+ {title}+ </h1>+ <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">+ {description}+ </p>+ </div>++ {/* 2. The Actual Tool */}+ <div className="mb-16">+ {toolComponent}+ </div>++ {/* 3. Educational Content */}+ <div className="mb-16 prose prose-neutral dark:prose-invert max-w-none">+ {educationalContent}+ </div>++ {/* 4. FAQ Section */}+ <div className="mb-16">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">+ Frequently Asked Questions+ </h2>+ <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">+ <Accordion type="single" collapsible className="w-full">+ {faqs.map((faq, index) => (+ <AccordionItem+ key={index}+ value={`item-${index}`}+ className={index < faqs.length - 1 ? "border-b border-neutral-300/50 dark:border-neutral-800/50" : ""}+ >+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ {faq.question}+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ {faq.answer}+ </AccordionContent>+ </AccordionItem>+ ))}+ </Accordion>+ </div>+ </div>++ {/* 5. Related Tools */}+ <RelatedTools currentToolHref={`/tools/${toolSlug}`} category={relatedToolsCategory} />+ </div>++ {/* 6. CTA */}+ <ToolCTA+ title={ctaTitle}+ description={ctaDescription}+ eventLocation={ctaEventLocation}+ buttonText={ctaButtonText}+ />+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/components/index.ts b/docs/src/app/(home)/tools/components/index.tsnew file mode 100644index 000000000..be33d1151--- /dev/null+++ b/docs/src/app/(home)/tools/components/index.ts@@ -0,0 +1,3 @@+export { ToolCTA } from "./ToolCTA";+export { ToolPageLayout } from "./ToolPageLayout";+export type { ToolPageLayoutProps, FAQItem } from "./ToolPageLayout";diff --git a/docs/src/app/(home)/tools/ctr-calculator/CTRCalculatorForm.tsx b/docs/src/app/(home)/tools/ctr-calculator/CTRCalculatorForm.tsxnew file mode 100644index 000000000..d5ecc41e2--- /dev/null+++ b/docs/src/app/(home)/tools/ctr-calculator/CTRCalculatorForm.tsx@@ -0,0 +1,158 @@+"use client";++import { useState } from "react";++const industryBenchmarks: Record<string, number> = {+ "Search Ads": 3.17,+ "Display Ads": 0.46,+ "Social Media": 0.90,+ "Email Marketing": 2.6,+ "E-commerce": 2.69,+ "B2B": 2.41,+ "Other": 2.0,+};++export function CTRCalculatorForm() {+ const [impressions, setImpressions] = useState("");+ const [clicks, setClicks] = useState("");+ const [industry, setIndustry] = useState("Search Ads");++ const calculateCTR = () => {+ const imp = parseFloat(impressions);+ const clk = parseFloat(clicks);+ if (!imp || !clk || imp === 0) return null;+ return (clk / imp) * 100;+ };++ const ctr = calculateCTR();+ const benchmark = industryBenchmarks[industry];++ const clearForm = () => {+ setImpressions("");+ setClicks("");+ setIndustry("Search Ads");+ };++ return (+ <>+ {/* Tool Section */}+ <div className="mb-16">+ <div className="space-y-6">+ {/* Impressions */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Total Impressions <span className="text-red-500">*</span>+ </label>+ <input+ type="number"+ value={impressions}+ onChange={e => setImpressions(e.target.value)}+ placeholder="10000"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">How many times your ad was shown</p>+ </div>++ {/* Clicks */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Total Clicks <span className="text-red-500">*</span>+ </label>+ <input+ type="number"+ value={clicks}+ onChange={e => setClicks(e.target.value)}+ placeholder="300"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">How many clicks your ad received</p>+ </div>++ {/* Industry */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Industry / Channel</label>+ <select+ value={industry}+ onChange={e => setIndustry(e.target.value)}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"+ >+ {Object.keys(industryBenchmarks).map(ind => (+ <option key={ind} value={ind}>+ {ind}+ </option>+ ))}+ </select>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Select your industry to compare with benchmarks+ </p>+ </div>++ {/* Results */}+ {ctr !== null && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Your CTR</label>+ <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">+ <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">{ctr.toFixed(2)}%</div>+ </div>+ </div>++ <div className="grid grid-cols-2 gap-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ {industry} Benchmark+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-2xl font-bold text-neutral-900 dark:text-white">{benchmark.toFixed(2)}%</div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ vs. Benchmark+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div+ className={`text-2xl font-bold ${+ ctr >= benchmark+ ? "text-emerald-600 dark:text-emerald-400"+ : "text-orange-600 dark:text-orange-400"+ }`}+ >+ {ctr >= benchmark ? "+" : ""}+ {((ctr - benchmark) / benchmark * 100).toFixed(1)}%+ </div>+ </div>+ </div>+ </div>++ <div className="p-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">+ <p className="text-sm text-blue-900 dark:text-blue-200">+ {ctr >= benchmark ? (+ <>+ <strong>Great job!</strong> Your CTR is {((ctr - benchmark) / benchmark * 100).toFixed(1)}% higher than the {industry.toLowerCase()} benchmark.+ </>+ ) : (+ <>+ <strong>Room for improvement.</strong> Your CTR is {Math.abs((ctr - benchmark) / benchmark * 100).toFixed(1)}% below the {industry.toLowerCase()} benchmark. Consider improving your ad copy, targeting, or creative.+ </>+ )}+ </p>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/ctr-calculator/page.tsx b/docs/src/app/(home)/tools/ctr-calculator/page.tsxindex fcf9ac1ba..9cb0d911b 100644--- a/docs/src/app/(home)/tools/ctr-calculator/page.tsx+++ b/docs/src/app/(home)/tools/ctr-calculator/page.tsx@@ -1,237 +1,297 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";+import { CTRCalculatorForm } from "./CTRCalculatorForm";+import { ToolPageLayout } from "../components/ToolPageLayout";import Link from "next/link";-import { useState } from "react";+import type { Metadata } from "next";-const industryBenchmarks: Record<string, number> = {- "Search Ads": 3.17,- "Display Ads": 0.46,- "Social Media": 0.90,- "Email Marketing": 2.6,- "E-commerce": 2.69,- "B2B": 2.41,- "Other": 2.0,+export const metadata: Metadata = {+ title: "Free CTR Calculator | Click-Through Rate Calculator for Marketing",+ description:+ "Calculate your click-through rate (CTR) and compare it to industry benchmarks. Free CTR calculator for email, PPC, organic search, and social media campaigns. Learn CTR formulas, industry standards, and how to improve your CTR.",+ openGraph: {+ title: "Free CTR Calculator | Click-Through Rate Calculator for Marketing",+ description:+ "Calculate your CTR and see how your campaigns compare to industry benchmarks across email, PPC, organic search, and social media.",+ type: "website",+ url: "https://rybbit.com/tools/ctr-calculator",+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free CTR Calculator | Click-Through Rate Calculator for Marketing",+ description:+ "Calculate your CTR and compare to industry benchmarks. Understand what's a good click-through rate for your channel.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/ctr-calculator",+ },};-export default function CTRCalculatorPage() {- const [impressions, setImpressions] = useState("");- const [clicks, setClicks] = useState("");- const [industry, setIndustry] = useState("Search Ads");-- const calculateCTR = () => {- const imp = parseFloat(impressions);- const clk = parseFloat(clicks);- if (!imp || !clk || imp === 0) return null;- return (clk / imp) * 100;- };-- const ctr = calculateCTR();- const benchmark = industryBenchmarks[industry];-- const clearForm = () => {- setImpressions("");- setClicks("");- setIndustry("Search Ads");- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- CTR Calculator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Calculate your click-through rate and compare it to industry benchmarks. See how your campaigns perform against the competition.- </p>- </div>+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ "@id": "https://rybbit.com/tools/ctr-calculator#webapp",+ name: "CTR Calculator",+ description: "Free tool to calculate click-through rate and compare with industry benchmarks",+ url: "https://rybbit.com/tools/ctr-calculator",+ applicationCategory: "Utility",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ "@id": "https://rybbit.com/tools/ctr-calculator#faqpage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is CTR (Click-Through Rate)?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "CTR is the percentage of people who click on your ad or link after seeing it. It's calculated by dividing the number of clicks by the number of impressions and multiplying by 100. For example, if your ad was shown 10,000 times and received 300 clicks, your CTR is 3%.",+ },+ },+ {+ "@type": "Question",+ name: "What is a good CTR by channel?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Average CTRs vary significantly by channel. Search ads average 3.17%, email marketing 2.6%, e-commerce 2.69%, B2B 2.41%, social media 0.90%, and display ads 0.46%. Your target CTR should be benchmarked against your specific channel and industry.",+ },+ },+ {+ "@type": "Question",+ name: "How do I calculate CTR?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "To calculate CTR, use this formula: CTR = (Clicks / Impressions) × 100. For example, if your ad received 500 clicks from 50,000 impressions, your CTR would be (500 / 50,000) × 100 = 1%. Use our CTR calculator above to compute this automatically.",+ },+ },+ {+ "@type": "Question",+ name: "How can I improve my CTR?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "To improve CTR: write compelling ad copy with clear value propositions, use strong calls-to-action, improve audience targeting, test different headlines and creatives, ensure ad relevance to search intent, add ad extensions, and improve landing page relevance. Monitor results to identify what works best.",+ },+ },+ {+ "@type": "Question",+ name: "Why is my CTR different from competitor benchmarks?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "CTR varies based on industry, product type, audience quality, ad positioning, seasonal factors, and competition. Your CTR may legitimately differ from benchmarks due to your unique market position, business model, or targeting strategy. Focus on improving your own CTR over time rather than exactly matching benchmarks.",+ },+ },+ ],+ },+ ],+};- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Impressions */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Total Impressions <span className="text-red-500">*</span>- </label>- <input- type="number"- value={impressions}- onChange={e => setImpressions(e.target.value)}- placeholder="10000"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">How many times your ad was shown</p>- </div>+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What is CTR (Click-Through Rate)?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Click-Through Rate (CTR) is a key digital marketing metric that measures the percentage of people who click on+ your ad, email link, or search result after viewing it. It's one of the most important indicators of how well your+ marketing content resonates with your audience.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ CTR is calculated by dividing the total number of clicks by the total number of impressions (times your content+ was shown) and multiplying by 100 to get a percentage. For example, if your ad was shown 10,000 times and received+ 300 clicks, your CTR would be 3%.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Unlike vanity metrics that only measure visibility, CTR shows actual engagement—it tells you not just how many+ people saw your content, but how many were interested enough to take action.+ </p>- {/* Clicks */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Total Clicks <span className="text-red-500">*</span>- </label>- <input- type="number"- value={clicks}- onChange={e => setClicks(e.target.value)}- placeholder="300"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">How many clicks your ad received</p>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Why Does CTR Matter?</h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Measure Marketing Effectiveness:</strong> CTR is a direct indicator of how well your ad copy, creative,+ and messaging are working. A higher CTR means your audience finds your message compelling and relevant, which is+ the first step toward conversions.+ </li>+ <li>+ <strong>Improve Campaign ROI:</strong> Higher CTRs mean more qualified traffic to your website or landing pages.+ More clicks lead to more conversion opportunities, which directly impacts your return on investment (ROI) for+ paid campaigns.+ </li>+ <li>+ <strong>Quality Score Impact:</strong> In Google Ads, CTR significantly impacts your Quality Score, which+ affects your ad rank and cost-per-click (CPC). Higher CTR can lead to better ad positions at lower costs,+ creating a positive feedback loop.+ </li>+ <li>+ <strong>Channel Performance Comparison:</strong> CTR allows you to compare performance across different+ marketing channels—email, PPC, organic search, social media—on a level playing field. This helps you identify+ which channels are most effective for your audience.+ </li>+ </ul>- {/* Industry */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Industry / Channel</label>- <select- value={industry}- onChange={e => setIndustry(e.target.value)}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"- >- {Object.keys(industryBenchmarks).map(ind => (- <option key={ind} value={ind}>- {ind}- </option>- ))}- </select>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Select your industry to compare with benchmarks- </p>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">CTR Formula</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-2">+ <code className="text-sm font-mono">CTR = (Clicks / Impressions) × 100</code>+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ To calculate your CTR manually, divide the number of clicks by your total number of impressions, then multiply by+ 100 to express it as a percentage.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 mb-2">+ <strong>Example:</strong>+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Impressions: 50,000</li>+ <li>Clicks: 1,500</li>+ <li>CTR = (1,500 / 50,000) × 100 = 3%</li>+ </ul>- {/* Results */}- {ctr !== null && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Your CTR</label>- <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">- <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">{ctr.toFixed(2)}%</div>- </div>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ CTR Industry Benchmarks by Channel+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ CTR varies significantly by marketing channel, industry, and audience type. Here are typical CTR benchmarks to+ help you understand what's good for your channel:+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Search Ads (Google Ads) - 3.17%:</strong> Search ads have the highest average CTR because users actively+ searched for keywords related to your business.+ </li>+ <li>+ <strong>Email Marketing - 2.6%:</strong> Email marketing performs well because subscribers have opted in and are+ receptive to your messages.+ </li>+ <li>+ <strong>E-commerce - 2.69%:</strong> E-commerce sites typically see good CTRs, especially for retargeting and+ product-specific campaigns.+ </li>+ <li>+ <strong>B2B - 2.41%:</strong> B2B campaigns see solid CTRs due to intent-based targeting and niche audiences.+ </li>+ <li>+ <strong>Social Media Ads - 0.90%:</strong> Social media ads have lower CTRs due to less commercial intent and+ higher audience distraction.+ </li>+ <li>+ <strong>Display Ads - 0.46%:</strong> Display ads have the lowest CTR because users didn't specifically search+ for your product or service.+ </li>+ </ul>- <div className="grid grid-cols-2 gap-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- {industry} Benchmark- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-2xl font-bold text-neutral-900 dark:text-white">{benchmark.toFixed(2)}%</div>- </div>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Improve Your CTR</h2>- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- vs. Benchmark- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div- className={`text-2xl font-bold ${- ctr >= benchmark- ? "text-emerald-600 dark:text-emerald-400"- : "text-orange-600 dark:text-orange-400"- }`}- >- {ctr >= benchmark ? "+" : ""}- {((ctr - benchmark) / benchmark * 100).toFixed(1)}%- </div>- </div>- </div>- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Optimize Ad Copy</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Use clear, concise headlines that include relevant keywords</li>+ <li>Emphasize unique value propositions and differentiators</li>+ <li>Include numbers, statistics, or specific benefits</li>+ <li>Create urgency with words like "limited time," "exclusive," or "today"</li>+ </ul>- <div className="p-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">- <p className="text-sm text-blue-900 dark:text-blue-200">- {ctr >= benchmark ? (- <>- <strong>Great job!</strong> Your CTR is {((ctr - benchmark) / benchmark * 100).toFixed(1)}% higher than the {industry.toLowerCase()} benchmark.- </>- ) : (- <>- <strong>Room for improvement.</strong> Your CTR is {Math.abs((ctr - benchmark) / benchmark * 100).toFixed(1)}% below the {industry.toLowerCase()} benchmark. Consider improving your ad copy, targeting, or creative.- </>- )}- </p>- </div>- </div>- )}+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Strong Calls-to-Action (CTAs)</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Use action-oriented verbs: "Get," "Discover," "Learn," "Start"</li>+ <li>Make CTAs stand out visually with contrasting colors and clear buttons</li>+ <li>Test different CTA variations to find what resonates</li>+ <li>Be specific about what happens when they click</li>+ </ul>- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Improve Audience Targeting</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Use detailed audience segmentation based on demographics, interests, and behavior</li>+ <li>Create separate ads for different audience segments</li>+ <li>Use lookalike audiences to find similar users to your best customers</li>+ <li>Exclude irrelevant audiences to improve ad relevance</li>+ </ul>- {/* FAQ Section */}- <div className="mb-12">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding CTR</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is CTR (Click-Through Rate)?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- CTR is the percentage of people who click on your ad or link after seeing it. It's calculated by dividing the number of clicks by the number of impressions and multiplying by 100. For example, if your ad was shown 10,000 times and received 300 clicks, your CTR is 3%.- </AccordionContent>- </AccordionItem>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">A/B Testing</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Test one variable at a time: headlines, images, CTAs, landing pages</li>+ <li>Run tests long enough to gather statistically significant data</li>+ <li>Implement winning variations and test new elements</li>+ <li>Document learnings to continuously improve performance</li>+ </ul>- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is a good CTR?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A "good" CTR varies by industry and channel. Generally, search ads average around 3.17%, display ads around 0.46%, and social media ads around 0.90%. Email marketing typically sees higher CTRs around 2.6%. Compare your results to industry benchmarks to gauge performance.- </AccordionContent>- </AccordionItem>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Ad Extensions (Google Ads)</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Add sitelink extensions to showcase multiple offers or pages</li>+ <li>Use callout extensions to highlight unique benefits</li>+ <li>Include structured snippets for product categories or features</li>+ <li>Add call extensions to encourage phone inquiries</li>+ </ul>- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How can I improve my CTR?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- To improve CTR, focus on: writing compelling ad copy with clear value propositions, using strong calls-to-action, targeting the right audience, testing different creatives and headlines, ensuring ad relevance to search intent, and using ad extensions (for search ads). Track your results with{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to see what works best.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Landing Page Optimization</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Ensure landing pages match ad messaging and keywords (ad relevance)</li>+ <li>Load fast and display properly on mobile devices</li>+ <li>Include clear, persuasive headlines that match the ad</li>+ <li>Remove distractions and focus on a single conversion goal</li>+ </ul>+ </>+);- </div>+const faqs = [+ {+ question: "What is CTR (Click-Through Rate)?",+ answer:+ "CTR is the percentage of people who click on your ad or link after seeing it. It's calculated by dividing the number of clicks by the number of impressions and multiplying by 100. For example, if your ad was shown 10,000 times and received 300 clicks, your CTR is 3%.",+ },+ {+ question: "What is a good CTR?",+ answer:+ 'A "good" CTR varies by industry and channel. Search ads average 3.17%, email marketing 2.6%, e-commerce 2.69%, B2B 2.41%, social media 0.90%, and display ads 0.46%. Use the benchmarks above to compare your performance, but also track your own improvement over time.',+ },+ {+ question: "How can I improve my CTR?",+ answer: (+ <>+ To improve CTR, focus on: writing compelling ad copy with clear value propositions, using strong+ calls-to-action, targeting the right audience, testing different creatives and headlines, ensuring ad relevance+ to search intent, and using ad extensions. Track your results with{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to see what works best.+ </>+ ),+ },+ {+ question: "Does a higher CTR always mean better campaign performance?",+ answer:+ "Not necessarily. While CTR measures clicks, your ultimate goal is conversions and ROI. A high CTR means people are interested, but if they don't convert, it may indicate issues with your landing page, offer, or funnel. Always track CTR alongside conversion rate and ROI.",+ },+ {+ question: "How do I reduce my CTR if it's too high?",+ answer:+ "If your CTR is high but conversions are low, it may be time to adjust your targeting to attract more qualified users or improve your landing page to convert more of your traffic. A very high CTR can also indicate low quality clicks or click fraud—monitor your campaign closely for suspicious patterns.",+ },+];- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track your campaign performance with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- Monitor CTR, conversions, and other key metrics in real-time. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "ctr_calculator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+export default function CTRCalculatorPage() {+ return (+ <ToolPageLayout+ toolSlug="ctr-calculator"+ title="CTR Calculator"+ description="Calculate your click-through rate and compare it to industry benchmarks. See how your campaigns perform against the competition."+ badge="Free Tool"+ toolComponent={<CTRCalculatorForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Track your campaign performance with Rybbit"+ ctaDescription="Monitor CTR, conversions, and other key metrics in real-time."+ ctaEventLocation="ctr_calculator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/funnel-visualizer/FunnelVisualizerForm.tsx b/docs/src/app/(home)/tools/funnel-visualizer/FunnelVisualizerForm.tsxnew file mode 100644index 000000000..492e19be3--- /dev/null+++ b/docs/src/app/(home)/tools/funnel-visualizer/FunnelVisualizerForm.tsx@@ -0,0 +1,230 @@+"use client";++import { Plus, X } from "lucide-react";+import { useState } from "react";+import { round } from "lodash";++interface FunnelStep {+ name: string;+ visitors: string;+}++interface FunnelChartData {+ stepName: string;+ visitors: number;+ conversionRate: number;+ dropoffRate: number;+ stepNumber: number;+}++export function FunnelVisualizerForm() {+ const [steps, setSteps] = useState<FunnelStep[]>([+ { name: "Landing Page", visitors: "" },+ { name: "Product Page", visitors: "" },+ { name: "Cart", visitors: "" },+ { name: "Checkout", visitors: "" },+ { name: "Purchase", visitors: "" },+ ]);++ const addStep = () => {+ setSteps([...steps, { name: "", visitors: "" }]);+ };++ const removeStep = (index: number) => {+ if (steps.length > 2) {+ setSteps(steps.filter((_, i) => i !== index));+ }+ };++ const updateStep = (index: number, field: "name" | "visitors", value: string) => {+ const newSteps = [...steps];+ newSteps[index][field] = value;+ setSteps(newSteps);+ };++ const calculateFunnelData = (): FunnelChartData[] | null => {+ const validSteps = steps.filter(s => s.name && s.visitors && parseFloat(s.visitors) > 0);+ if (validSteps.length < 2) return null;++ const firstStepVisitors = parseFloat(validSteps[0].visitors);++ return validSteps.map((step, index) => {+ const visitors = parseFloat(step.visitors);+ const conversionRate = (visitors / firstStepVisitors) * 100;+ const prevVisitors = index > 0 ? parseFloat(validSteps[index - 1].visitors) : visitors;+ const dropoffRate = index > 0 ? ((prevVisitors - visitors) / prevVisitors) * 100 : 0;++ return {+ stepName: step.name,+ visitors,+ conversionRate,+ dropoffRate,+ stepNumber: index + 1,+ };+ });+ };++ const chartData = calculateFunnelData();+ const firstStep = chartData?.[0];++ const clearForm = () => {+ setSteps([+ { name: "Landing Page", visitors: "" },+ { name: "Product Page", visitors: "" },+ { name: "Cart", visitors: "" },+ { name: "Checkout", visitors: "" },+ { name: "Purchase", visitors: "" },+ ]);+ };++ return (+ <div className="space-y-6">+ <div className="space-y-4">+ {steps.map((step, index) => (+ <div key={index} className="flex gap-3 items-start">+ <div className="flex-shrink-0 w-8 h-10 flex items-center justify-center">+ <div className="w-6 h-6 rounded-full bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 flex items-center justify-center text-xs font-medium text-emerald-700 dark:text-emerald-400">+ {index + 1}+ </div>+ </div>+ <div className="flex-1 grid grid-cols-2 gap-3">+ <input+ type="text"+ value={step.name}+ onChange={e => updateStep(index, "name", e.target.value)}+ placeholder={`Step ${index + 1} name`}+ className="px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <input+ type="number"+ value={step.visitors}+ onChange={e => updateStep(index, "visitors", e.target.value)}+ placeholder="Visitors"+ className="px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>+ {steps.length > 2 && (+ <button+ onClick={() => removeStep(index)}+ className="flex-shrink-0 w-10 h-10 flex items-center justify-center text-neutral-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg transition-colors"+ >+ <X className="w-5 h-5" />+ </button>+ )}+ </div>+ ))}+ </div>++ <button+ onClick={addStep}+ className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-emerald-600 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-950/30 rounded-lg transition-colors"+ >+ <Plus className="w-4 h-4" />+ Add Step+ </button>++ {/* Funnel Visualization */}+ {chartData && chartData.length > 0 && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">+ <div className="space-y-0">+ {chartData.map((step, index) => {+ const maxBarWidth = 100;+ const ratio = firstStep?.visitors ? step.visitors / firstStep.visitors : 0;+ const barWidth = Math.max(ratio * maxBarWidth, 0);+ const prevStep = index > 0 ? chartData[index - 1] : null;+ const droppedFromPrevious = prevStep ? prevStep.visitors - step.visitors : 0;++ return (+ <div key={step.stepNumber} className="relative pb-4">+ {/* Step Header */}+ <div className="flex items-center p-2">+ <div className="flex-shrink-0 w-6 h-6 rounded-full bg-neutral-100 dark:bg-neutral-800 flex items-center justify-center text-xs mr-2">+ {step.stepNumber}+ </div>+ <div className="font-medium text-sm flex-1">{step.stepName}</div>+ </div>++ {/* Bar and metrics */}+ <div className="flex items-center pl-8">+ {/* Metrics */}+ <div className="flex-shrink-0 min-w-[130px] mr-4 space-y-1">+ <div className="flex items-baseline">+ <span className="text-base font-semibold">{step.visitors.toLocaleString()}</span>+ <span className="text-sm text-neutral-500 dark:text-neutral-400 ml-1">visitors</span>+ </div>+ {index !== 0 && (+ <div className="flex items-baseline text-orange-500 text-xs font-medium">+ {droppedFromPrevious.toLocaleString()} dropped+ </div>+ )}+ </div>++ {/* Bar */}+ <div className="flex-grow h-10 bg-neutral-100 dark:bg-neutral-800 rounded-md overflow-hidden relative mt-2">+ {/* Relative conversion bar (from previous step) */}+ {index > 0 && prevStep && (+ <div+ className="absolute h-full rounded-md"+ style={{+ width: `${(step.visitors / prevStep.visitors) * 100}%`,+ background: `repeating-linear-gradient(+ 45deg,+ rgba(16, 185, 129, 0.25),+ rgba(16, 185, 129, 0.25) 6px,+ rgba(16, 185, 129, 0.15) 6px,+ rgba(16, 185, 129, 0.15) 12px+ )`,+ }}+ ></div>+ )}+ {/* Absolute conversion bar (from first step) */}+ <div+ className="h-full bg-emerald-500/70 rounded-md relative z-10"+ style={{ width: `${barWidth}%` }}+ ></div>+ <div className="absolute top-2 right-2 z-20">+ <div className="text-base font-semibold">{round(step.conversionRate, 2)}%</div>+ </div>+ </div>+ </div>+ </div>+ );+ })}+ </div>++ <div className="flex items-center gap-4 mt-6 ml-4 text-xs text-neutral-500 dark:text-neutral-400">+ <div className="flex items-center">+ <div className="w-3 h-3 bg-emerald-500/70 rounded-sm mr-1"></div>+ <span>Overall conversion</span>+ </div>+ <div className="flex items-center">+ <div+ className="w-3 h-3 rounded-sm mr-1"+ style={{+ background: `repeating-linear-gradient(+ 45deg,+ rgba(16, 185, 129, 0.25),+ rgba(16, 185, 129, 0.25) 3px,+ rgba(16, 185, 129, 0.15) 3px,+ rgba(16, 185, 129, 0.15) 6px+ )`,+ }}+ ></div>+ <span>Conversion from previous step</span>+ </div>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/funnel-visualizer/page.tsx b/docs/src/app/(home)/tools/funnel-visualizer/page.tsxindex 50d77c8bc..160624f82 100644--- a/docs/src/app/(home)/tools/funnel-visualizer/page.tsx+++ b/docs/src/app/(home)/tools/funnel-visualizer/page.tsx@@ -1,323 +1,273 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { round } from "lodash";-import { Plus, X } from "lucide-react";+import { FunnelVisualizerForm } from "./FunnelVisualizerForm";+import { ToolPageLayout } from "../components/ToolPageLayout";import Link from "next/link";-import { useState } from "react";+import type { Metadata } from "next";-interface FunnelStep {- name: string;- visitors: string;-}+export const metadata: Metadata = {+ title: "Free Funnel Visualizer | Marketing Funnel Analysis & Conversion Funnel Tool",+ description:+ "Visualize your conversion funnel step-by-step. Input visitor counts at each stage to identify where you're losing customers. Analyze drop-off rates and optimize your funnel for better conversions.",+ openGraph: {+ title: "Free Funnel Visualizer | Marketing Funnel Analysis & Conversion Funnel Tool",+ description:+ "Visualize your conversion funnel step-by-step. Identify drop-off points and optimize conversion rates.",+ type: "website",+ url: "https://rybbit.com/tools/funnel-visualizer",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Funnel Visualizer | Marketing Funnel Analysis & Conversion Funnel Tool",+ description:+ "Visualize your conversion funnel step-by-step. Identify drop-off points and optimize conversion rates.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/funnel-visualizer",+ },+};-interface FunnelChartData {- stepName: string;- visitors: number;- conversionRate: number;- dropoffRate: number;- stepNumber: number;-}+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Funnel Visualizer",+ description: "Free tool to visualize conversion funnels and analyze drop-off rates at each step",+ url: "https://rybbit.com/tools/funnel-visualizer",+ applicationCategory: "BusinessApplication",+ featureList: [+ "Step-by-step funnel visualization",+ "Conversion rate analysis",+ "Drop-off rate tracking",+ "Customizable funnel stages",+ "Real-time calculations",+ ],+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is a conversion funnel?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "A conversion funnel is the path visitors take from initial contact to conversion. It shows how many users progress through each step and where they drop off. Understanding your funnel helps identify friction points and optimization opportunities.",+ },+ },+ {+ "@type": "Question",+ name: "What are the typical stages in a conversion funnel?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Common funnel stages include: Awareness (landing page visits), Consideration (product/service page views), Evaluation (cart additions), Decision (checkout starts), and Conversion (purchases). However, funnels vary by business model. E-commerce might track store browsing to purchase, while SaaS might track sign-ups to trial to paid conversion.",+ },+ },+ {+ "@type": "Question",+ name: "How do I analyze funnel drop-offs?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "To analyze drop-offs: (1) Calculate the percentage drop from each step to the next, (2) Identify which steps have the largest losses, (3) Consider external factors (traffic quality, targeting, seasonality), (4) Test improvements on high-drop-off steps, (5) Compare performance over time. The steps with the biggest drop-offs typically offer the best optimization opportunities.",+ },+ },+ {+ "@type": "Question",+ name: "What is a good conversion funnel rate?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Conversion rates vary widely by industry and business model. E-commerce websites typically see 2-5% overall conversion rates, SaaS free-to-paid conversion is often 5-15%, while lead generation funnels might convert 10-30% of visitors. The key is to compare your metrics against your own baseline and industry benchmarks, then focus on improving the weakest steps.",+ },+ },+ {+ "@type": "Question",+ name: "How can I improve my conversion funnel?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Optimize high drop-off steps first by: simplifying forms and checkout processes, improving page load speed, enhancing trust signals and social proof, clarifying value propositions, reducing friction (fewer clicks), improving mobile experience, A/B testing changes, and removing distractions. Track these improvements with Rybbit Analytics to measure the actual impact on conversions.",+ },+ },+ ],+ },+ ],+};-export default function FunnelVisualizerPage() {- const [steps, setSteps] = useState<FunnelStep[]>([- { name: "Landing Page", visitors: "" },- { name: "Product Page", visitors: "" },- { name: "Cart", visitors: "" },- { name: "Checkout", visitors: "" },- { name: "Purchase", visitors: "" },- ]);+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What is a Conversion Funnel?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ A conversion funnel visualizes the customer journey from initial awareness to final conversion. Just like a+ physical funnel narrows toward the bottom, a conversion funnel shows how the number of users decreases at each+ step of your sales or signup process.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Understanding your conversion funnel is critical for business growth because it reveals where potential customers+ are dropping off. By identifying and fixing these bottlenecks, you can significantly improve your overall+ conversion rate without increasing marketing spend.+ </p>- const addStep = () => {- setSteps([...steps, { name: "", visitors: "" }]);- };+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Why Funnels Matter</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Reveal exactly where customers are leaving</li>+ <li>Help prioritize optimization efforts on high-impact areas</li>+ <li>Enable data-driven decision making about your funnel</li>+ <li>Track progress as you implement improvements</li>+ <li>Support ROI calculations for marketing initiatives</li>+ </ul>- const removeStep = (index: number) => {- if (steps.length > 2) {- setSteps(steps.filter((_, i) => i !== index));- }- };+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Understanding Funnel Stages</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ While funnels vary by business model, most follow a similar progression from awareness to conversion. Here are the+ common stages:+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Awareness:</strong> Users discover your brand through ads, content, or word-of-mouth. This is typically+ measured by landing page visits or impressions.+ </li>+ <li>+ <strong>Consideration:</strong> Interested users explore your product or service by viewing product pages,+ demos, or reading reviews.+ </li>+ <li>+ <strong>Evaluation:</strong> Users actively consider the purchase by adding items to cart, requesting quotes, or+ starting free trials.+ </li>+ <li>+ <strong>Decision:</strong> Users commit to action by starting checkout, completing signup forms, or requesting+ more information.+ </li>+ <li>+ <strong>Conversion:</strong> Users complete the desired action—purchase, signup, trial activation, or lead+ submission.+ </li>+ <li>+ <strong>Retention:</strong> Users continue engaging (repeat purchases, retention rate, customer lifetime value).+ </li>+ </ul>- const updateStep = (index: number, field: "name" | "visitors", value: string) => {- const newSteps = [...steps];- newSteps[index][field] = value;- setSteps(newSteps);- };+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Analyze Funnel Drop-offs</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Drop-offs occur when users don't progress to the next step. Analyzing where and why users drop off is the key to+ optimization. Here's a systematic approach:+ </p>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Calculate Drop-off Percentages:</strong> For each step, calculate what percentage of users from the+ previous step dropped off. A 50% drop from step 1 to 2 is a major red flag.+ </li>+ <li>+ <strong>Identify the Biggest Bottleneck:</strong> Focus on the step with the largest absolute drop (most users+ lost). This is usually your highest-impact optimization opportunity.+ </li>+ <li>+ <strong>Consider External Factors:</strong> Evaluate traffic quality, targeting, seasonality, device type, and+ traffic source. High drop-offs might indicate poor audience match, not a product issue.+ </li>+ <li>+ <strong>Hypothesize Root Causes:</strong> Use analytics, user testing, surveys, and session recordings to+ understand why users drop off. Is it friction, unclear messaging, trust issues, or pricing?+ </li>+ <li>+ <strong>Test Improvements:</strong> Implement targeted fixes (form simplification, page speed improvements,+ clearer CTAs) and measure the impact on your funnel conversion rate.+ </li>+ </ol>- const calculateFunnelData = (): FunnelChartData[] | null => {- const validSteps = steps.filter(s => s.name && s.visitors && parseFloat(s.visitors) > 0);- if (validSteps.length < 2) return null;+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Funnel Optimization Strategies</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Once you've identified drop-off points, here are proven strategies to improve each stage of your funnel:+ </p>- const firstStepVisitors = parseFloat(validSteps[0].visitors);+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Awareness Stage</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Target high-intent keywords and audiences</li>+ <li>Improve ad creative and messaging relevance</li>+ <li>Ensure traffic sources align with audience quality</li>+ <li>Test different channel mix</li>+ </ul>- return validSteps.map((step, index) => {- const visitors = parseFloat(step.visitors);- const conversionRate = (visitors / firstStepVisitors) * 100;- const prevVisitors = index > 0 ? parseFloat(validSteps[index - 1].visitors) : visitors;- const dropoffRate = index > 0 ? ((prevVisitors - visitors) / prevVisitors) * 100 : 0;+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Consideration Stage</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Improve page load speed</li>+ <li>Clarify value proposition above the fold</li>+ <li>Add product images, videos, and demos</li>+ <li>Include social proof and testimonials</li>+ </ul>- return {- stepName: step.name,- visitors,- conversionRate,- dropoffRate,- stepNumber: index + 1,- };- });- };+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Evaluation Stage</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Make pricing transparent and competitive</li>+ <li>Add comparison tables and ROI calculators</li>+ <li>Offer risk-free trials or guarantees</li>+ <li>Provide detailed feature documentation</li>+ </ul>- const chartData = calculateFunnelData();- const firstStep = chartData?.[0];- const lastStep = chartData?.[chartData.length - 1];- const totalConversionRate = lastStep?.conversionRate || 0;+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Decision Stage</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Simplify checkout (fewer form fields)</li>+ <li>Show security badges and trust signals</li>+ <li>Offer multiple payment options</li>+ <li>Reduce required steps to purchase</li>+ </ul>+ </>+);- const clearForm = () => {- setSteps([- { name: "Landing Page", visitors: "" },- { name: "Product Page", visitors: "" },- { name: "Cart", visitors: "" },- { name: "Checkout", visitors: "" },- { name: "Purchase", visitors: "" },- ]);- };+const faqs = [+ {+ question: "What is a conversion funnel?",+ answer:+ "A conversion funnel is the path visitors take from initial contact to conversion. It shows how many users progress through each step and where they drop off. Understanding your funnel helps identify friction points and optimization opportunities.",+ },+ {+ question: "What are the typical stages in a conversion funnel?",+ answer:+ "Common funnel stages include: Awareness (landing page visits), Consideration (product/service page views), Evaluation (cart additions), Decision (checkout starts), and Conversion (purchases). However, funnels vary by business model. E-commerce might track store browsing to purchase, while SaaS might track sign-ups to trial to paid conversion.",+ },+ {+ question: "How do I analyze funnel drop-offs?",+ answer:+ "To analyze drop-offs: (1) Calculate the percentage drop from each step to the next, (2) Identify which steps have the largest losses, (3) Consider external factors (traffic quality, targeting, seasonality), (4) Test improvements on high-drop-off steps, (5) Compare performance over time. The steps with the biggest drop-offs typically offer the best optimization opportunities.",+ },+ {+ question: "What is a good conversion funnel rate?",+ answer:+ "Conversion rates vary widely by industry and business model. E-commerce websites typically see 2-5% overall conversion rates, SaaS free-to-paid conversion is often 5-15%, while lead generation funnels might convert 10-30% of visitors. The key is to compare your metrics against your own baseline and industry benchmarks, then focus on improving the weakest steps.",+ },+ {+ question: "How can I improve my conversion funnel?",+ answer: (+ <>+ Optimize high drop-off steps first by: simplifying forms and checkout processes, improving page load speed,+ enhancing trust signals and social proof, clarifying value propositions, reducing friction (fewer clicks),+ improving mobile experience, A/B testing changes, and removing distractions. Track these improvements with{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to measure the actual impact on conversions.+ </>+ ),+ },+];+export default function FunnelVisualizerPage() {return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-5xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Funnel Visualizer- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Visualize your conversion funnel step-by-step. Input visitor counts at each stage and see where you're- losing customers.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- <div className="space-y-4">- {steps.map((step, index) => (- <div key={index} className="flex gap-3 items-start">- <div className="flex-shrink-0 w-8 h-10 flex items-center justify-center">- <div className="w-6 h-6 rounded-full bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 flex items-center justify-center text-xs font-medium text-emerald-700 dark:text-emerald-400">- {index + 1}- </div>- </div>- <div className="flex-1 grid grid-cols-2 gap-3">- <input- type="text"- value={step.name}- onChange={e => updateStep(index, "name", e.target.value)}- placeholder={`Step ${index + 1} name`}- className="px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <input- type="number"- value={step.visitors}- onChange={e => updateStep(index, "visitors", e.target.value)}- placeholder="Visitors"- className="px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>- {steps.length > 2 && (- <button- onClick={() => removeStep(index)}- className="flex-shrink-0 w-10 h-10 flex items-center justify-center text-neutral-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg transition-colors"- >- <X className="w-5 h-5" />- </button>- )}- </div>- ))}- </div>-- <button- onClick={addStep}- className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-emerald-600 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-950/30 rounded-lg transition-colors"- >- <Plus className="w-4 h-4" />- Add Step- </button>-- {/* Funnel Visualization */}- {chartData && chartData.length > 0 && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">- <div className="space-y-0">- {chartData.map((step, index) => {- const maxBarWidth = 100;- const ratio = firstStep?.visitors ? step.visitors / firstStep.visitors : 0;- const barWidth = Math.max(ratio * maxBarWidth, 0);- const prevStep = index > 0 ? chartData[index - 1] : null;- const droppedFromPrevious = prevStep ? prevStep.visitors - step.visitors : 0;-- return (- <div key={step.stepNumber} className="relative pb-4">- {/* Step Header */}- <div className="flex items-center p-2">- <div className="flex-shrink-0 w-6 h-6 rounded-full bg-neutral-100 dark:bg-neutral-800 flex items-center justify-center text-xs mr-2">- {step.stepNumber}- </div>- <div className="font-medium text-sm flex-1">{step.stepName}</div>- </div>-- {/* Bar and metrics */}- <div className="flex items-center pl-8">- {/* Metrics */}- <div className="flex-shrink-0 min-w-[130px] mr-4 space-y-1">- <div className="flex items-baseline">- <span className="text-base font-semibold">{step.visitors.toLocaleString()}</span>- <span className="text-sm text-neutral-500 dark:text-neutral-400 ml-1">visitors</span>- </div>- {index !== 0 && (- <div className="flex items-baseline text-orange-500 text-xs font-medium">- {droppedFromPrevious.toLocaleString()} dropped- </div>- )}- </div>-- {/* Bar */}- <div className="flex-grow h-10 bg-neutral-100 dark:bg-neutral-800 rounded-md overflow-hidden relative mt-2">- {/* Relative conversion bar (from previous step) */}- {index > 0 && prevStep && (- <div- className="absolute h-full rounded-md"- style={{- width: `${(step.visitors / prevStep.visitors) * 100}%`,- background: `repeating-linear-gradient(- 45deg,- rgba(16, 185, 129, 0.25),- rgba(16, 185, 129, 0.25) 6px,- rgba(16, 185, 129, 0.15) 6px,- rgba(16, 185, 129, 0.15) 12px- )`,- }}- ></div>- )}- {/* Absolute conversion bar (from first step) */}- <div- className="h-full bg-emerald-500/70 rounded-md relative z-10"- style={{ width: `${barWidth}%` }}- ></div>- <div className="absolute top-2 right-2 z-20">- <div className="text-base font-semibold">{round(step.conversionRate, 2)}%</div>- </div>- </div>- </div>- </div>- );- })}- </div>-- <div className="flex items-center gap-4 mt-6 ml-4 text-xs text-neutral-500 dark:text-neutral-400">- <div className="flex items-center">- <div className="w-3 h-3 bg-emerald-500/70 rounded-sm mr-1"></div>- <span>Overall conversion</span>- </div>- <div className="flex items-center">- <div- className="w-3 h-3 rounded-sm mr-1"- style={{- background: `repeating-linear-gradient(- 45deg,- rgba(16, 185, 129, 0.25),- rgba(16, 185, 129, 0.25) 3px,- rgba(16, 185, 129, 0.15) 3px,- rgba(16, 185, 129, 0.15) 6px- )`,- }}- ></div>- <span>Conversion from previous step</span>- </div>- </div>- </div>- )}-- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding Conversion Funnels</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is a conversion funnel?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A conversion funnel is the path visitors take from initial contact to conversion. It shows how many- users progress through each step and where they drop off. Understanding your funnel helps identify- friction points and optimization opportunities.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What's a good funnel conversion rate?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- It varies by industry, but e-commerce funnels typically see 2-3% overall conversion rates. SaaS free- trial funnels might see 10-20% conversion to paid. The key is identifying your biggest drop-off points- and improving those steps first—even small improvements compound.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How do I improve my funnel?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Focus on the steps with the biggest drop-offs. Common improvements include: simplifying forms,- improving page load speed, adding trust signals, clarifying value propositions, reducing friction, and- A/B testing changes. Track your funnels automatically with{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to measure impact.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track funnels automatically with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- No manual data entry—Rybbit automatically tracks conversion funnels with real-time session data. Get started- for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "funnel_visualizer_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="funnel-visualizer"+ title="Funnel Visualizer"+ description="Visualize your conversion funnel step-by-step. Input visitor counts at each stage and see where you're losing customers. Analyze drop-off rates and identify optimization opportunities."+ badge="Free Tool"+ toolComponent={<FunnelVisualizerForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Track funnels automatically with Rybbit"+ ctaDescription="No manual data entry—Rybbit automatically tracks conversion funnels with real-time session data."+ ctaEventLocation="funnel_visualizer_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/marketing-roi-calculator/MarketingROIForm.tsx b/docs/src/app/(home)/tools/marketing-roi-calculator/MarketingROIForm.tsxnew file mode 100644index 000000000..96ec0455d--- /dev/null+++ b/docs/src/app/(home)/tools/marketing-roi-calculator/MarketingROIForm.tsx@@ -0,0 +1,211 @@+"use client";++import { useState } from "react";++export interface Metrics {+ profit: number;+ roi: number;+ roas: number;+ profitMargin: number;+}++export function MarketingROIForm() {+ const [adSpend, setAdSpend] = useState("");+ const [revenue, setRevenue] = useState("");+ const [costOfGoodsSold, setCostOfGoodsSold] = useState("");++ const calculateMetrics = (): Metrics | null => {+ const spend = parseFloat(adSpend);+ const rev = parseFloat(revenue);+ const cogs = parseFloat(costOfGoodsSold) || 0;++ if (!spend || !rev || spend === 0) return null;++ const profit = rev - spend - cogs;+ const roi = (profit / spend) * 100;+ const roas = rev / spend;+ const profitMargin = (profit / rev) * 100;++ return { profit, roi, roas, profitMargin };+ };++ const metrics = calculateMetrics();++ const clearForm = () => {+ setAdSpend("");+ setRevenue("");+ setCostOfGoodsSold("");+ };++ return (+ <div className="space-y-6">+ {/* Ad Spend */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Ad Spend <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>+ <input+ type="number"+ value={adSpend}+ onChange={e => setAdSpend(e.target.value)}+ placeholder="5000"+ className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total amount spent on advertising</p>+ </div>++ {/* Revenue */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Revenue Generated <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>+ <input+ type="number"+ value={revenue}+ onChange={e => setRevenue(e.target.value)}+ placeholder="15000"+ className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total revenue from the campaign</p>+ </div>++ {/* Cost of Goods Sold */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Cost of Goods Sold (Optional)+ </label>+ <div className="relative">+ <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>+ <input+ type="number"+ value={costOfGoodsSold}+ onChange={e => setCostOfGoodsSold(e.target.value)}+ placeholder="3000"+ className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Direct costs of products sold (leave blank if not applicable)+ </p>+ </div>++ {/* Results */}+ {metrics && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">+ {/* ROI */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ ROI (Return on Investment)+ </label>+ <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">+ <div+ className={`text-4xl font-bold ${+ metrics.roi >= 0+ ? "text-emerald-600 dark:text-emerald-400"+ : "text-red-600 dark:text-red-400"+ }`}+ >+ {metrics.roi >= 0 ? "+" : ""}+ {metrics.roi.toFixed(1)}%+ </div>+ </div>+ </div>++ {/* ROAS */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ ROAS (Return on Ad Spend)+ </label>+ <div className="px-4 py-6 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">+ <div className="text-4xl font-bold text-blue-600 dark:text-blue-400">+ {metrics.roas.toFixed(2)}x+ </div>+ </div>+ </div>++ {/* Profit */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Net Profit+ </label>+ <div className="px-4 py-6 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div+ className={`text-3xl font-bold ${+ metrics.profit >= 0+ ? "text-emerald-600 dark:text-emerald-400"+ : "text-red-600 dark:text-red-400"+ }`}+ >+ {metrics.profit >= 0 ? "+" : "-"}${Math.abs(metrics.profit).toLocaleString()}+ </div>+ </div>+ </div>++ {/* Profit Margin */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Profit Margin+ </label>+ <div className="px-4 py-6 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-3xl font-bold text-neutral-900 dark:text-white">+ {metrics.profitMargin.toFixed(1)}%+ </div>+ </div>+ </div>+ </div>++ <div+ className={`p-4 rounded-lg border ${+ metrics.roi >= 100+ ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900"+ : metrics.roi >= 0+ ? "bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-900"+ : "bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-900"+ }`}+ >+ <p+ className={`text-sm ${+ metrics.roi >= 100+ ? "text-emerald-900 dark:text-emerald-200"+ : metrics.roi >= 0+ ? "text-blue-900 dark:text-blue-200"+ : "text-red-900 dark:text-red-200"+ }`}+ >+ {metrics.roi >= 100 ? (+ <>+ <strong>Excellent ROI!</strong> You're generating ${metrics.roas.toFixed(2)} in revenue for every $1 spent. Your campaign is highly profitable.+ </>+ ) : metrics.roi >= 0 ? (+ <>+ <strong>Positive ROI.</strong> You're making a profit, but there may be room for optimization to improve returns.+ </>+ ) : (+ <>+ <strong>Negative ROI.</strong> Your campaign is losing money. Consider reviewing your targeting, creative, or product-market fit.+ </>+ )}+ </p>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsx b/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsxindex dceb712a8..b65e78b9f 100644--- a/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsx+++ b/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsx@@ -1,288 +1,337 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";+import { MarketingROIForm } from "./MarketingROIForm";+import { ToolPageLayout } from "../components/ToolPageLayout";import Link from "next/link";-import { useState } from "react";--export default function MarketingROICalculatorPage() {- const [adSpend, setAdSpend] = useState("");- const [revenue, setRevenue] = useState("");- const [costOfGoodsSold, setCostOfGoodsSold] = useState("");-- const calculateMetrics = () => {- const spend = parseFloat(adSpend);- const rev = parseFloat(revenue);- const cogs = parseFloat(costOfGoodsSold) || 0;-- if (!spend || !rev || spend === 0) return null;-- const profit = rev - spend - cogs;- const roi = (profit / spend) * 100;- const roas = rev / spend;- const profitMargin = (profit / rev) * 100;-- return { profit, roi, roas, profitMargin };- };-- const metrics = calculateMetrics();-- const clearForm = () => {- setAdSpend("");- setRevenue("");- setCostOfGoodsSold("");- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Marketing ROI Calculator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Calculate ROI, ROAS, and profit margins for your marketing campaigns. Make data-driven decisions about your ad spend.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Ad Spend */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Ad Spend <span className="text-red-500">*</span>- </label>- <div className="relative">- <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>- <input- type="number"- value={adSpend}- onChange={e => setAdSpend(e.target.value)}- placeholder="5000"- className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total amount spent on advertising</p>- </div>+import type { Metadata } from "next";- {/* Revenue */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Revenue Generated <span className="text-red-500">*</span>- </label>- <div className="relative">- <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>- <input- type="number"- value={revenue}- onChange={e => setRevenue(e.target.value)}- placeholder="15000"- className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total revenue from the campaign</p>- </div>+export const metadata: Metadata = {+ title: "Free Marketing ROI Calculator | Calculate Return on Investment & ROAS",+ description:+ "Calculate your marketing ROI, ROAS, profit margins, and net profit. Get instant insights into your campaign performance and make data-driven decisions.",+ openGraph: {+ title: "Free Marketing ROI Calculator | Calculate Return on Investment & ROAS",+ description: "Calculate your marketing ROI, ROAS, profit margins, and net profit instantly.",+ type: "website",+ url: "https://rybbit.com/tools/marketing-roi-calculator",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Marketing ROI Calculator | Calculate Return on Investment & ROAS",+ description: "Calculate your marketing ROI, ROAS, profit margins, and net profit instantly.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/marketing-roi-calculator",+ },+};- {/* Cost of Goods Sold */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Cost of Goods Sold (Optional)- </label>- <div className="relative">- <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>- <input- type="number"- value={costOfGoodsSold}- onChange={e => setCostOfGoodsSold(e.target.value)}- placeholder="3000"- className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Direct costs of products sold (leave blank if not applicable)- </p>- </div>+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Marketing ROI Calculator",+ description: "Calculate ROI, ROAS, profit margins, and net profit for your marketing campaigns",+ url: "https://rybbit.com/tools/marketing-roi-calculator",+ applicationCategory: "BusinessApplication",+ featureList: [+ "ROI Calculation",+ "ROAS Calculation",+ "Profit Margin Analysis",+ "Net Profit Calculation",+ "Real-time Results",+ ],+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is ROI vs ROAS?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "ROI (Return on Investment) measures your profit as a percentage of your investment, calculated as (Revenue - Cost) / Cost × 100. ROAS (Return on Ad Spend) measures revenue per dollar spent on advertising, calculated as Revenue / Ad Spend. ROI focuses on profitability, while ROAS focuses on revenue efficiency.",+ },+ },+ {+ "@type": "Question",+ name: "What is a good marketing ROI?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "A good marketing ROI varies by industry, but generally, a 5:1 ratio (500% ROI) is considered strong, meaning you earn $5 for every $1 spent. The average marketing ROI across industries is around 100-200%. For ROAS, 4:1 or higher is typically considered good, though this depends on your profit margins and business model.",+ },+ },+ {+ "@type": "Question",+ name: "How do I calculate ROI?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "ROI is calculated using the formula: (Net Profit / Cost) × 100 = ROI%. For marketing campaigns, this means: (Revenue - Ad Spend - COGS) / Ad Spend × 100. This gives you the percentage return on every dollar invested in advertising.",+ },+ },+ {+ "@type": "Question",+ name: "What timeframe should I measure marketing ROI?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "The ideal timeframe depends on your business model and sales cycle. For e-commerce and digital products, weekly or monthly analysis is common. For B2B with longer sales cycles, quarterly or annual ROI measurements may be more appropriate. Always account for attribution windows and customer lifetime value when analyzing ROI.",+ },+ },+ {+ "@type": "Question",+ name: "How can I improve my marketing ROI?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "To improve ROI: optimize targeting to reach high-intent audiences, improve conversion rates, reduce customer acquisition costs, test different ad creatives and messaging, focus budget on top-performing channels, implement A/B testing, track metrics accurately, and continuously optimize based on data. Using analytics tools helps identify which campaigns generate the best returns.",+ },+ },+ ],+ },+ ],+};- {/* Results */}- {metrics && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">- {/* ROI */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- ROI (Return on Investment)- </label>- <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">- <div- className={`text-4xl font-bold ${- metrics.roi >= 0- ? "text-emerald-600 dark:text-emerald-400"- : "text-red-600 dark:text-red-400"- }`}- >- {metrics.roi >= 0 ? "+" : ""}- {metrics.roi.toFixed(1)}%- </div>- </div>- </div>+const educationalContent = (+ <>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4">Understanding ROI vs ROAS</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-6">+ When measuring marketing performance, two key metrics stand out: ROI (Return on Investment) and ROAS (Return on Ad+ Spend). While they sound similar, they measure different aspects of campaign success.+ </p>+ <ul className="space-y-4 text-neutral-700 dark:text-neutral-300">+ <li>+ <strong>ROI (Return on Investment):</strong> Measures profit as a percentage of your investment. Formula:{" "}+ <code>(Revenue - Cost) / Cost × 100</code>. A 200% ROI means you earn $2 in profit for every $1 spent. Focuses+ on profitability and bottom-line impact.+ </li>+ <li>+ <strong>ROAS (Return on Ad Spend):</strong> Measures revenue generated per dollar of ad spend. Formula:{" "}+ <code>Revenue / Ad Spend</code>. A 4:1 ROAS means you generate $4 in revenue for every $1 spent on ads. Focuses+ on revenue generation efficiency.+ </li>+ </ul>- {/* ROAS */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- ROAS (Return on Ad Spend)- </label>- <div className="px-4 py-6 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">- <div className="text-4xl font-bold text-blue-600 dark:text-blue-400">- {metrics.roas.toFixed(2)}x- </div>- </div>- </div>-- {/* Profit */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Net Profit- </label>- <div className="px-4 py-6 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div- className={`text-3xl font-bold ${- metrics.profit >= 0- ? "text-emerald-600 dark:text-emerald-400"- : "text-red-600 dark:text-red-400"- }`}- >- {metrics.profit >= 0 ? "+" : "-"}${Math.abs(metrics.profit).toLocaleString()}- </div>- </div>- </div>-- {/* Profit Margin */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Profit Margin- </label>- <div className="px-4 py-6 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-3xl font-bold text-neutral-900 dark:text-white">- {metrics.profitMargin.toFixed(1)}%- </div>- </div>- </div>- </div>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Why Marketing ROI Matters</h2>+ <div className="space-y-4 text-neutral-700 dark:text-neutral-300">+ <p>Tracking marketing ROI is essential for sustainable business growth. It helps you:</p>+ <ul className="space-y-3 mt-4">+ <li className="flex gap-3">+ <span className="text-emerald-600 dark:text-emerald-400 font-bold">•</span>+ <span>+ <strong>Justify marketing budgets</strong> to stakeholders with clear financial metrics+ </span>+ </li>+ <li className="flex gap-3">+ <span className="text-emerald-600 dark:text-emerald-400 font-bold">•</span>+ <span>+ <strong>Identify top-performing channels</strong> and allocate budget accordingly+ </span>+ </li>+ <li className="flex gap-3">+ <span className="text-emerald-600 dark:text-emerald-400 font-bold">•</span>+ <span>+ <strong>Reduce wasted ad spend</strong> on underperforming campaigns+ </span>+ </li>+ <li className="flex gap-3">+ <span className="text-emerald-600 dark:text-emerald-400 font-bold">•</span>+ <span>+ <strong>Optimize customer acquisition costs</strong> across your marketing mix+ </span>+ </li>+ <li className="flex gap-3">+ <span className="text-emerald-600 dark:text-emerald-400 font-bold">•</span>+ <span>+ <strong>Make data-driven decisions</strong> about marketing strategy and tactics+ </span>+ </li>+ </ul>+ </div>- <div- className={`p-4 rounded-lg border ${- metrics.roi >= 100- ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900"- : metrics.roi >= 0- ? "bg-blue-50 dark:bg-blue-950/30 border-blue-200 dark:border-blue-900"- : "bg-red-50 dark:bg-red-950/30 border-red-200 dark:border-red-900"- }`}- >- <p- className={`text-sm ${- metrics.roi >= 100- ? "text-emerald-900 dark:text-emerald-200"- : metrics.roi >= 0- ? "text-blue-900 dark:text-blue-200"- : "text-red-900 dark:text-red-200"- }`}- >- {metrics.roi >= 100 ? (- <>- <strong>Excellent ROI!</strong> You're generating ${metrics.roas.toFixed(2)} in revenue for every $1 spent. Your campaign is highly profitable.- </>- ) : metrics.roi >= 0 ? (- <>- <strong>Positive ROI.</strong> You're making a profit, but there may be room for optimization to improve returns.- </>- ) : (- <>- <strong>Negative ROI.</strong> Your campaign is losing money. Consider reviewing your targeting, creative, or product-market fit.- </>- )}- </p>- </div>- </div>- )}+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Marketing ROI Formulas</h2>+ <ul className="space-y-3 text-neutral-700 dark:text-neutral-300 mb-4">+ <li>+ <strong>Basic ROI Formula:</strong> <code>ROI = (Net Profit / Investment) × 100</code>+ </li>+ <li>+ <strong>Marketing ROI Formula:</strong> <code>ROI = (Revenue - Ad Spend - COGS) / Ad Spend × 100</code>+ </li>+ <li>+ <strong>ROAS Formula:</strong> <code>ROAS = Total Revenue / Ad Spend</code>+ </li>+ <li>+ <strong>Profit Margin Formula:</strong> <code>Profit Margin = (Net Profit / Revenue) × 100</code>+ </li>+ </ul>+ <p className="text-sm text-neutral-600 dark:text-neutral-400">+ Use our calculator above to apply these formulas instantly. All calculations are performed in real-time as you+ enter your numbers.+ </p>- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Industry Benchmarks</h2>+ <div className="space-y-4 text-neutral-700 dark:text-neutral-300">+ <p>+ Marketing ROI varies significantly by industry, business model, and campaign type. Here are general benchmarks+ to help you evaluate your performance:+ </p>+ <div className="overflow-x-auto mt-6">+ <table className="w-full text-sm border-collapse">+ <thead>+ <tr className="bg-neutral-200 dark:bg-neutral-700">+ <th className="border border-neutral-300 dark:border-neutral-600 p-3 text-left font-semibold">+ Industry+ </th>+ <th className="border border-neutral-300 dark:border-neutral-600 p-3 text-left font-semibold">+ Average ROI+ </th>+ <th className="border border-neutral-300 dark:border-neutral-600 p-3 text-left font-semibold">+ Good ROAS+ </th>+ </tr>+ </thead>+ <tbody>+ <tr className="bg-neutral-50 dark:bg-neutral-800/50">+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">E-commerce</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">100-200%</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">3:1 to 5:1</td>+ </tr>+ <tr>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">SaaS</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">200-400%</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">5:1 to 10:1</td>+ </tr>+ <tr className="bg-neutral-50 dark:bg-neutral-800/50">+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">B2B Services</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">150-300%</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">3:1 to 6:1</td>+ </tr>+ <tr>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">Lead Generation</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">200-500%</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">4:1 to 8:1</td>+ </tr>+ <tr className="bg-neutral-50 dark:bg-neutral-800/50">+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">Digital Services</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">250-400%</td>+ <td className="border border-neutral-300 dark:border-neutral-600 p-3">5:1 to 10:1</td>+ </tr>+ </tbody>+ </table>+ </div>+ <p className="text-sm italic">+ Note: These benchmarks are based on industry averages and can vary significantly based on business model,+ market, and campaign optimization.+ </p>+ </div>- {/* FAQ Section */}- <div className="mb-12">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding Marketing ROI</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is ROI vs ROAS?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- ROI (Return on Investment) measures your profit as a percentage of your investment, calculated as (Revenue - Cost) / Cost × 100. ROAS (Return on Ad Spend) measures revenue per dollar spent on advertising, calculated as Revenue / Ad Spend. ROI focuses on profitability, while ROAS focuses on revenue efficiency.- </AccordionContent>- </AccordionItem>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Marketing ROI Best Practices</h2>+ <ol className="space-y-3 text-neutral-700 dark:text-neutral-300">+ <li>+ <strong>Track All Costs Accurately:</strong> Include ad spend, platform fees, creative production, and overhead+ costs to calculate true ROI.+ </li>+ <li>+ <strong>Define Attribution Windows:</strong> Establish clear timeframes for tracking conversions based on your+ sales cycle and customer behavior.+ </li>+ <li>+ <strong>Segment by Channel and Campaign:</strong> Track ROI separately for different channels, campaigns, and+ customer segments to identify winners.+ </li>+ <li>+ <strong>Account for Customer Lifetime Value:</strong> Consider repeat purchases and long-term customer value+ when evaluating campaign ROI.+ </li>+ <li>+ <strong>Test and Optimize Continuously:</strong> Run A/B tests, analyze performance data, and iterate on+ top-performing elements.+ </li>+ <li>+ <strong>Review Monthly and Adjust:</strong> Monitor ROI trends over time and reallocate budget to+ high-performing campaigns.+ </li>+ </ol>- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is a good marketing ROI?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A good marketing ROI varies by industry, but generally, a 5:1 ratio (500% ROI) is considered strong, meaning you earn $5 for every $1 spent. The average marketing ROI across industries is around 100-200%. For ROAS, 4:1 or higher is typically considered good, though this depends on your profit margins and business model.- </AccordionContent>- </AccordionItem>+ <h2 className="text-3xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Improve Your Marketing ROI</h2>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Acquisition Side</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Improve targeting accuracy and audience segmentation</li>+ <li>Optimize ad copy and creative performance</li>+ <li>Reduce customer acquisition cost (CAC)</li>+ <li>Test different channels and tactics</li>+ <li>Implement attribution tracking</li>+ <li>Focus on high-intent audiences</li>+ </ul>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Conversion Side</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-4">+ <li>Improve website conversion rates</li>+ <li>Optimize landing pages for campaigns</li>+ <li>Streamline checkout and purchase process</li>+ <li>Improve product-market fit</li>+ <li>Increase average order value</li>+ <li>Maximize customer retention</li>+ </ul>+ <p className="text-sm text-neutral-600 dark:text-neutral-400 mt-4">+ The most effective approach combines optimization on both sides: reducing costs to acquire customers while+ increasing the revenue they generate.+ </p>+ </>+);- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How can I improve my marketing ROI?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- To improve ROI, focus on: targeting high-intent audiences, optimizing conversion rates, reducing customer acquisition costs, improving ad creative and messaging, A/B testing campaigns, focusing on high-performing channels, and tracking performance with analytics. Use{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to identify which campaigns and channels drive the best returns.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>+const faqs = [+ {+ question: "What is ROI vs ROAS?",+ answer:+ "ROI (Return on Investment) measures your profit as a percentage of your investment, calculated as (Revenue - Cost) / Cost × 100. ROAS (Return on Ad Spend) measures revenue per dollar spent on advertising, calculated as Revenue / Ad Spend. ROI focuses on profitability, while ROAS focuses on revenue efficiency.",+ },+ {+ question: "What is a good marketing ROI?",+ answer:+ "A good marketing ROI varies by industry, but generally, a 5:1 ratio (500% ROI) is considered strong, meaning you earn $5 for every $1 spent. The average marketing ROI across industries is around 100-200%. For ROAS, 4:1 or higher is typically considered good, though this depends on your profit margins and business model.",+ },+ {+ question: "How do I calculate ROI?",+ answer:+ "ROI is calculated using the formula: (Net Profit / Cost) × 100 = ROI%. For marketing campaigns, this means: (Revenue - Ad Spend - COGS) / Ad Spend × 100. This gives you the percentage return on every dollar invested in advertising. Use our calculator above to compute this automatically.",+ },+ {+ question: "What timeframe should I measure marketing ROI?",+ answer:+ "The ideal timeframe depends on your business model and sales cycle. For e-commerce and digital products, weekly or monthly analysis is common. For B2B with longer sales cycles, quarterly or annual ROI measurements may be more appropriate. Always account for attribution windows and customer lifetime value when analyzing ROI.",+ },+ {+ question: "How can I improve my marketing ROI?",+ answer: (+ <>+ To improve ROI, focus on: targeting high-intent audiences, optimizing conversion rates, reducing customer+ acquisition costs, improving ad creative and messaging, A/B testing campaigns, focusing on high-performing+ channels, and tracking performance with analytics. Use{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to identify which campaigns and channels drive the best returns.+ </>+ ),+ },+];- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track your marketing ROI with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- See which campaigns generate the best ROI and optimize your marketing spend. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "roi_calculator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+export default function MarketingROICalculatorPage() {+ return (+ <ToolPageLayout+ toolSlug="marketing-roi-calculator"+ title="Marketing ROI Calculator"+ description="Calculate ROI, ROAS, and profit margins for your marketing campaigns. Make data-driven decisions about your ad spend."+ badge="Free Tool"+ toolComponent={<MarketingROIForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Track your marketing ROI with Rybbit"+ ctaDescription="See which campaigns generate the best ROI and optimize your marketing spend."+ ctaEventLocation="roi_calculator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/meta-description-generator/MetaDescriptionForm.tsx b/docs/src/app/(home)/tools/meta-description-generator/MetaDescriptionForm.tsxnew file mode 100644index 000000000..ef09d0790--- /dev/null+++ b/docs/src/app/(home)/tools/meta-description-generator/MetaDescriptionForm.tsx@@ -0,0 +1,198 @@+"use client";++import { TrackedButton } from "@/components/TrackedButton";+import { DEFAULT_EVENT_LIMIT } from "@/lib/const";+import { CheckCircle, Copy, Loader2 } from "lucide-react";+import { useState } from "react";++interface DescriptionOption {+ description: string;+ length: number;+ approach: string;+}++export function MetaDescriptionForm() {+ const [topic, setTopic] = useState("");+ const [keywords, setKeywords] = useState("");+ const [descriptions, setDescriptions] = useState<DescriptionOption[]>([]);+ const [isLoading, setIsLoading] = useState(false);+ const [error, setError] = useState("");+ const [copiedIndex, setCopiedIndex] = useState<number | null>(null);+ const [remainingRequests, setRemainingRequests] = useState<number | null>(null);++ const generateDescriptions = async () => {+ if (!topic) {+ setError("Please enter a topic");+ return;+ }++ setIsLoading(true);+ setError("");+ setDescriptions([]);++ try {+ const response = await fetch("/api/tools/generate-meta-description", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ topic, keywords: keywords || undefined }),+ });++ const remaining = response.headers.get("X-RateLimit-Remaining");+ if (remaining) setRemainingRequests(parseInt(remaining));++ if (!response.ok) {+ const data = await response.json();+ throw new Error(data.error || "Failed to generate descriptions");+ }++ const data = await response.json();+ setDescriptions(data.descriptions);+ } catch (err) {+ setError(err instanceof Error ? err.message : "An error occurred");+ } finally {+ setIsLoading(false);+ }+ };++ const copyDescription = async (description: string, index: number) => {+ await navigator.clipboard.writeText(description);+ setCopiedIndex(index);+ setTimeout(() => setCopiedIndex(null), 2000);+ };++ const getLengthColor = (length: number) => {+ if (length >= 150 && length <= 160) return "text-emerald-600 dark:text-emerald-400";+ if (length > 160 && length <= 170) return "text-orange-600 dark:text-orange-400";+ return "text-red-600 dark:text-red-400";+ };++ return (+ <>+ {remainingRequests !== null && (+ <p className="text-sm text-neutral-500 dark:text-neutral-400 mb-4">+ {remainingRequests} requests remaining this minute+ </p>+ )}++ <div className="mb-16">+ <div className="space-y-6">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Page Topic <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={topic}+ onChange={e => setTopic(e.target.value)}+ placeholder="e.g., Complete Guide to Content Marketing Strategy"+ disabled={isLoading}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Target Keywords (Optional)+ </label>+ <input+ type="text"+ value={keywords}+ onChange={e => setKeywords(e.target.value)}+ placeholder="e.g., content marketing, SEO, digital strategy"+ disabled={isLoading}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Comma-separated keywords to include+ </p>+ </div>++ {error && (+ <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">+ <p className="text-sm text-red-900 dark:text-red-200">{error}</p>+ </div>+ )}++ <button+ onClick={generateDescriptions}+ disabled={isLoading}+ className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"+ >+ {isLoading ? (+ <>+ <Loader2 className="w-5 h-5 animate-spin" />+ Generating Descriptions...+ </>+ ) : (+ "Generate Meta Descriptions"+ )}+ </button>++ {descriptions.length > 0 && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-3">+ <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">Generated Descriptions</h3>+ {descriptions.map((option, index) => (+ <div+ key={index}+ className="p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg hover:border-emerald-500/40 dark:hover:border-emerald-500/30 transition-colors"+ >+ <div className="flex items-start justify-between gap-4 mb-2">+ <p className="flex-1 text-neutral-900 dark:text-white">{option.description}</p>+ <button+ onClick={() => copyDescription(option.description, index)}+ className="flex-shrink-0 px-3 py-1.5 bg-neutral-200 dark:bg-neutral-700 hover:bg-neutral-300 dark:hover:bg-neutral-600 text-neutral-900 dark:text-white text-sm rounded-lg transition-colors flex items-center gap-2"+ >+ {copiedIndex === index ? (+ <>+ <CheckCircle className="w-4 h-4" />+ Copied+ </>+ ) : (+ <>+ <Copy className="w-4 h-4" />+ Copy+ </>+ )}+ </button>+ </div>+ <div className="flex items-center gap-4 text-xs">+ <span className={`font-medium ${getLengthColor(option.length)}`}>+ {option.length} characters+ </span>+ <span className="text-neutral-500 dark:text-neutral-400">•</span>+ <span className="text-neutral-600 dark:text-neutral-400">{option.approach}</span>+ </div>+ </div>+ ))}+ <div className="p-3 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">+ <p className="text-sm text-blue-900 dark:text-blue-200">+ <strong>Tip:</strong> Optimal meta description length is 150-160 characters. Longer descriptions may be truncated in search results.+ </p>+ </div>+ </div>+ )}+ </div>+ </div>++ {/* CTA */}+ <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20 -mx-6">+ <div className="max-w-4xl mx-auto px-6 text-center">+ <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">+ Optimize your content with Rybbit+ </h2>+ <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">+ Track which pages perform best and refine your meta descriptions based on real visitor data. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.+ </p>+ <TrackedButton+ href="https://app.rybbit.io/signup"+ eventName="signup"+ eventProps={{ location: "meta_description_generator_cta" }}+ className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"+ >+ Start tracking for free+ </TrackedButton>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/meta-description-generator/page.tsx b/docs/src/app/(home)/tools/meta-description-generator/page.tsxindex a006be064..aab497db3 100644--- a/docs/src/app/(home)/tools/meta-description-generator/page.tsx+++ b/docs/src/app/(home)/tools/meta-description-generator/page.tsx@@ -1,254 +1,270 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { CheckCircle, Copy, Loader2 } from "lucide-react";+import { Metadata } from "next";import Link from "next/link";-import { useState } from "react";--interface DescriptionOption {- description: string;- length: number;- approach: string;-}--export default function MetaDescriptionGeneratorPage() {- const [topic, setTopic] = useState("");- const [keywords, setKeywords] = useState("");- const [descriptions, setDescriptions] = useState<DescriptionOption[]>([]);- const [isLoading, setIsLoading] = useState(false);- const [error, setError] = useState("");- const [copiedIndex, setCopiedIndex] = useState<number | null>(null);- const [remainingRequests, setRemainingRequests] = useState<number | null>(null);-- const generateDescriptions = async () => {- if (!topic) {- setError("Please enter a topic");- return;- }+import { MetaDescriptionForm } from "./MetaDescriptionForm";+import { ToolPageLayout } from "../components/ToolPageLayout";- setIsLoading(true);- setError("");- setDescriptions([]);+export const metadata: Metadata = {+ title: "Free Meta Description Generator | AI-Powered Meta Tag Creator for Better CTR",+ description:+ "Generate compelling meta descriptions in seconds with our free AI tool. Get multiple variations optimized for 150-160 characters. Improve your click-through rates from search results.",+ openGraph: {+ title: "Free Meta Description Generator | AI-Powered Meta Tag Creator for Better CTR",+ description:+ "Generate compelling meta descriptions in seconds with our free AI tool. Get multiple variations optimized for 150-160 characters. Improve your click-through rates from search results.",+ type: "website",+ url: "https://rybbit.com/tools/meta-description-generator",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Meta Description Generator",+ description:+ "Generate compelling meta descriptions in seconds with our free AI tool. Get multiple variations optimized for 150-160 characters.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/meta-description-generator",+ },+};- try {- const response = await fetch("/api/tools/generate-meta-description", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ topic, keywords: keywords || undefined }),- });+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Meta Description Generator",+ description:+ "AI-powered tool to generate compelling meta descriptions for better search engine click-through rates",+ applicationCategory: "SEO Tool",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ featureList: [+ "AI-powered meta description generation",+ "Multiple description variations",+ "Character count optimization",+ "SERP snippet preview",+ "Best practices guidance",+ "Real-time optimization feedback",+ ],+ operatingSystem: "Any",+ url: "https://rybbit.com/tools/meta-description-generator",+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What makes a good meta description?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "A good meta description is 150-160 characters, accurately summarizes the page content, includes relevant keywords naturally, has a clear call-to-action, and is compelling enough to earn clicks from search results. It should match the user's search intent and preview what they'll find on the page.",+ },+ },+ {+ "@type": "Question",+ name: "Do meta descriptions affect SEO rankings?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Meta descriptions don't directly affect rankings, but they significantly impact click-through rates from search results. A compelling description can increase clicks, which can indirectly improve rankings by signaling relevance and user engagement to search engines. They're essential for on-page SEO strategy.",+ },+ },+ {+ "@type": "Question",+ name: "How can I measure meta description performance?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Track your organic click-through rates in Google Search Console and compare pages with different meta descriptions. Use analytics tools to see which pages convert best after visitors arrive from search results. Monitor changes in impressions vs. clicks to identify improvement opportunities.",+ },+ },+ {+ "@type": "Question",+ name: "Should every page have a unique meta description?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Yes, each page should have a unique meta description that accurately describes its specific content. Duplicate meta descriptions across multiple pages confuse search engines about which page is most relevant for a query and reduce click-through rates. Create custom descriptions for each important page.",+ },+ },+ {+ "@type": "Question",+ name: "What happens if I don't write a meta description?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "If you don't provide a meta description, search engines will auto-generate snippets from your page content. These auto-generated snippets are often less compelling and may not highlight the most relevant information. You'll miss the opportunity to control how your page appears in search results and optimize for clicks.",+ },+ },+ ],+ },+ ],+};- const remaining = response.headers.get("X-RateLimit-Remaining");- if (remaining) setRemainingRequests(parseInt(remaining));+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">Why Meta Descriptions Matter for SEO</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Meta descriptions are HTML snippets that summarize your page content for search engines and users. While they+ don't directly affect rankings, they're crucial for improving click-through rates from search results. A+ well-crafted meta description can be the difference between a user clicking on your result or a competitor's,+ making them essential for driving organic traffic to your website.+ </p>- if (!response.ok) {- const data = await response.json();- throw new Error(data.error || "Failed to generate descriptions");- }+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ Best Practices for Meta Descriptions+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Keep it 150-160 characters:</strong> Search engines typically display between 150-160 characters.+ Descriptions longer than this get truncated with an ellipsis, cutting off important information.+ </li>+ <li>+ <strong>Include your primary keyword:</strong> Naturally incorporate your main keyword early in the description+ to help users quickly identify relevance and improve SERP appeal.+ </li>+ <li>+ <strong>Make it compelling:</strong> Write descriptions that encourage clicks by highlighting unique value,+ benefits, or answers. Use power words, numbers, or questions when appropriate to capture attention.+ </li>+ <li>+ <strong>Match search intent:</strong> Ensure your description accurately reflects the page content and matches+ what users expect when they search for your target keyword.+ </li>+ <li>+ <strong>Include a call-to-action:</strong> Use action-oriented language like "Learn," "Discover," "Find out," or+ "Get started" to encourage clicks and engagement.+ </li>+ <li>+ <strong>Be unique for each page:</strong> Each page should have a distinct description tailored to its specific+ content, not a generic company description repeated across all pages.+ </li>+ </ul>- const data = await response.json();- setDescriptions(data.descriptions);- } catch (err) {- setError(err instanceof Error ? err.message : "An error occurred");- } finally {- setIsLoading(false);- }- };+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ Common Meta Description Mistakes to Avoid+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Keyword stuffing:</strong> Don't repeat keywords excessively. It looks spammy, reduces readability, and+ can actually lower your click-through rates as users avoid unnatural-looking results.+ </li>+ <li>+ <strong>Duplicate descriptions:</strong> Using the same description for multiple pages confuses search engines+ about which page is most relevant and wastes opportunities to optimize for different keywords.+ </li>+ <li>+ <strong>Being too vague:</strong> Vague descriptions like "Learn more about our services" don't convince users+ to click. Be specific about what value your page provides.+ </li>+ <li>+ <strong>Ignoring character limits:</strong> Descriptions that are too long get cut off, leaving your+ call-to-action or key information invisible to searchers.+ </li>+ <li>+ <strong>Not updating old descriptions:</strong> Outdated descriptions that no longer match page content hurt+ your click-through rate and user experience.+ </li>+ <li>+ <strong>Forgetting to optimize for mobile:</strong> Remember that mobile SERPs show fewer characters (around+ 120-140). Test how descriptions appear on mobile devices.+ </li>+ </ul>- const copyDescription = async (description: string, index: number) => {- await navigator.clipboard.writeText(description);- setCopiedIndex(index);- setTimeout(() => setCopiedIndex(null), 2000);- };+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">How to Use This Tool</h3>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Enter your page topic:</strong> Describe what your page is about in a few words or a short sentence. Be+ specific about the topic or subject matter.+ </li>+ <li>+ <strong>Add target keywords (optional):</strong> Include specific keywords you want to rank for and appear in+ your descriptions. Separate multiple keywords with commas.+ </li>+ <li>+ <strong>Generate descriptions:</strong> Click the button and our AI will create multiple meta description+ variations tailored to your content.+ </li>+ <li>+ <strong>Review and select:</strong> Review the generated descriptions and choose the one that best matches your+ content, target audience, and SEO goals.+ </li>+ <li>+ <strong>Implement and monitor:</strong> Add your selected description to your page's meta description tag and+ monitor performance in Google Search Console to track CTR improvements.+ </li>+ </ol>+ </>+);- const getLengthColor = (length: number) => {- if (length >= 150 && length <= 160) return "text-emerald-600 dark:text-emerald-400";- if (length > 160 && length <= 170) return "text-orange-600 dark:text-orange-400";- return "text-red-600 dark:text-red-400";- };+const faqs = [+ {+ question: "What makes a good meta description?",+ answer: (+ <>+ A good meta description is 150-160 characters, accurately summarizes the page content, includes relevant+ keywords naturally, and has a clear call-to-action. It should be compelling enough to earn clicks from search+ results and match exactly what users will find on your page.+ </>+ ),+ },+ {+ question: "Do meta descriptions affect SEO rankings?",+ answer: (+ <>+ Meta descriptions don't directly affect rankings, but they significantly impact click-through rates from search+ results. A compelling description can increase clicks, which can indirectly improve rankings by signaling+ relevance and user engagement to search engines.+ </>+ ),+ },+ {+ question: "How can I measure meta description performance?",+ answer: (+ <>+ Track your organic click-through rates in Google Search Console and compare pages with different meta+ descriptions. Use{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to see which pages convert best after visitors arrive from search and identify optimization opportunities.+ </>+ ),+ },+ {+ question: "Should every page have a unique meta description?",+ answer: (+ <>+ Yes, each page should have a unique meta description that accurately describes its specific content. Duplicate+ descriptions across multiple pages confuse search engines and reduce click-through rates. Prioritize important+ pages and create custom descriptions for each.+ </>+ ),+ },+ {+ question: "What happens if I don't write a meta description?",+ answer: (+ <>+ If you don't provide a meta description, search engines will auto-generate snippets from your page content.+ These are often less compelling and may not highlight the most relevant information. You'll miss the opportunity+ to optimize for clicks and control your SERP appearance.+ </>+ ),+ },+];+export default function MetaDescriptionGeneratorPage() {return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">AI-Powered Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Meta Description Generator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Create compelling meta descriptions that boost click-through rates. AI-powered variations optimized for search engines.- </p>- {remainingRequests !== null && (- <p className="text-sm text-neutral-500 dark:text-neutral-400 mt-4">- {remainingRequests} requests remaining this minute- </p>- )}- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Page Topic <span className="text-red-500">*</span>- </label>- <input- type="text"- value={topic}- onChange={e => setTopic(e.target.value)}- placeholder="e.g., Complete Guide to Content Marketing Strategy"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Target Keywords (Optional)- </label>- <input- type="text"- value={keywords}- onChange={e => setKeywords(e.target.value)}- placeholder="e.g., content marketing, SEO, digital strategy"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Comma-separated keywords to include- </p>- </div>-- {error && (- <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">- <p className="text-sm text-red-900 dark:text-red-200">{error}</p>- </div>- )}-- <button- onClick={generateDescriptions}- disabled={isLoading}- className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"- >- {isLoading ? (- <>- <Loader2 className="w-5 h-5 animate-spin" />- Generating Descriptions...- </>- ) : (- "Generate Meta Descriptions"- )}- </button>-- {descriptions.length > 0 && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-3">- <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">Generated Descriptions</h3>- {descriptions.map((option, index) => (- <div- key={index}- className="p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg hover:border-emerald-500/40 dark:hover:border-emerald-500/30 transition-colors"- >- <div className="flex items-start justify-between gap-4 mb-2">- <p className="flex-1 text-neutral-900 dark:text-white">{option.description}</p>- <button- onClick={() => copyDescription(option.description, index)}- className="flex-shrink-0 px-3 py-1.5 bg-neutral-200 dark:bg-neutral-700 hover:bg-neutral-300 dark:hover:bg-neutral-600 text-neutral-900 dark:text-white text-sm rounded-lg transition-colors flex items-center gap-2"- >- {copiedIndex === index ? (- <>- <CheckCircle className="w-4 h-4" />- Copied- </>- ) : (- <>- <Copy className="w-4 h-4" />- Copy- </>- )}- </button>- </div>- <div className="flex items-center gap-4 text-xs">- <span className={`font-medium ${getLengthColor(option.length)}`}>- {option.length} characters- </span>- <span className="text-neutral-500 dark:text-neutral-400">•</span>- <span className="text-neutral-600 dark:text-neutral-400">{option.approach}</span>- </div>- </div>- ))}- <div className="p-3 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">- <p className="text-sm text-blue-900 dark:text-blue-200">- <strong>Tip:</strong> Optimal meta description length is 150-160 characters. Longer descriptions may be truncated in search results.- </p>- </div>- </div>- )}- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Meta Description Best Practices</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What makes a good meta description?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A good meta description is 150-160 characters, accurately summarizes the page content, includes relevant keywords naturally, and has a clear call-to-action. It should be compelling enough to earn clicks from search results.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Do meta descriptions affect SEO rankings?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Meta descriptions don't directly affect rankings, but they significantly impact click-through rates from search results. A compelling description can increase clicks, which can indirectly improve rankings by signaling relevance to search engines.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How can I measure meta description performance?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Track your organic click-through rates in Google Search Console and compare pages with different meta descriptions. Use{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to see which pages convert best after visitors arrive from search.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Optimize your content with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- Track which pages perform best and refine your meta descriptions based on real visitor data. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "meta_description_generator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="meta-description-generator"+ title="Meta Description Generator"+ description="Generate compelling meta descriptions that boost click-through rates. AI-powered variations optimized for search engines."+ badge="AI-Powered Tool"+ toolComponent={<MetaDescriptionForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="seo"+ ctaTitle="Track your SEO performance with Rybbit"+ ctaDescription="Monitor organic traffic, track keyword rankings, and measure the impact of your meta descriptions on click-through rates."+ ctaEventLocation="meta_description_generator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/og-tag-generator/OGTagForm.tsx b/docs/src/app/(home)/tools/og-tag-generator/OGTagForm.tsxnew file mode 100644index 000000000..8fcd1f105--- /dev/null+++ b/docs/src/app/(home)/tools/og-tag-generator/OGTagForm.tsx@@ -0,0 +1,205 @@+"use client";++import { CheckCircle, Copy, Loader2 } from "lucide-react";+import { useState } from "react";++interface OGVariation {+ variation: string;+ ogTitle: string;+ ogDescription: string;+ ogType: string;+ ogImageSuggestion: string;+ twitterCard: string;+ htmlCode: string;+}++export function OGTagForm() {+ const [pageTitle, setPageTitle] = useState("");+ const [pageDescription, setPageDescription] = useState("");+ const [pageType, setPageType] = useState<"website" | "article" | "product" | "blog">("website");+ const [variations, setVariations] = useState<OGVariation[]>([]);+ const [isLoading, setIsLoading] = useState(false);+ const [error, setError] = useState("");+ const [copiedIndex, setCopiedIndex] = useState<number | null>(null);+ const [remainingRequests, setRemainingRequests] = useState<number | null>(null);++ const generateOGTags = async () => {+ if (!pageTitle || !pageDescription) {+ setError("Please fill in all required fields");+ return;+ }++ setIsLoading(true);+ setError("");+ setVariations([]);++ try {+ const response = await fetch("/api/tools/generate-og-tags", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ pageTitle, pageDescription, pageType }),+ });++ const remaining = response.headers.get("X-RateLimit-Remaining");+ if (remaining) setRemainingRequests(parseInt(remaining));++ if (!response.ok) {+ const data = await response.json();+ throw new Error(data.error || "Failed to generate OG tags");+ }++ const data = await response.json();+ setVariations(data.variations);+ } catch (err) {+ setError(err instanceof Error ? err.message : "An error occurred");+ } finally {+ setIsLoading(false);+ }+ };++ const copyCode = async (code: string, index: number) => {+ await navigator.clipboard.writeText(code);+ setCopiedIndex(index);+ setTimeout(() => setCopiedIndex(null), 2000);+ };++ return (+ <div className="space-y-6">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Page Title <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={pageTitle}+ onChange={e => setPageTitle(e.target.value)}+ placeholder="e.g., The Ultimate Guide to Web Analytics"+ disabled={isLoading}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Page Description <span className="text-red-500">*</span>+ </label>+ <textarea+ value={pageDescription}+ onChange={e => setPageDescription(e.target.value)}+ placeholder="e.g., Learn how to track website visitors, measure conversions, and grow your business with privacy-focused analytics..."+ disabled={isLoading}+ rows={4}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Page Type+ </label>+ <select+ value={pageType}+ onChange={e => setPageType(e.target.value as typeof pageType)}+ disabled={isLoading}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ >+ <option value="website">Website</option>+ <option value="article">Article</option>+ <option value="blog">Blog Post</option>+ <option value="product">Product</option>+ </select>+ </div>++ {error && (+ <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">+ <p className="text-sm text-red-900 dark:text-red-200">{error}</p>+ </div>+ )}++ {remainingRequests !== null && (+ <p className="text-sm text-neutral-500 dark:text-neutral-400">+ {remainingRequests} requests remaining this minute+ </p>+ )}++ <button+ onClick={generateOGTags}+ disabled={isLoading}+ className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"+ >+ {isLoading ? (+ <>+ <Loader2 className="w-5 h-5 animate-spin" />+ Generating OG Tags...+ </>+ ) : (+ "Generate Open Graph Tags"+ )}+ </button>++ {variations.length > 0 && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-6">+ <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">Generated Variations</h3>+ {variations.map((variation, index) => (+ <div+ key={index}+ className="p-6 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg"+ >+ <div className="flex items-center justify-between mb-4">+ <h4 className="text-lg font-semibold text-neutral-900 dark:text-white">{variation.variation}</h4>+ <button+ onClick={() => copyCode(variation.htmlCode, index)}+ className="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2"+ >+ {copiedIndex === index ? (+ <>+ <CheckCircle className="w-4 h-4" />+ Copied!+ </>+ ) : (+ <>+ <Copy className="w-4 h-4" />+ Copy HTML+ </>+ )}+ </button>+ </div>++ <div className="space-y-3 mb-4">+ <div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Title</p>+ <p className="text-sm text-neutral-900 dark:text-white font-medium">{variation.ogTitle}</p>+ </div>+ <div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Description</p>+ <p className="text-sm text-neutral-900 dark:text-white">{variation.ogDescription}</p>+ </div>+ <div className="grid grid-cols-2 gap-3">+ <div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Type</p>+ <p className="text-sm text-neutral-900 dark:text-white">{variation.ogType}</p>+ </div>+ <div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Twitter Card</p>+ <p className="text-sm text-neutral-900 dark:text-white">{variation.twitterCard}</p>+ </div>+ </div>+ <div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Image Suggestion</p>+ <p className="text-sm text-neutral-600 dark:text-neutral-300">{variation.ogImageSuggestion}</p>+ </div>+ </div>++ <div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-2">HTML Code</p>+ <pre className="p-3 bg-neutral-100 dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 rounded-lg overflow-x-auto">+ <code className="text-xs text-neutral-900 dark:text-neutral-100">{variation.htmlCode}</code>+ </pre>+ </div>+ </div>+ ))}+ </div>+ )}+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/og-tag-generator/page.tsx b/docs/src/app/(home)/tools/og-tag-generator/page.tsxindex ed5aa016f..d61dcd1c5 100644--- a/docs/src/app/(home)/tools/og-tag-generator/page.tsx+++ b/docs/src/app/(home)/tools/og-tag-generator/page.tsx@@ -1,287 +1,310 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { CheckCircle, Copy, Loader2 } from "lucide-react";+import { Metadata } from "next";import Link from "next/link";-import { useState } from "react";--interface OGVariation {- variation: string;- ogTitle: string;- ogDescription: string;- ogType: string;- ogImageSuggestion: string;- twitterCard: string;- htmlCode: string;-}--export default function OGTagGeneratorPage() {- const [pageTitle, setPageTitle] = useState("");- const [pageDescription, setPageDescription] = useState("");- const [pageType, setPageType] = useState<"website" | "article" | "product" | "blog">("website");- const [variations, setVariations] = useState<OGVariation[]>([]);- const [isLoading, setIsLoading] = useState(false);- const [error, setError] = useState("");- const [copiedIndex, setCopiedIndex] = useState<number | null>(null);- const [remainingRequests, setRemainingRequests] = useState<number | null>(null);+import { OGTagForm } from "./OGTagForm";+import { ToolPageLayout } from "../components/ToolPageLayout";- const generateOGTags = async () => {- if (!pageTitle || !pageDescription) {- setError("Please fill in all required fields");- return;- }+export const metadata: Metadata = {+ title: "Free Open Graph Tag Generator | OG Meta Tag Creator for Social Sharing",+ description:+ "Generate optimized Open Graph tags for social sharing. Create perfect previews for Facebook, Twitter, LinkedIn with our free AI-powered OG tag generator. Learn best practices, image sizes, and testing methods.",+ openGraph: {+ title: "Free Open Graph Tag Generator | Perfect Social Media Previews",+ description:+ "Create optimized OG tags for social sharing. Generate Facebook, Twitter, and LinkedIn previews in seconds with our free tool.",+ type: "website",+ url: "https://rybbit.com/tools/og-tag-generator",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Open Graph Tag Generator",+ description: "Generate optimized OG tags for social sharing. Perfect previews on Facebook, Twitter, and LinkedIn.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/og-tag-generator",+ },+};- setIsLoading(true);- setError("");- setVariations([]);+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Open Graph Tag Generator",+ applicationCategory: "SEO Tool",+ description: "Free tool to generate optimized Open Graph tags for social sharing",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ featureList: [+ "AI-powered OG tag generation",+ "Multiple tag variations",+ "Twitter Card optimization",+ "Social preview",+ "HTML code generation",+ "Image size recommendations",+ ],+ operatingSystem: "Any",+ url: "https://rybbit.com/tools/og-tag-generator",+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What are Open Graph tags and why do I need them?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Open Graph (OG) tags are meta tags in your HTML head that control how your content appears when shared on social media platforms like Facebook, LinkedIn, and Twitter. They define the title, description, image, and type of content that appears in the social preview. Without OG tags, social media platforms use their default parsing which often results in poor-looking previews. Optimized OG tags significantly increase click-through rates and engagement when content is shared.",+ },+ },+ {+ "@type": "Question",+ name: "What are the required vs optional Open Graph tags?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Required OG tags are: og:title, og:type, og:image, and og:url. These four tags provide the minimum information needed for a social preview. Optional but recommended tags include og:description (summary of content), og:locale (language), and og:site_name. For articles, add og:article:published_time and og:article:author. Twitter Cards require card type, title, and description at minimum.",+ },+ },+ {+ "@type": "Question",+ name: "What are the correct image sizes and specifications for OG tags?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "For og:image, use images that are 1200x630 pixels (1.91:1 aspect ratio) for optimal display on most platforms. Minimum recommended size is 200x200 pixels. File size should be under 8MB. Twitter Card images for summary_large_image should be 506x506 minimum, preferably 1024x512. Use JPG or PNG formats. For og:image:width and og:image:height, specify the actual dimensions of your image. Square images work best for profiles and smaller feeds.",+ },+ },+ {+ "@type": "Question",+ name: "How do I test my Open Graph tags?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Use Facebook's Sharing Debugger (facebook.com/developers/tools/debug/) to see how your pages appear on Facebook. Use LinkedIn's Post Inspector (linkedin.com/feed/update/urn:li:activity) to test LinkedIn previews. For Twitter, use the Card Validator (cards-dev.twitter.com/validator). Always clear the cache after making changes. Test on actual social platforms by pasting your URL in the status update box. Track social referral traffic with Rybbit Analytics to see which OG tags drive the most clicks.",+ },+ },+ {+ "@type": "Question",+ name: "What's the difference between Open Graph tags and Twitter Cards?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Open Graph tags are a protocol developed by Facebook that works across multiple platforms. Twitter Cards use the twitter: prefix and allow more granular control over Twitter-specific previews. Twitter Cards types include summary (small card with summary), summary_large_image (large image card), app (mobile app card), and player (video player card). You should implement both OG tags and Twitter Card tags for complete social optimization. Twitter will fall back to OG tags if Twitter Card tags are missing.",+ },+ },+ ],+ },+ ],+};- try {- const response = await fetch("/api/tools/generate-og-tags", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ pageTitle, pageDescription, pageType }),- });+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What Are Open Graph Tags?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Open Graph (OG) tags are meta tags placed in the HTML head of your web pages that control how your content appears+ when shared on social media platforms. Developed by Facebook, the Open Graph protocol works across Facebook,+ LinkedIn, Twitter, Pinterest, and many other social networks.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ When someone shares your link on social media, the platform's crawler reads your OG tags to determine what preview+ to display: the title, description, image, and content type. Without proper OG tags, social platforms make their+ best guess by extracting text and images from your page, often resulting in unattractive or irrelevant previews+ that discourage clicks.+ </p>- const remaining = response.headers.get("X-RateLimit-Remaining");- if (remaining) setRemainingRequests(parseInt(remaining));+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Why Open Graph Tags Matter for Social Sharing+ </h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Increased Click-Through Rates:</strong> Optimized OG images and descriptions increase clicks on social+ shares by 2-3x compared to default previews.+ </li>+ <li>+ <strong>Brand Consistency:</strong> Control exactly how your brand appears across social platforms, ensuring+ consistent messaging and visual branding.+ </li>+ <li>+ <strong>Better Social Engagement:</strong> Professional, well-designed previews encourage sharing and comments,+ leading to increased organic reach.+ </li>+ <li>+ <strong>SEO and Discoverability:</strong> Better social engagement signals can indirectly improve search+ rankings and overall content discoverability.+ </li>+ </ul>- if (!response.ok) {- const data = await response.json();- throw new Error(data.error || "Failed to generate OG tags");- }-- const data = await response.json();- setVariations(data.variations);- } catch (err) {- setError(err instanceof Error ? err.message : "An error occurred");- } finally {- setIsLoading(false);- }- };-- const copyCode = async (code: string, index: number) => {- await navigator.clipboard.writeText(code);- setCopiedIndex(index);- setTimeout(() => setCopiedIndex(null), 2000);- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">AI-Powered Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Open Graph Tag Generator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Generate optimized Open Graph tags for social media sharing. Get perfect previews on Facebook, Twitter, and LinkedIn.- </p>- {remainingRequests !== null && (- <p className="text-sm text-neutral-500 dark:text-neutral-400 mt-4">- {remainingRequests} requests remaining this minute- </p>- )}- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Required vs Optional OG Tags</h2>- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Page Title <span className="text-red-500">*</span>- </label>- <input- type="text"- value={pageTitle}- onChange={e => setPageTitle(e.target.value)}- placeholder="e.g., The Ultimate Guide to Web Analytics"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Required Tags (Minimum)</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">og:title</code> - The title of your+ page or content (50-60 characters recommended)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">og:type</code> - The type of content:+ website, article, product, video.movie, music.song, etc.+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">og:image</code> - URL of the image to+ display (1200x630px recommended)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">og:url</code> - The canonical URL of+ the page being shared+ </li>+ </ul>- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Page Description <span className="text-red-500">*</span>- </label>- <textarea- value={pageDescription}- onChange={e => setPageDescription(e.target.value)}- placeholder="e.g., Learn how to track website visitors, measure conversions, and grow your business with privacy-focused analytics..."- disabled={isLoading}- rows={4}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">Recommended Tags</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">og:description</code> - A brief+ description of the content (150-160 characters)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">+ og:image:width & og:image:height+ </code>{" "}+ - Actual dimensions of the og:image+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">og:site_name</code> - Your website or+ brand name+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">twitter:card</code> - Twitter Card+ type: summary, summary_large_image, app, or player+ </li>+ </ul>- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Page Type- </label>- <select- value={pageType}- onChange={e => setPageType(e.target.value as typeof pageType)}- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- >- <option value="website">Website</option>- <option value="article">Article</option>- <option value="blog">Blog Post</option>- <option value="product">Product</option>- </select>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Open Graph Image Specifications</h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Facebook / General:</strong> 1200 x 630 px (1.91:1 aspect ratio), JPG or PNG+ </li>+ <li>+ <strong>Twitter (summary_large_image):</strong> 1024 x 512 px (2:1 aspect ratio), JPG or PNG+ </li>+ <li>+ <strong>LinkedIn:</strong> 1200 x 630 px (1.91:1 aspect ratio), JPG or PNG+ </li>+ <li>+ <strong>Minimum:</strong> 200 x 200 px (1:1 aspect ratio), JPG or PNG+ </li>+ </ul>+ <p className="text-neutral-700 dark:text-neutral-300">+ Use 1200x630px for most platforms (Facebook, LinkedIn, Pinterest). Keep file size under 8MB. Use high-quality JPG+ or PNG. Avoid text in critical image areas as it may be cropped.+ </p>- {error && (- <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">- <p className="text-sm text-red-900 dark:text-red-200">{error}</p>- </div>- )}+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Test Your OG Tags</h2>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Facebook Sharing Debugger:</strong> Visit facebook.com/developers/tools/debug/ and enter your URL. This+ shows exactly how your page will appear in Facebook feeds and reveals any parsing errors. Pro tip: Click "Scrape+ Again" to refresh the cache after making changes.+ </li>+ <li>+ <strong>LinkedIn Post Inspector:</strong> Visit linkedin.com/feed/update and paste your URL in the status box.+ This preview shows how your content will appear on LinkedIn feeds. Pro tip: LinkedIn sometimes takes time to+ update. Wait a few hours if changes don't appear immediately.+ </li>+ <li>+ <strong>Twitter Card Validator:</strong> Visit cards-dev.twitter.com/validator and enter your URL to preview how+ your page will appear in tweets and Twitter feeds. Pro tip: Check the "Tag" tab to see which tags Twitter+ detected from your page.+ </li>+ <li>+ <strong>Test on Actual Social Platforms:</strong> Paste your URL directly into Facebook, LinkedIn, Twitter, and+ Pinterest status boxes to see real-time previews. This is the most authentic test. Pro tip: Use+ incognito/private browsing mode to avoid cached versions.+ </li>+ <li>+ <strong>Track Performance with Analytics:</strong> Use{" "}+ <Link+ href="https://app.rybbit.io"+ className="text-emerald-600 dark:text-emerald-400 hover:underline font-medium"+ >+ Rybbit Analytics+ </Link>{" "}+ to track which social platforms drive the most traffic to your pages. Measure CTR by platform to see which OG+ tags perform best and optimize accordingly.+ </li>+ </ol>+ </>+);- <button- onClick={generateOGTags}- disabled={isLoading}- className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"- >- {isLoading ? (- <>- <Loader2 className="w-5 h-5 animate-spin" />- Generating OG Tags...- </>- ) : (- "Generate Open Graph Tags"- )}- </button>+const faqs = [+ {+ question: "What are Open Graph tags?",+ answer: (+ <>+ Open Graph tags are meta tags that control how URLs are displayed when shared on social media platforms like+ Facebook, LinkedIn, and Twitter. They define the title, description, image, and type of content that appears in+ social shares.+ </>+ ),+ },+ {+ question: "Why are OG tags important?",+ answer: (+ <>+ OG tags significantly impact social media engagement. A well-optimized OG image and description can increase+ click-through rates by 2-3x compared to default previews. They're essential for content marketing and social+ sharing strategy.+ </>+ ),+ },+ {+ question: "How do I test my OG tags?",+ answer: (+ <>+ Use Facebook's Sharing Debugger, LinkedIn's Post Inspector, or Twitter's Card Validator to test how your OG tags+ appear. Track social referral traffic with{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to see which OG tags drive the most clicks.+ </>+ ),+ },+ {+ question: "What's the difference between Open Graph tags and Twitter Cards?",+ answer: (+ <>+ Open Graph tags are a protocol developed by Facebook that works across multiple platforms. Twitter Cards use the+ twitter: prefix and allow more granular control over Twitter-specific previews. You should implement both for+ complete social optimization. Twitter will fall back to OG tags if Twitter Card tags are missing.+ </>+ ),+ },+ {+ question: "What image sizes should I use for OG tags?",+ answer: (+ <>+ Use 1200x630 pixels (1.91:1 aspect ratio) for og:image on most platforms. Minimum size is 200x200 pixels. For+ Twitter Cards (summary_large_image), use 1024x512 or larger. Always include og:image:width and og:image:height+ tags. Keep file size under 8MB and use JPG or PNG format.+ </>+ ),+ },+];- {variations.length > 0 && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-6">- <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">Generated Variations</h3>- {variations.map((variation, index) => (- <div- key={index}- className="p-6 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg"- >- <div className="flex items-center justify-between mb-4">- <h4 className="text-lg font-semibold text-neutral-900 dark:text-white">{variation.variation}</h4>- <button- onClick={() => copyCode(variation.htmlCode, index)}- className="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2"- >- {copiedIndex === index ? (- <>- <CheckCircle className="w-4 h-4" />- Copied!- </>- ) : (- <>- <Copy className="w-4 h-4" />- Copy HTML- </>- )}- </button>- </div>-- <div className="space-y-3 mb-4">- <div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Title</p>- <p className="text-sm text-neutral-900 dark:text-white font-medium">{variation.ogTitle}</p>- </div>- <div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Description</p>- <p className="text-sm text-neutral-900 dark:text-white">{variation.ogDescription}</p>- </div>- <div className="grid grid-cols-2 gap-3">- <div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Type</p>- <p className="text-sm text-neutral-900 dark:text-white">{variation.ogType}</p>- </div>- <div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Twitter Card</p>- <p className="text-sm text-neutral-900 dark:text-white">{variation.twitterCard}</p>- </div>- </div>- <div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-1">Image Suggestion</p>- <p className="text-sm text-neutral-600 dark:text-neutral-300">{variation.ogImageSuggestion}</p>- </div>- </div>-- <div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mb-2">HTML Code</p>- <pre className="p-3 bg-neutral-100 dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 rounded-lg overflow-x-auto">- <code className="text-xs text-neutral-900 dark:text-neutral-100">{variation.htmlCode}</code>- </pre>- </div>- </div>- ))}- </div>- )}- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Open Graph Tag FAQs</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What are Open Graph tags?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Open Graph tags are meta tags that control how URLs are displayed when shared on social media platforms like Facebook, LinkedIn, and Twitter. They define the title, description, image, and type of content that appears in social shares.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Why are OG tags important?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- OG tags significantly impact social media engagement. A well-optimized OG image and description can increase click-through rates by 2-3x compared to default previews. They're essential for content marketing and social sharing.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How do I test my OG tags?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Use Facebook's Sharing Debugger, LinkedIn's Post Inspector, or Twitter's Card Validator to test how your OG tags appear. Track social referral traffic with{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to see which OG tags drive the most clicks.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track your social media traffic with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- See which social platforms drive the most traffic and optimize your OG tags based on real data. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "og_tag_generator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+export default function OGTagGeneratorPage() {+ return (+ <ToolPageLayout+ toolSlug="og-tag-generator"+ title="Open Graph Tag Generator"+ description="Generate optimized Open Graph tags for social media sharing. Get perfect previews on Facebook, Twitter, and LinkedIn with AI-powered suggestions and complete HTML code."+ badge="AI-Powered Tool"+ toolComponent={<OGTagForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="seo"+ ctaTitle="Track your social media traffic with Rybbit"+ ctaDescription="See which social platforms drive the most traffic and optimize your OG tags based on real data."+ ctaEventLocation="og_tag_generator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/page-speed-calculator/PageSpeedForm.tsx b/docs/src/app/(home)/tools/page-speed-calculator/PageSpeedForm.tsxnew file mode 100644index 000000000..e5b067663--- /dev/null+++ b/docs/src/app/(home)/tools/page-speed-calculator/PageSpeedForm.tsx@@ -0,0 +1,365 @@+"use client";++import { TrackedButton } from "@/components/TrackedButton";+import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";+import { DEFAULT_EVENT_LIMIT } from "@/lib/const";+import Link from "next/link";+import { useState } from "react";++interface CalculateImpactResult {+ conversionImpact: number;+ newConversionRate: number;+ currentRevenue: number;+ newRevenue: number;+ monthlyImpact: number;+ annualImpact: number;+ bounceRateChange: number;+ currentBounceRate: number;+ newBounceRate: number;+ timeDifference: number;+}++export function PageSpeedForm() {+ const [currentLoadTime, setCurrentLoadTime] = useState("");+ const [targetLoadTime, setTargetLoadTime] = useState("");+ const [monthlyVisitors, setMonthlyVisitors] = useState("");+ const [conversionRate, setConversionRate] = useState("");+ const [averageOrderValue, setAverageOrderValue] = useState("");++ const calculateImpact = (): CalculateImpactResult | null => {+ const current = parseFloat(currentLoadTime);+ const target = parseFloat(targetLoadTime);+ const visitors = parseFloat(monthlyVisitors);+ const cr = parseFloat(conversionRate) / 100;+ const aov = parseFloat(averageOrderValue);++ if (!current || !target || !visitors || !cr || !aov) return null;++ // Research shows that for every 1 second delay:+ // - Bounce rate increases by ~7%+ // - Conversion rate decreases by ~7%+ const timeDifference = current - target;++ // Calculate conversion impact (0.07 = 7% per second)+ const conversionImpact = timeDifference * 0.07;+ const newConversionRate = cr * (1 + conversionImpact);++ // Calculate bounce rate impact+ const bounceRateIncrease = Math.abs(timeDifference) * 7; // Percentage points++ // Calculate revenue impact+ const currentRevenue = visitors * cr * aov;+ const newRevenue = visitors * newConversionRate * aov;+ const monthlyImpact = newRevenue - currentRevenue;+ const annualImpact = monthlyImpact * 12;++ // Bounce rate calculation (assume current is 50% baseline)+ const currentBounceRate = 50;+ const newBounceRate = timeDifference < 0+ ? Math.max(currentBounceRate + bounceRateIncrease, 0)+ : Math.min(currentBounceRate + bounceRateIncrease, 100);++ return {+ conversionImpact: conversionImpact * 100,+ newConversionRate: newConversionRate * 100,+ currentRevenue,+ newRevenue,+ monthlyImpact,+ annualImpact,+ bounceRateChange: bounceRateIncrease,+ currentBounceRate,+ newBounceRate,+ timeDifference+ };+ };++ const metrics = calculateImpact();++ const clearForm = () => {+ setCurrentLoadTime("");+ setTargetLoadTime("");+ setMonthlyVisitors("");+ setConversionRate("");+ setAverageOrderValue("");+ };++ return (+ <>+ {/* Tool */}+ <div className="mb-16">+ <div className="space-y-6">+ {/* Current Load Time */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Current Page Load Time <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.1"+ value={currentLoadTime}+ onChange={e => setCurrentLoadTime(e.target.value)}+ placeholder="4.5"+ className="w-full pl-4 pr-20 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">seconds</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your current page load time (check with PageSpeed Insights)</p>+ </div>++ {/* Target Load Time */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Target Page Load Time <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.1"+ value={targetLoadTime}+ onChange={e => setTargetLoadTime(e.target.value)}+ placeholder="2.0"+ className="w-full pl-4 pr-20 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">seconds</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your target load time (recommended: under 3 seconds)</p>+ </div>++ {/* Monthly Visitors */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Monthly Visitors <span className="text-red-500">*</span>+ </label>+ <input+ type="number"+ value={monthlyVisitors}+ onChange={e => setMonthlyVisitors(e.target.value)}+ placeholder="50000"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total monthly visitors</p>+ </div>++ {/* Conversion Rate */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Current Conversion Rate <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.01"+ value={conversionRate}+ onChange={e => setConversionRate(e.target.value)}+ placeholder="2.5"+ className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your current conversion rate</p>+ </div>++ {/* Average Order Value */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Average Order Value <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>+ <input+ type="number"+ step="0.01"+ value={averageOrderValue}+ onChange={e => setAverageOrderValue(e.target.value)}+ placeholder="75.00"+ className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Average value per conversion</p>+ </div>++ {/* Results */}+ {metrics && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ {metrics.monthlyImpact >= 0 ? "Monthly Revenue Gain" : "Monthly Revenue Loss"}+ </label>+ <div className={`px-4 py-6 border rounded-lg text-center ${+ metrics.monthlyImpact >= 0+ ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-300 dark:border-emerald-800"+ : "bg-red-50 dark:bg-red-950/30 border-red-300 dark:border-red-800"+ }`}>+ <div className={`text-4xl font-bold ${+ metrics.monthlyImpact >= 0+ ? "text-emerald-600 dark:text-emerald-400"+ : "text-red-600 dark:text-red-400"+ }`}>+ {metrics.monthlyImpact >= 0 ? "+" : "-"}${Math.abs(metrics.monthlyImpact).toLocaleString(undefined, { maximumFractionDigits: 0 })}+ </div>+ <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">per month</div>+ </div>+ </div>++ <div className="grid grid-cols-2 gap-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Annual Impact+ </label>+ <div className={`px-4 py-4 border rounded-lg text-center ${+ metrics.annualImpact >= 0+ ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-300 dark:border-emerald-800"+ : "bg-red-50 dark:bg-red-950/30 border-red-300 dark:border-red-800"+ }`}>+ <div className={`text-2xl font-bold ${+ metrics.annualImpact >= 0+ ? "text-emerald-600 dark:text-emerald-400"+ : "text-red-600 dark:text-red-400"+ }`}>+ {metrics.annualImpact >= 0 ? "+" : "-"}${Math.abs(metrics.annualImpact).toLocaleString(undefined, { maximumFractionDigits: 0 })}+ </div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Conversion Rate Change+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-2xl font-bold text-neutral-900 dark:text-white">+ {metrics.conversionImpact >= 0 ? "+" : ""}{metrics.conversionImpact.toFixed(1)}%+ </div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ New Conversion Rate+ </label>+ <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">+ <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">+ {metrics.newConversionRate.toFixed(2)}%+ </div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Bounce Rate Impact+ </label>+ <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">+ <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">+ {metrics.timeDifference > 0 ? "+" : ""}{metrics.bounceRateChange.toFixed(1)}%+ </div>+ </div>+ </div>+ </div>++ <div className={`p-4 rounded-lg border ${+ metrics.monthlyImpact >= 0+ ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900 text-emerald-900 dark:text-emerald-200"+ : "bg-orange-50 dark:bg-orange-950/30 border-orange-200 dark:border-orange-900 text-orange-900 dark:text-orange-200"+ }`}>+ <h3 className="font-semibold mb-2">Impact Summary:</h3>+ <ul className="text-sm space-y-1">+ <li>• Improving load time from <strong>{currentLoadTime}s</strong> to <strong>{targetLoadTime}s</strong></li>+ <li>• Conversion rate changes from <strong>{parseFloat(conversionRate).toFixed(2)}%</strong> to <strong>{metrics.newConversionRate.toFixed(2)}%</strong></li>+ <li>• Potential revenue impact: <strong>${Math.abs(metrics.monthlyImpact).toLocaleString(undefined, { maximumFractionDigits: 0 })}/month</strong> ({metrics.monthlyImpact >= 0 ? "gain" : "loss"})</li>+ <li>• Based on industry research: 7% conversion impact per second of load time</li>+ </ul>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ </div>++ {/* FAQ Section */}+ <div className="mb-16">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Frequently Asked Questions</h2>+ <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">+ <Accordion type="single" collapsible className="w-full">+ <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ How much does page speed really matter?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Studies show that for every 1 second delay in page load time, conversions decrease by approximately 7%, bounce rate increases by 7%, and customer satisfaction drops by 16%. A 2-second delay can result in abandonment rates up to 87% for e-commerce sites. This makes page speed a critical business metric.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What are Google Core Web Vitals and why are they important?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Google Core Web Vitals are three key metrics that measure user experience: Largest Contentful Paint (LCP, visual loading speed), First Input Delay (FID, responsiveness), and Cumulative Layout Shift (CLS, visual stability). Google uses these metrics as ranking factors in search results, making them essential for SEO. Meeting these thresholds directly impacts your site's visibility and traffic.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-3" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What's a good page load time?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Google recommends pages load in under 3 seconds on mobile. However, the faster the better—pages that load in under 1 second see significantly higher engagement. Amazon found that every 100ms improvement in load time increased revenue by 1%. Most successful e-commerce sites target between 1-2 seconds.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-4" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What are the best ways to improve page speed?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Key improvements include: optimizing images (compress and use modern formats like WebP), minifying CSS/JS files, enabling browser caching, using a Content Delivery Network (CDN), reducing server response time, eliminating render-blocking resources, lazy-loading below-the-fold content, and choosing lightweight analytics tools like{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit+ </Link>{" "}+ which adds minimal overhead (just 3KB).+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-5">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ How can analytics tools affect my page speed?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Many analytics tools can significantly impact page performance by loading large scripts synchronously and making blocking network requests. This reduces your page's speed and negatively affects user experience. Tools like Rybbit are designed to minimize this impact with lightweight asynchronous loading (3KB script, loaded after page interactive), ensuring you get the insights you need without compromising performance.+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </div>+ </div>++ {/* CTA */}+ <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">+ <div className="max-w-4xl mx-auto px-6 text-center">+ <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">+ Lightning-fast analytics that won't slow you down+ </h2>+ <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">+ Rybbit's tiny 3KB script loads asynchronously and won't impact your page speed. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.+ </p>+ <TrackedButton+ href="https://app.rybbit.io/signup"+ eventName="signup"+ eventProps={{ location: "page_speed_calculator_cta" }}+ className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"+ >+ Start tracking for free+ </TrackedButton>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/page-speed-calculator/page.tsx b/docs/src/app/(home)/tools/page-speed-calculator/page.tsxindex c4622844e..5f9d5d485 100644--- a/docs/src/app/(home)/tools/page-speed-calculator/page.tsx+++ b/docs/src/app/(home)/tools/page-speed-calculator/page.tsx@@ -1,349 +1,222 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import Link from "next/link";-import { useState } from "react";+import { Metadata } from "next";+import { PageSpeedForm } from "./PageSpeedForm";+import { ToolPageLayout } from "../components/ToolPageLayout";++export const metadata: Metadata = {+ title: "Free Page Speed Calculator | Website Load Time Impact Calculator",+ description:+ "Calculate how page load time affects your conversions and revenue. See the real cost of a slow website. Use our free page speed impact calculator to understand performance metrics.",+ openGraph: {+ title: "Free Page Speed Calculator | Website Load Time Impact Calculator",+ description:+ "Calculate how page load time affects your conversions and revenue. See the real cost of a slow website.",+ type: "website",+ url: "https://rybbit.com/tools/page-speed-calculator",+ siteName: "Rybbit",+ images: [+ {+ url: "https://rybbit.com/og-image.png",+ width: 1200,+ height: 630,+ alt: "Page Speed Calculator",+ },+ ],+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Page Speed Calculator | Website Load Time Impact Calculator",+ description: "Calculate how page load time affects your conversions and revenue.",+ images: ["https://rybbit.com/og-image.png"],+ },+ alternates: {+ canonical: "https://rybbit.com/tools/page-speed-calculator",+ },+};++const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Page Speed Impact Calculator",+ description:+ "Calculate how page load time affects your conversions and revenue. See the real cost of a slow website.",+ url: "https://rybbit.com/tools/page-speed-calculator",+ applicationCategory: "WebApplication",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ creator: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "How much does page speed really matter?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Studies show that for every 1 second delay in page load time, conversions decrease by approximately 7%, bounce rate increases by 7%, and customer satisfaction drops by 16%. A 2-second delay can result in abandonment rates up to 87% for e-commerce sites.",+ },+ },+ {+ "@type": "Question",+ name: "What are Google Core Web Vitals and why are they important?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Google Core Web Vitals are three key metrics that measure user experience: Largest Contentful Paint (LCP, visual loading speed), First Input Delay (FID, responsiveness), and Cumulative Layout Shift (CLS, visual stability). Google uses these metrics as ranking factors in search results, making them essential for SEO.",+ },+ },+ {+ "@type": "Question",+ name: "What's a good page load time?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Google recommends pages load in under 3 seconds on mobile. However, the faster the better—pages that load in under 1 second see significantly higher engagement. Amazon found that every 100ms improvement in load time increased revenue by 1%.",+ },+ },+ {+ "@type": "Question",+ name: "What are the best ways to improve page speed?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Key improvements include: optimizing images, minifying CSS/JS files, enabling browser caching, using a Content Delivery Network, reducing server response time, eliminating render-blocking resources, and choosing lightweight analytics tools.",+ },+ },+ {+ "@type": "Question",+ name: "How can analytics tools affect my page speed?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Many analytics tools can significantly impact page performance by loading large scripts synchronously and making blocking network requests. Tools like Rybbit are designed to minimize this impact with lightweight asynchronous loading.",+ },+ },+ ],+ },+ ],+};++const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">Why Page Speed Matters</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Page speed is one of the most critical factors affecting user experience and business metrics. Every millisecond+ counts—slow-loading pages lead to higher bounce rates, reduced engagement, and ultimately lost revenue.+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Impact on Conversions:</strong> Research shows a direct correlation: every 1-second delay in page load+ time results in approximately 7% loss in conversions. For e-commerce sites, this translates to thousands of+ dollars in lost revenue monthly.+ </li>+ <li>+ <strong>Google Core Web Vitals:</strong> Google uses Core Web Vitals as ranking factors. Sites with poor page+ speed are penalized in search results, reducing organic visibility. LCP, FID, and CLS are critical metrics to+ monitor and optimize.+ </li>+ </ul>++ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Page Speed Optimization Techniques+ </h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Image Optimization:</strong> Compress images, use modern formats (WebP), and implement lazy loading for+ below-the-fold content.+ </li>+ <li>+ <strong>Asset Minification:</strong> Minify CSS and JavaScript files to reduce file sizes and improve load+ times.+ </li>+ <li>+ <strong>Caching Strategy:</strong> Enable browser caching and implement server-side caching to serve content+ faster.+ </li>+ <li>+ <strong>Content Delivery:</strong> Use a CDN to serve content from servers geographically closer to your users.+ </li>+ <li>+ <strong>Tool Selection:</strong> Choose lightweight tools like Rybbit (3KB) instead of heavyweight analytics+ solutions that slow down your site.+ </li>+ </ul>+ </>+);++const faqs = [+ {+ question: "How much does page speed really matter?",+ answer: (+ <>+ Studies show that for every 1 second delay in page load time, conversions decrease by approximately 7%, bounce+ rate increases by 7%, and customer satisfaction drops by 16%. A 2-second delay can result in abandonment rates+ up to 87% for e-commerce sites.+ </>+ ),+ },+ {+ question: "What are Google Core Web Vitals and why are they important?",+ answer: (+ <>+ Google Core Web Vitals are three key metrics that measure user experience: Largest Contentful Paint (LCP, visual+ loading speed), First Input Delay (FID, responsiveness), and Cumulative Layout Shift (CLS, visual stability).+ Google uses these metrics as ranking factors in search results, making them essential for SEO.+ </>+ ),+ },+ {+ question: "What's a good page load time?",+ answer: (+ <>+ Google recommends pages load in under 3 seconds on mobile. However, the faster the better—pages that load in+ under 1 second see significantly higher engagement. Amazon found that every 100ms improvement in load time+ increased revenue by 1%.+ </>+ ),+ },+ {+ question: "What are the best ways to improve page speed?",+ answer: (+ <>+ Key improvements include: optimizing images, minifying CSS/JS files, enabling browser caching, using a Content+ Delivery Network, reducing server response time, eliminating render-blocking resources, and choosing lightweight+ analytics tools.+ </>+ ),+ },+ {+ question: "How can analytics tools affect my page speed?",+ answer: (+ <>+ Many analytics tools can significantly impact page performance by loading large scripts synchronously and making+ blocking network requests. Tools like Rybbit are designed to minimize this impact with lightweight asynchronous+ loading.+ </>+ ),+ },+];export default function PageSpeedCalculatorPage() {- const [currentLoadTime, setCurrentLoadTime] = useState("");- const [targetLoadTime, setTargetLoadTime] = useState("");- const [monthlyVisitors, setMonthlyVisitors] = useState("");- const [conversionRate, setConversionRate] = useState("");- const [averageOrderValue, setAverageOrderValue] = useState("");-- const calculateImpact = () => {- const current = parseFloat(currentLoadTime);- const target = parseFloat(targetLoadTime);- const visitors = parseFloat(monthlyVisitors);- const cr = parseFloat(conversionRate) / 100;- const aov = parseFloat(averageOrderValue);-- if (!current || !target || !visitors || !cr || !aov) return null;-- // Research shows that for every 1 second delay:- // - Bounce rate increases by ~7%- // - Conversion rate decreases by ~7%- const timeDifference = current - target;-- // Calculate conversion impact (0.07 = 7% per second)- const conversionImpact = timeDifference * 0.07;- const newConversionRate = cr * (1 + conversionImpact);-- // Calculate bounce rate impact- const bounceRateIncrease = Math.abs(timeDifference) * 7; // Percentage points-- // Calculate revenue impact- const currentRevenue = visitors * cr * aov;- const newRevenue = visitors * newConversionRate * aov;- const monthlyImpact = newRevenue - currentRevenue;- const annualImpact = monthlyImpact * 12;-- // Bounce rate calculation (assume current is 50% baseline)- const currentBounceRate = 50;- const newBounceRate = timeDifference < 0- ? Math.max(currentBounceRate + bounceRateIncrease, 0)- : Math.min(currentBounceRate + bounceRateIncrease, 100);-- return {- conversionImpact: conversionImpact * 100,- newConversionRate: newConversionRate * 100,- currentRevenue,- newRevenue,- monthlyImpact,- annualImpact,- bounceRateChange: bounceRateIncrease,- currentBounceRate,- newBounceRate,- timeDifference- };- };-- const metrics = calculateImpact();-- const clearForm = () => {- setCurrentLoadTime("");- setTargetLoadTime("");- setMonthlyVisitors("");- setConversionRate("");- setAverageOrderValue("");- };-return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Page Speed Impact Calculator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Calculate how page load time affects your conversions and revenue. See the real cost of a slow website.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Current Load Time */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Current Page Load Time <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.1"- value={currentLoadTime}- onChange={e => setCurrentLoadTime(e.target.value)}- placeholder="4.5"- className="w-full pl-4 pr-20 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">seconds</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your current page load time (check with PageSpeed Insights)</p>- </div>-- {/* Target Load Time */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Target Page Load Time <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.1"- value={targetLoadTime}- onChange={e => setTargetLoadTime(e.target.value)}- placeholder="2.0"- className="w-full pl-4 pr-20 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">seconds</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your target load time (recommended: under 3 seconds)</p>- </div>-- {/* Monthly Visitors */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Monthly Visitors <span className="text-red-500">*</span>- </label>- <input- type="number"- value={monthlyVisitors}- onChange={e => setMonthlyVisitors(e.target.value)}- placeholder="50000"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total monthly visitors</p>- </div>-- {/* Conversion Rate */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Current Conversion Rate <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.01"- value={conversionRate}- onChange={e => setConversionRate(e.target.value)}- placeholder="2.5"- className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your current conversion rate</p>- </div>-- {/* Average Order Value */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Average Order Value <span className="text-red-500">*</span>- </label>- <div className="relative">- <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>- <input- type="number"- step="0.01"- value={averageOrderValue}- onChange={e => setAverageOrderValue(e.target.value)}- placeholder="75.00"- className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Average value per conversion</p>- </div>-- {/* Results */}- {metrics && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- {metrics.monthlyImpact >= 0 ? "Monthly Revenue Gain" : "Monthly Revenue Loss"}- </label>- <div className={`px-4 py-6 border rounded-lg text-center ${- metrics.monthlyImpact >= 0- ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-300 dark:border-emerald-800"- : "bg-red-50 dark:bg-red-950/30 border-red-300 dark:border-red-800"- }`}>- <div className={`text-4xl font-bold ${- metrics.monthlyImpact >= 0- ? "text-emerald-600 dark:text-emerald-400"- : "text-red-600 dark:text-red-400"- }`}>- {metrics.monthlyImpact >= 0 ? "+" : "-"}${Math.abs(metrics.monthlyImpact).toLocaleString(undefined, { maximumFractionDigits: 0 })}- </div>- <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">per month</div>- </div>- </div>-- <div className="grid grid-cols-2 gap-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Annual Impact- </label>- <div className={`px-4 py-4 border rounded-lg text-center ${- metrics.annualImpact >= 0- ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-300 dark:border-emerald-800"- : "bg-red-50 dark:bg-red-950/30 border-red-300 dark:border-red-800"- }`}>- <div className={`text-2xl font-bold ${- metrics.annualImpact >= 0- ? "text-emerald-600 dark:text-emerald-400"- : "text-red-600 dark:text-red-400"- }`}>- {metrics.annualImpact >= 0 ? "+" : "-"}${Math.abs(metrics.annualImpact).toLocaleString(undefined, { maximumFractionDigits: 0 })}- </div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Conversion Rate Change- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-2xl font-bold text-neutral-900 dark:text-white">- {metrics.conversionImpact >= 0 ? "+" : ""}{metrics.conversionImpact.toFixed(1)}%- </div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- New Conversion Rate- </label>- <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">- <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">- {metrics.newConversionRate.toFixed(2)}%- </div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Bounce Rate Impact- </label>- <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">- <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">- {metrics.timeDifference > 0 ? "+" : ""}{metrics.bounceRateChange.toFixed(1)}%- </div>- </div>- </div>- </div>-- <div className={`p-4 rounded-lg border ${- metrics.monthlyImpact >= 0- ? "bg-emerald-50 dark:bg-emerald-950/30 border-emerald-200 dark:border-emerald-900 text-emerald-900 dark:text-emerald-200"- : "bg-orange-50 dark:bg-orange-950/30 border-orange-200 dark:border-orange-900 text-orange-900 dark:text-orange-200"- }`}>- <h3 className="font-semibold mb-2">Impact Summary:</h3>- <ul className="text-sm space-y-1">- <li>• Improving load time from <strong>{currentLoadTime}s</strong> to <strong>{targetLoadTime}s</strong></li>- <li>• Conversion rate changes from <strong>{parseFloat(conversionRate).toFixed(2)}%</strong> to <strong>{metrics.newConversionRate.toFixed(2)}%</strong></li>- <li>• Potential revenue impact: <strong>${Math.abs(metrics.monthlyImpact).toLocaleString(undefined, { maximumFractionDigits: 0 })}/month</strong> ({metrics.monthlyImpact >= 0 ? "gain" : "loss"})</li>- <li>• Based on industry research: 7% conversion impact per second of load time</li>- </ul>- </div>- </div>- )}-- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding Page Speed Impact</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How much does page speed really matter?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Studies show that for every 1 second delay in page load time, conversions decrease by approximately 7%, bounce rate increases by 7%, and customer satisfaction drops by 16%. A 2-second delay can result in abandonment rates up to 87% for e-commerce sites.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What's a good page load time?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Google recommends pages load in under 3 seconds on mobile. However, the faster the better—pages that load in under 1 second see significantly higher engagement. Amazon found that every 100ms improvement in load time increased revenue by 1%.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How can I improve my page speed?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Key improvements include: optimizing images (compress and use modern formats), minifying CSS/JS, enabling browser caching, using a CDN, reducing server response time, eliminating render-blocking resources, and choosing lightweight analytics like{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit- </Link>{" "}- which adds minimal overhead.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Lightning-fast analytics that won't slow you down- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- Rybbit's tiny 3KB script loads asynchronously and won't impact your page speed. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "page_speed_calculator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="page-speed-calculator"+ title="Page Speed Impact Calculator"+ description="Calculate how page load time affects your conversions and revenue. See the real cost of a slow website."+ badge="Free Tool"+ toolComponent={<PageSpeedForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Optimize your site speed with Rybbit"+ ctaDescription="Rybbit is a lightweight analytics solution (3KB) that won't slow down your site. Monitor performance while maintaining fast load times."+ ctaEventLocation="page_speed_calculator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/page.tsx b/docs/src/app/(home)/tools/page.tsxindex ad324e284..38528c815 100644--- a/docs/src/app/(home)/tools/page.tsx+++ b/docs/src/app/(home)/tools/page.tsx@@ -86,14 +86,6 @@ const tools = ["Visualize your conversion funnel step-by-step. Input visitor counts at each stage and see where you're losing customers.",category: "Analytics",},- {- href: "/tools/ai-privacy-policy-generator",- icon: Sparkles,- title: "AI Privacy Policy Generator",- description:- "Generate a comprehensive, GDPR-compliant privacy policy using AI. Just describe your site and get a tailored policy instantly.",- category: "AI-Powered",- },{href: "/tools/analytics-detector",icon: Search,@@ -138,7 +130,7 @@ const tools = [export default function ToolsPage() {return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">+ <div className="min-h-screen"><div className="max-w-[1300px] mx-auto px-6 py-20">{/* Header */}<div className="text-center mb-16">diff --git a/docs/src/app/(home)/tools/privacy-policy-builder/PrivacyPolicyBuilderForm.tsx b/docs/src/app/(home)/tools/privacy-policy-builder/PrivacyPolicyBuilderForm.tsxnew file mode 100644index 000000000..1edd3c03e--- /dev/null+++ b/docs/src/app/(home)/tools/privacy-policy-builder/PrivacyPolicyBuilderForm.tsx@@ -0,0 +1,335 @@+"use client";++import { TrackedButton } from "@/components/TrackedButton";+import { CheckCircle, Copy } from "lucide-react";+import { useState } from "react";++export function PrivacyPolicyBuilderForm() {+ const [companyName, setCompanyName] = useState("");+ const [websiteUrl, setWebsiteUrl] = useState("");+ const [contactEmail, setContactEmail] = useState("");+ const [collectsPersonalData, setCollectsPersonalData] = useState(false);+ const [usesCookies, setUsesCookies] = useState(false);+ const [usesAnalytics, setUsesAnalytics] = useState(false);+ const [sharesData, setSharesData] = useState(false);+ const [copied, setCopied] = useState(false);++ const generatePolicy = () => {+ if (!companyName || !websiteUrl || !contactEmail) return "";++ const today = new Date().toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" });++ return `# Privacy Policy++**Last updated: ${today}**++This Privacy Policy describes how ${companyName} ("we", "us", or "our") collects, uses, and shares information when you visit ${websiteUrl} (the "Site").++## Information We Collect++${+ collectsPersonalData+ ? `### Personal Information++When you visit our Site, we may collect certain personal information that you voluntarily provide to us, such as:++- Name and contact information (email address, phone number)+- Account credentials+- Payment information+- Any other information you choose to provide`+ : "We do not collect personal information from visitors to our Site unless voluntarily provided."+}++${+ usesCookies+ ? `### Cookies and Tracking Technologies++We use cookies and similar tracking technologies to track activity on our Site and hold certain information. Cookies are files with a small amount of data that are stored on your device. You can instruct your browser to refuse all cookies or to indicate when a cookie is being sent.`+ : "We do not use cookies or similar tracking technologies on our Site."+}++${+ usesAnalytics+ ? `### Analytics++We use analytics services to help us understand how visitors use our Site. These services may collect information such as:++- Pages visited+- Time spent on pages+- Links clicked+- Browser type and version+- Device information+- IP address (anonymized)`+ : ""+}++## How We Use Your Information++We use the information we collect to:++- Provide, maintain, and improve our Site+- Respond to your inquiries and requests+${collectsPersonalData ? "- Send you updates and marketing communications (with your consent)" : ""}+- Monitor and analyze usage patterns+- Detect, prevent, and address technical issues++## Information Sharing++${+ sharesData+ ? `We may share your information with:++- Service providers who assist us in operating our Site+- Business partners with your consent+- Law enforcement or regulatory authorities when required by law+- In connection with a merger, sale, or acquisition of our business++We do not sell your personal information to third parties.`+ : "We do not share your personal information with third parties, except as required by law."+}++## Data Security++We implement appropriate technical and organizational measures to protect your information against unauthorized access, alteration, disclosure, or destruction.++## Your Rights++Depending on your location, you may have certain rights regarding your personal information, including:++- The right to access your personal information+- The right to correct inaccurate information+- The right to delete your information+- The right to object to or restrict processing+- The right to data portability++To exercise these rights, please contact us at ${contactEmail}.++## Children's Privacy++Our Site is not intended for children under the age of 13. We do not knowingly collect personal information from children under 13.++## Changes to This Privacy Policy++We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page and updating the "Last updated" date.++## Contact Us++If you have any questions about this Privacy Policy, please contact us at:++**Email:** ${contactEmail}+**Website:** ${websiteUrl}++---++*This privacy policy was generated using ${websiteUrl.includes("rybbit") ? "Rybbit's" : "[Rybbit's](https://rybbit.com)"} Privacy Policy Builder. For compliance with specific regulations (GDPR, CCPA, etc.), please consult with a legal professional.*`;+ };++ const policy = generatePolicy();++ const copyToClipboard = async () => {+ if (policy) {+ await navigator.clipboard.writeText(policy);+ setCopied(true);+ setTimeout(() => setCopied(false), 2000);+ }+ };++ const downloadPolicy = () => {+ if (!policy) return;++ const blob = new Blob([policy], { type: "text/markdown" });+ const url = URL.createObjectURL(blob);+ const a = document.createElement("a");+ a.href = url;+ a.download = "privacy-policy.md";+ document.body.appendChild(a);+ a.click();+ document.body.removeChild(a);+ URL.revokeObjectURL(url);+ };++ const clearForm = () => {+ setCompanyName("");+ setWebsiteUrl("");+ setContactEmail("");+ setCollectsPersonalData(false);+ setUsesCookies(false);+ setUsesAnalytics(false);+ setSharesData(false);+ setCopied(false);+ };++ return (+ <div className="mb-16">+ <div className="space-y-6">+ {/* Company Name */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Company Name <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={companyName}+ onChange={e => setCompanyName(e.target.value)}+ placeholder="Acme Inc."+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>++ {/* Website URL */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Website URL <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={websiteUrl}+ onChange={e => setWebsiteUrl(e.target.value)}+ placeholder="https://example.com"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>++ {/* Contact Email */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Contact Email <span className="text-red-500">*</span>+ </label>+ <input+ type="email"+ value={contactEmail}+ onChange={e => setContactEmail(e.target.value)}+ placeholder="[email protected]"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>++ {/* Checkboxes */}+ <div className="space-y-3 pt-4 border-t border-neutral-200 dark:border-neutral-800">+ <p className="text-sm font-medium text-neutral-900 dark:text-white mb-3">What does your website do?</p>++ <label className="flex items-start gap-3 cursor-pointer">+ <input+ type="checkbox"+ checked={collectsPersonalData}+ onChange={e => setCollectsPersonalData(e.target.checked)}+ className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"+ />+ <div>+ <div className="text-sm font-medium text-neutral-900 dark:text-white">Collects personal data</div>+ <div className="text-xs text-neutral-600 dark:text-neutral-400">+ Name, email, phone number, payment info, etc.+ </div>+ </div>+ </label>++ <label className="flex items-start gap-3 cursor-pointer">+ <input+ type="checkbox"+ checked={usesCookies}+ onChange={e => setUsesCookies(e.target.checked)}+ className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"+ />+ <div>+ <div className="text-sm font-medium text-neutral-900 dark:text-white">Uses cookies</div>+ <div className="text-xs text-neutral-600 dark:text-neutral-400">+ Session cookies, tracking cookies, etc.+ </div>+ </div>+ </label>++ <label className="flex items-start gap-3 cursor-pointer">+ <input+ type="checkbox"+ checked={usesAnalytics}+ onChange={e => setUsesAnalytics(e.target.checked)}+ className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"+ />+ <div>+ <div className="text-sm font-medium text-neutral-900 dark:text-white">Uses analytics</div>+ <div className="text-xs text-neutral-600 dark:text-neutral-400">+ Google Analytics, Rybbit, Plausible, etc.+ </div>+ </div>+ </label>++ <label className="flex items-start gap-3 cursor-pointer">+ <input+ type="checkbox"+ checked={sharesData}+ onChange={e => setSharesData(e.target.checked)}+ className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"+ />+ <div>+ <div className="text-sm font-medium text-neutral-900 dark:text-white">Shares data with third parties</div>+ <div className="text-xs text-neutral-600 dark:text-neutral-400">+ Service providers, partners, advertisers, etc.+ </div>+ </div>+ </label>+ </div>++ {/* Preview */}+ {policy && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">+ <div className="flex items-center justify-between mb-3">+ <label className="block text-sm font-medium text-neutral-900 dark:text-white">+ Your Privacy Policy (Markdown)+ </label>+ <div className="flex gap-2">+ <button+ onClick={copyToClipboard}+ className="px-4 py-2 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2"+ >+ {copied ? <CheckCircle className="w-4 h-4" /> : <Copy className="w-4 h-4" />}+ {copied ? "Copied!" : "Copy"}+ </button>+ <button+ onClick={downloadPolicy}+ className="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition-colors"+ >+ Download+ </button>+ </div>+ </div>+ <div className="max-h-96 overflow-y-auto p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg">+ <pre className="text-xs text-neutral-900 dark:text-neutral-100 whitespace-pre-wrap font-mono">+ {policy}+ </pre>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>++ {/* CTA */}+ <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20 -mx-6 mt-16">+ <div className="max-w-4xl mx-auto px-6 text-center">+ <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">+ Privacy-first analytics with Rybbit+ </h2>+ <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">+ No cookies, no tracking, full GDPR compliance. Get powerful analytics without compromising your users' privacy.+ </p>+ <TrackedButton+ href="https://app.rybbit.io/signup"+ eventName="signup"+ eventProps={{ location: "privacy_policy_builder_cta" }}+ className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"+ >+ Start tracking for free+ </TrackedButton>+ </div>+ </div>+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/privacy-policy-builder/page.tsx b/docs/src/app/(home)/tools/privacy-policy-builder/page.tsxindex a16c079f8..46a1d4678 100644--- a/docs/src/app/(home)/tools/privacy-policy-builder/page.tsx+++ b/docs/src/app/(home)/tools/privacy-policy-builder/page.tsx@@ -1,397 +1,286 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { CheckCircle, Copy } from "lucide-react";-import { useState } from "react";+import { Metadata } from "next";+import Link from "next/link";+import { PrivacyPolicyBuilderForm } from "./PrivacyPolicyBuilderForm";+import { ToolPageLayout } from "../components/ToolPageLayout";++export const metadata: Metadata = {+ title: "Free Privacy Policy Builder | Create Custom Privacy Policy for Your Website",+ description:+ "Generate a customized, GDPR and CCPA compliant privacy policy in minutes. Free privacy policy builder tool with compliance checklist, legal requirements, and best practices.",+ openGraph: {+ title: "Free Privacy Policy Builder | Create Custom Privacy Policy",+ description:+ "Generate a customized privacy policy for your website in minutes. GDPR and CCPA compliant. Free tool with no sign-up required.",+ type: "website",+ url: "https://rybbit.com/tools/privacy-policy-builder",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Privacy Policy Builder",+ description: "Create a custom privacy policy for your website instantly. GDPR and CCPA compliant.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/privacy-policy-builder",+ },+};++const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Privacy Policy Builder",+ applicationCategory: "Legal Tool",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ featureList: [+ "GDPR compliance",+ "CCPA compliance",+ "Customizable templates",+ "Data collection options",+ "Cookie policy generation",+ "Data sharing sections",+ "Download as Markdown",+ ],+ operatingSystem: "Any",+ url: "https://rybbit.com/tools/privacy-policy-builder",+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "Do I need a privacy policy for my website?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Yes, if you collect any personal information from visitors (including analytics data), you're legally required to have a privacy policy in most jurisdictions. This includes the EU (GDPR), California (CCPA), and many other regions. Even if you don't collect personal data, having a privacy policy builds trust with your users.",+ },+ },+ {+ "@type": "Question",+ name: "What should a privacy policy include?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "A comprehensive privacy policy should include: what information you collect, how you collect it, how you use it, who you share it with, how you protect it, user rights (access, deletion, etc.), cookie usage, contact information, and how you notify users of changes.",+ },+ },+ {+ "@type": "Question",+ name: "Is analytics data considered personal data under GDPR?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Under GDPR and similar regulations, IP addresses and analytics data can be considered personal data. However, privacy-focused analytics tools like Rybbit don't use cookies and anonymize data, making compliance much easier. If you use Rybbit, you typically won't need a cookie consent banner.",+ },+ },+ {+ "@type": "Question",+ name: "How often should I update my privacy policy?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "You should update your privacy policy whenever your data practices change, such as adding new analytics tools, integrating third-party services, or modifying how you collect or use data. Regular reviews (at least annually) help ensure ongoing compliance with changing regulations.",+ },+ },+ {+ "@type": "Question",+ name: "Can I use this generated policy without consulting a lawyer?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "While this tool provides a comprehensive starting point, privacy laws vary by jurisdiction and business type. For websites handling sensitive data, operating in regulated industries, or dealing with international users, consulting a legal professional is recommended to ensure full compliance with applicable laws.",+ },+ },+ ],+ },+ ],+};++const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">+ Why Your Website Needs a Privacy Policy+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ A privacy policy is more than just a legal requirement—it's a critical document that establishes trust with your+ visitors and demonstrates your commitment to protecting their data. Whether you collect customer information, use+ analytics tools, or deploy cookies on your site, a clear and transparent privacy policy is essential.+ </p>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ Legal Requirements by Jurisdiction+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>GDPR (European Union):</strong> Any website accessible to EU residents must have a compliant privacy+ policy. Violations can result in fines up to 4% of annual revenue.+ </li>+ <li>+ <strong>CCPA (California):</strong> Websites collecting personal information from California residents must+ disclose data practices and provide consumer rights information.+ </li>+ <li>+ <strong>COPPA (United States):</strong> If your site targets children under 13, you must comply with additional+ privacy protections.+ </li>+ <li>+ <strong>Other Regions:</strong> Australia, Canada, Japan, and other countries have their own privacy laws with+ specific disclosure requirements.+ </li>+ </ul>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">Key Customization Tips</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Be Specific:</strong> Use your actual company name, website URL, and contact email. Generic policies+ lack credibility.+ </li>+ <li>+ <strong>Disclose All Data Practices:</strong> Check all boxes that apply to your website, including analytics,+ cookies, and data sharing.+ </li>+ <li>+ <strong>Update Regularly:</strong> Review and update your policy whenever you add new tools, services, or change+ how you collect data.+ </li>+ <li>+ <strong>Make it Accessible:</strong> Link prominently to your privacy policy in your website footer and ensure+ it's easy to find.+ </li>+ <li>+ <strong>Use Clear Language:</strong> Avoid legal jargon where possible. Users should understand how you use+ their data.+ </li>+ </ul>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ Privacy Policy Compliance Checklist+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Clearly state what personal information you collect</li>+ <li>Explain how you collect it (forms, cookies, analytics, etc.)</li>+ <li>Describe how you use the collected information</li>+ <li>List all third parties with whom you share data</li>+ <li>Explain your data security measures</li>+ <li>Include user rights (access, deletion, portability)</li>+ <li>Provide clear contact information for privacy inquiries</li>+ <li>Explain how users can opt-out of data collection</li>+ <li>Include a change notification procedure</li>+ <li>Address children's privacy (if applicable)</li>+ </ul>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ How to Use This Privacy Policy Builder+ </h3>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Enter Your Details:</strong> Provide your company name, website URL, and contact email.+ </li>+ <li>+ <strong>Select Your Practices:</strong> Check the boxes that match your website's data collection practices.+ </li>+ <li>+ <strong>Generate Your Policy:</strong> The tool will create a comprehensive privacy policy tailored to your+ selections.+ </li>+ <li>+ <strong>Review and Customize:</strong> Download the policy and review it carefully. Add jurisdiction-specific+ clauses if needed.+ </li>+ <li>+ <strong>Publish and Link:</strong> Add the policy to your website footer and ensure easy access from all pages.+ </li>+ <li>+ <strong>Keep Updated:</strong> Review quarterly or whenever your data practices change.+ </li>+ </ol>++ <div className="bg-yellow-50 dark:bg-yellow-950/30 border border-yellow-200 dark:border-yellow-900 rounded-xl p-6 my-6">+ <p className="text-sm text-yellow-900 dark:text-yellow-200">+ <strong>Disclaimer:</strong> This privacy policy is provided as a starting point and should not be considered+ legal advice. Privacy laws vary by jurisdiction (GDPR, CCPA, etc.) and your specific business needs. Please+ consult with a legal professional to ensure compliance with applicable laws and regulations in your+ jurisdiction.+ </p>+ </div>+ </>+);++const faqs = [+ {+ question: "Do I need a privacy policy for my website?",+ answer: (+ <>+ Yes, if you collect any personal information from visitors (including analytics data), you're legally required+ to have a privacy policy in most jurisdictions. This includes the EU (GDPR), California (CCPA), and many other+ regions. Even if you don't collect personal data, having a privacy policy builds trust with your users and+ demonstrates your commitment to privacy.+ </>+ ),+ },+ {+ question: "What should a comprehensive privacy policy include?",+ answer: (+ <>+ A comprehensive privacy policy should include: what information you collect, how you collect it, how you use it,+ who you share it with, how you protect it, user rights (access, deletion, etc.), cookie usage, contact+ information, children's privacy practices (if applicable), and how you notify users of changes. This tool covers+ all essential sections to help ensure compliance.+ </>+ ),+ },+ {+ question: "Is analytics data considered personal data under GDPR?",+ answer: (+ <>+ Under GDPR and similar regulations, IP addresses and analytics data can be considered personal data. However,+ privacy-focused analytics tools like{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit+ </Link>{" "}+ don't use cookies and anonymize data, making compliance much easier. If you use privacy-first analytics, you+ typically won't need a cookie consent banner.+ </>+ ),+ },+ {+ question: "How often should I update my privacy policy?",+ answer: (+ <>+ You should update your privacy policy whenever your data practices change, such as adding new analytics tools,+ integrating third-party services, or modifying how you collect or use data. At minimum, conduct a thorough+ review quarterly. Always inform users of significant changes.+ </>+ ),+ },+ {+ question: "Can I use this generated policy without consulting a lawyer?",+ answer: (+ <>+ This tool provides a comprehensive starting point for most websites. However, if you handle sensitive data+ (health, financial info), operate in regulated industries, serve international users, or have specific legal+ concerns, consulting a legal professional is recommended to ensure full compliance with applicable laws in your+ jurisdiction.+ </>+ ),+ },+];export default function PrivacyPolicyBuilderPage() {- const [companyName, setCompanyName] = useState("");- const [websiteUrl, setWebsiteUrl] = useState("");- const [contactEmail, setContactEmail] = useState("");- const [collectsPersonalData, setCollectsPersonalData] = useState(false);- const [usesCookies, setUsesCookies] = useState(false);- const [usesAnalytics, setUsesAnalytics] = useState(false);- const [sharesData, setSharesData] = useState(false);- const [copied, setCopied] = useState(false);-- const generatePolicy = () => {- if (!companyName || !websiteUrl || !contactEmail) return "";-- const today = new Date().toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" });-- return `# Privacy Policy--**Last updated: ${today}**--This Privacy Policy describes how ${companyName} ("we", "us", or "our") collects, uses, and shares information when you visit ${websiteUrl} (the "Site").--## Information We Collect--${- collectsPersonalData- ? `### Personal Information--When you visit our Site, we may collect certain personal information that you voluntarily provide to us, such as:--- Name and contact information (email address, phone number)-- Account credentials-- Payment information-- Any other information you choose to provide`- : "We do not collect personal information from visitors to our Site unless voluntarily provided."-}--${- usesCookies- ? `### Cookies and Tracking Technologies--We use cookies and similar tracking technologies to track activity on our Site and hold certain information. Cookies are files with a small amount of data that are stored on your device. You can instruct your browser to refuse all cookies or to indicate when a cookie is being sent.`- : "We do not use cookies or similar tracking technologies on our Site."-}--${- usesAnalytics- ? `### Analytics--We use analytics services to help us understand how visitors use our Site. These services may collect information such as:--- Pages visited-- Time spent on pages-- Links clicked-- Browser type and version-- Device information-- IP address (anonymized)`- : ""-}--## How We Use Your Information--We use the information we collect to:--- Provide, maintain, and improve our Site-- Respond to your inquiries and requests-${collectsPersonalData ? "- Send you updates and marketing communications (with your consent)" : ""}-- Monitor and analyze usage patterns-- Detect, prevent, and address technical issues--## Information Sharing--${- sharesData- ? `We may share your information with:--- Service providers who assist us in operating our Site-- Business partners with your consent-- Law enforcement or regulatory authorities when required by law-- In connection with a merger, sale, or acquisition of our business--We do not sell your personal information to third parties.`- : "We do not share your personal information with third parties, except as required by law."-}--## Data Security--We implement appropriate technical and organizational measures to protect your information against unauthorized access, alteration, disclosure, or destruction.--## Your Rights--Depending on your location, you may have certain rights regarding your personal information, including:--- The right to access your personal information-- The right to correct inaccurate information-- The right to delete your information-- The right to object to or restrict processing-- The right to data portability--To exercise these rights, please contact us at ${contactEmail}.--## Children's Privacy--Our Site is not intended for children under the age of 13. We do not knowingly collect personal information from children under 13.--## Changes to This Privacy Policy--We may update this Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page and updating the "Last updated" date.--## Contact Us--If you have any questions about this Privacy Policy, please contact us at:--**Email:** ${contactEmail}-**Website:** ${websiteUrl}-------*This privacy policy was generated using ${websiteUrl.includes("rybbit") ? "Rybbit's" : "[Rybbit's](https://rybbit.com)"} Privacy Policy Builder. For compliance with specific regulations (GDPR, CCPA, etc.), please consult with a legal professional.*`;- };-- const policy = generatePolicy();-- const copyToClipboard = async () => {- if (policy) {- await navigator.clipboard.writeText(policy);- setCopied(true);- setTimeout(() => setCopied(false), 2000);- }- };-- const downloadPolicy = () => {- if (!policy) return;-- const blob = new Blob([policy], { type: "text/markdown" });- const url = URL.createObjectURL(blob);- const a = document.createElement("a");- a.href = url;- a.download = "privacy-policy.md";- document.body.appendChild(a);- a.click();- document.body.removeChild(a);- URL.revokeObjectURL(url);- };-- const clearForm = () => {- setCompanyName("");- setWebsiteUrl("");- setContactEmail("");- setCollectsPersonalData(false);- setUsesCookies(false);- setUsesAnalytics(false);- setSharesData(false);- setCopied(false);- };-return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Privacy Policy Builder- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Generate a customized privacy policy for your website. Answer a few questions and get a compliant privacy policy instantly.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Company Name */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Company Name <span className="text-red-500">*</span>- </label>- <input- type="text"- value={companyName}- onChange={e => setCompanyName(e.target.value)}- placeholder="Acme Inc."- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>-- {/* Website URL */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Website URL <span className="text-red-500">*</span>- </label>- <input- type="text"- value={websiteUrl}- onChange={e => setWebsiteUrl(e.target.value)}- placeholder="https://example.com"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>-- {/* Contact Email */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Contact Email <span className="text-red-500">*</span>- </label>- <input- type="email"- value={contactEmail}- onChange={e => setContactEmail(e.target.value)}- placeholder="[email protected]"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>-- {/* Checkboxes */}- <div className="space-y-3 pt-4 border-t border-neutral-200 dark:border-neutral-800">- <p className="text-sm font-medium text-neutral-900 dark:text-white mb-3">What does your website do?</p>-- <label className="flex items-start gap-3 cursor-pointer">- <input- type="checkbox"- checked={collectsPersonalData}- onChange={e => setCollectsPersonalData(e.target.checked)}- className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"- />- <div>- <div className="text-sm font-medium text-neutral-900 dark:text-white">Collects personal data</div>- <div className="text-xs text-neutral-600 dark:text-neutral-400">- Name, email, phone number, payment info, etc.- </div>- </div>- </label>-- <label className="flex items-start gap-3 cursor-pointer">- <input- type="checkbox"- checked={usesCookies}- onChange={e => setUsesCookies(e.target.checked)}- className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"- />- <div>- <div className="text-sm font-medium text-neutral-900 dark:text-white">Uses cookies</div>- <div className="text-xs text-neutral-600 dark:text-neutral-400">- Session cookies, tracking cookies, etc.- </div>- </div>- </label>-- <label className="flex items-start gap-3 cursor-pointer">- <input- type="checkbox"- checked={usesAnalytics}- onChange={e => setUsesAnalytics(e.target.checked)}- className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"- />- <div>- <div className="text-sm font-medium text-neutral-900 dark:text-white">Uses analytics</div>- <div className="text-xs text-neutral-600 dark:text-neutral-400">- Google Analytics, Rybbit, Plausible, etc.- </div>- </div>- </label>-- <label className="flex items-start gap-3 cursor-pointer">- <input- type="checkbox"- checked={sharesData}- onChange={e => setSharesData(e.target.checked)}- className="mt-1 w-4 h-4 text-emerald-600 border-neutral-300 dark:border-neutral-700 rounded focus:ring-emerald-500"- />- <div>- <div className="text-sm font-medium text-neutral-900 dark:text-white">Shares data with third parties</div>- <div className="text-xs text-neutral-600 dark:text-neutral-400">- Service providers, partners, advertisers, etc.- </div>- </div>- </label>- </div>-- {/* Preview */}- {policy && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">- <div className="flex items-center justify-between mb-3">- <label className="block text-sm font-medium text-neutral-900 dark:text-white">- Your Privacy Policy (Markdown)- </label>- <div className="flex gap-2">- <button- onClick={copyToClipboard}- className="px-4 py-2 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white text-sm font-medium rounded-lg transition-colors flex items-center gap-2"- >- {copied ? <CheckCircle className="w-4 h-4" /> : <Copy className="w-4 h-4" />}- {copied ? "Copied!" : "Copy"}- </button>- <button- onClick={downloadPolicy}- className="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition-colors"- >- Download- </button>- </div>- </div>- <div className="max-h-96 overflow-y-auto p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg">- <pre className="text-xs text-neutral-900 dark:text-neutral-100 whitespace-pre-wrap font-mono">- {policy}- </pre>- </div>- </div>- )}-- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>-- {/* Warning */}- <div className="bg-yellow-50 dark:bg-yellow-950/30 border border-yellow-200 dark:border-yellow-900 rounded-xl p-6 mb-12">- <p className="text-sm text-yellow-900 dark:text-yellow-200">- <strong>Disclaimer:</strong> This privacy policy is provided as a starting point and should not be considered legal advice. Privacy laws vary by jurisdiction (GDPR, CCPA, etc.) and your specific business needs. Please consult with a legal professional to ensure compliance with applicable laws and regulations.- </p>- </div>-- {/* FAQ Section */}- <div className="mb-12">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Privacy Policy FAQs</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Do I need a privacy policy?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Yes, if you collect any personal information from visitors (including analytics data), you're legally required to have a privacy policy in most jurisdictions. This includes the EU (GDPR), California (CCPA), and many other regions. Even if you don't collect personal data, having a privacy policy builds trust with your users.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What should a privacy policy include?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A comprehensive privacy policy should include: what information you collect, how you collect it, how you use it, who you share it with, how you protect it, user rights (access, deletion, etc.), cookie usage, contact information, and how you notify users of changes.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Is analytics considered personal data?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Under GDPR and similar regulations, IP addresses and analytics data can be considered personal data. However, privacy-focused analytics tools like Rybbit don't use cookies and anonymize data, making compliance much easier. If you use Rybbit, you typically won't need a cookie consent banner.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>-- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Privacy-first analytics with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- No cookies, no tracking, full GDPR compliance. Get powerful analytics without compromising your users' privacy.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "privacy_policy_builder_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="privacy-policy-builder"+ title="Privacy Policy Builder"+ description="Generate a customized, compliant privacy policy for your website in minutes. Answer a few questions and download your policy instantly."+ badge="Free Tool"+ toolComponent={<PrivacyPolicyBuilderForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="privacy"+ ctaTitle="Stay compliant with privacy-first analytics"+ ctaDescription="Rybbit doesn't use cookies and anonymizes all data, making GDPR and CCPA compliance simple. No cookie banners needed."+ ctaEventLocation="privacy_policy_builder_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/sample-size-calculator/SampleSizeForm.tsx b/docs/src/app/(home)/tools/sample-size-calculator/SampleSizeForm.tsxnew file mode 100644index 000000000..ae73ef64f--- /dev/null+++ b/docs/src/app/(home)/tools/sample-size-calculator/SampleSizeForm.tsx@@ -0,0 +1,178 @@+"use client";++import { useState } from "react";++export function SampleSizeForm() {+ const [baselineConversion, setBaselineConversion] = useState("");+ const [minimumDetectableEffect, setMinimumDetectableEffect] = useState("");+ const [confidenceLevel, setConfidenceLevel] = useState("95");+ const [statisticalPower, setStatisticalPower] = useState("80");++ const calculateSampleSize = () => {+ const baseline = parseFloat(baselineConversion) / 100;+ const mde = parseFloat(minimumDetectableEffect) / 100;+ const alpha = confidenceLevel === "90" ? 0.10 : confidenceLevel === "95" ? 0.05 : 0.01;+ const beta = statisticalPower === "80" ? 0.20 : 0.10;++ if (!baseline || !mde || baseline <= 0 || baseline >= 1) return null;++ // Z-scores for different confidence levels and power+ const zAlpha = confidenceLevel === "90" ? 1.645 : confidenceLevel === "95" ? 1.96 : 2.576;+ const zBeta = statisticalPower === "80" ? 0.84 : 1.28;++ // Alternative conversion rate+ const p2 = baseline + mde;++ // Average of the two proportions+ const pBar = (baseline + p2) / 2;++ // Sample size formula for proportions+ const n = Math.pow((zAlpha + zBeta), 2) * 2 * pBar * (1 - pBar) / Math.pow(mde, 2);++ return Math.ceil(n);+ };++ const sampleSize = calculateSampleSize();+ const totalVisitors = sampleSize ? sampleSize * 2 : null; // Total for both variants++ const clearForm = () => {+ setBaselineConversion("");+ setMinimumDetectableEffect("");+ setConfidenceLevel("95");+ setStatisticalPower("80");+ };++ return (+ <div className="space-y-6">+ {/* Baseline Conversion Rate */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Baseline Conversion Rate <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.1"+ value={baselineConversion}+ onChange={e => setBaselineConversion(e.target.value)}+ placeholder="2.5"+ className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your current conversion rate (control variant)</p>+ </div>++ {/* Minimum Detectable Effect */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Minimum Detectable Effect (MDE) <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.1"+ value={minimumDetectableEffect}+ onChange={e => setMinimumDetectableEffect(e.target.value)}+ placeholder="0.5"+ className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Smallest improvement you want to detect (e.g., 0.5% absolute increase)+ </p>+ </div>++ {/* Confidence Level */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Confidence Level</label>+ <select+ value={confidenceLevel}+ onChange={e => setConfidenceLevel(e.target.value)}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"+ >+ <option value="90">90% (10% chance of false positive)</option>+ <option value="95">95% (5% chance of false positive) - Recommended</option>+ <option value="99">99% (1% chance of false positive)</option>+ </select>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ How confident you want to be in your results+ </p>+ </div>++ {/* Statistical Power */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Statistical Power</label>+ <select+ value={statisticalPower}+ onChange={e => setStatisticalPower(e.target.value)}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"+ >+ <option value="80">80% (20% chance of false negative) - Recommended</option>+ <option value="90">90% (10% chance of false negative)</option>+ </select>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Probability of detecting an effect if it exists+ </p>+ </div>++ {/* Results */}+ {sampleSize !== null && totalVisitors !== null && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Sample Size Per Variant+ </label>+ <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">+ <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">+ {sampleSize.toLocaleString()}+ </div>+ <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">visitors per variant (A and B)</div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Total Test Size+ </label>+ <div className="px-4 py-6 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">+ <div className="text-4xl font-bold text-blue-600 dark:text-blue-400">+ {totalVisitors.toLocaleString()}+ </div>+ <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">total visitors needed</div>+ </div>+ </div>++ <div className="p-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">+ <p className="text-sm text-blue-900 dark:text-blue-200">+ <strong>Test Duration:</strong> If you get 1,000 visitors per day, you'll need approximately{" "}+ <strong>{Math.ceil(totalVisitors / 1000)} days</strong> to complete this test. At 5,000 visitors per day,+ you'll need <strong>{Math.ceil(totalVisitors / 5000)} days</strong>.+ </p>+ </div>++ <div className="p-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg">+ <h3 className="font-semibold text-neutral-900 dark:text-white mb-2">What this means:</h3>+ <ul className="text-sm text-neutral-700 dark:text-neutral-300 space-y-1">+ <li>• You need {sampleSize.toLocaleString()} visitors to see variant A (control)</li>+ <li>• You need {sampleSize.toLocaleString()} visitors to see variant B (treatment)</li>+ <li>• This gives you {confidenceLevel}% confidence in detecting a {minimumDetectableEffect}% improvement</li>+ <li>• With {statisticalPower}% power to avoid false negatives</li>+ </ul>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/sample-size-calculator/page.tsx b/docs/src/app/(home)/tools/sample-size-calculator/page.tsxindex 6e6ff6ca2..7a9e45430 100644--- a/docs/src/app/(home)/tools/sample-size-calculator/page.tsx+++ b/docs/src/app/(home)/tools/sample-size-calculator/page.tsx@@ -1,261 +1,350 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";+import { Metadata } from "next";import Link from "next/link";-import { useState } from "react";--export default function SampleSizeCalculatorPage() {- const [baselineConversion, setBaselineConversion] = useState("");- const [minimumDetectableEffect, setMinimumDetectableEffect] = useState("");- const [confidenceLevel, setConfidenceLevel] = useState("95");- const [statisticalPower, setStatisticalPower] = useState("80");-- const calculateSampleSize = () => {- const baseline = parseFloat(baselineConversion) / 100;- const mde = parseFloat(minimumDetectableEffect) / 100;- const alpha = confidenceLevel === "90" ? 0.10 : confidenceLevel === "95" ? 0.05 : 0.01;- const beta = statisticalPower === "80" ? 0.20 : 0.10;-- if (!baseline || !mde || baseline <= 0 || baseline >= 1) return null;+import { SampleSizeForm } from "./SampleSizeForm";+import { ToolPageLayout } from "../components/ToolPageLayout";- // Z-scores for different confidence levels and power- const zAlpha = confidenceLevel === "90" ? 1.645 : confidenceLevel === "95" ? 1.96 : 2.576;- const zBeta = statisticalPower === "80" ? 0.84 : 1.28;+export const metadata: Metadata = {+ title: "Free Sample Size Calculator | A/B Test Sample Size Calculator for Marketing",+ description:+ "Calculate the sample size needed for statistically significant A/B test results. Determine confidence levels, statistical power, and minimum detectable effect. Never run underpowered tests again with our free A/B testing calculator.",+ openGraph: {+ title: "Free Sample Size Calculator | A/B Test Sample Size Calculator",+ description:+ "Calculate how many visitors you need for statistically significant A/B test results. Get accurate sample size calculations with confidence levels and statistical power.",+ type: "website",+ url: "https://rybbit.com/tools/sample-size-calculator",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Sample Size Calculator for A/B Tests",+ description:+ "Calculate sample size needed for statistically significant A/B test results. Determine confidence levels and statistical power.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/sample-size-calculator",+ },+};- // Alternative conversion rate- const p2 = baseline + mde;+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "A/B Test Sample Size Calculator",+ applicationCategory: "Statistics Tool",+ description: "Free tool to calculate the sample size needed for statistically significant A/B testing results",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ featureList: [+ "Accurate sample size calculation",+ "Configurable confidence levels (90%, 95%, 99%)",+ "Adjustable statistical power (80%, 90%)",+ "Minimum detectable effect customization",+ "Test duration estimation",+ "Real-time results visualization",+ ],+ operatingSystem: "Any",+ url: "https://rybbit.com/tools/sample-size-calculator",+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is sample size in A/B testing?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Sample size is the number of visitors or observations required in each test variant (control and treatment) to reach statistical significance. It's calculated based on your baseline conversion rate, the minimum detectable effect (smallest improvement you want to reliably detect), the confidence level (how certain you want to be), and statistical power (probability of detecting the effect if it exists). Proper sample size ensures your A/B test results are reliable and not due to random chance.",+ },+ },+ {+ "@type": "Question",+ name: "Why does minimum detectable effect matter?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Minimum detectable effect (MDE) defines the smallest improvement you want to detect in your A/B test. For example, a 0.5% improvement in conversion rate or a 2% improvement. Smaller MDEs require much larger sample sizes because you need more data to distinguish tiny differences from random variation. A 0.1% improvement might need 10x more visitors than a 1% improvement. Setting realistic MDEs based on business impact helps you balance statistical rigor with practical feasibility.",+ },+ },+ {+ "@type": "Question",+ name: "What is statistical significance and why does it matter for A/B tests?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Statistical significance measures whether the difference between your control and treatment variants is real or just due to random chance. A statistically significant result typically means there's less than a 5% probability (at 95% confidence) that the difference occurred by chance alone. Without sufficient sample size, you might see a 'winning' variant that's actually just lucky variation. Reaching statistical significance requires hitting the calculated sample size, which is why you shouldn't stop A/B tests early even if you see early winners.",+ },+ },+ {+ "@type": "Question",+ name: "What is the difference between confidence level and statistical power?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Confidence level (often 95%) measures the risk of Type I error - claiming a difference exists when it doesn't (false positive). A 95% confidence level means you accept a 5% chance of false positives. Statistical power (typically 80%) measures the risk of Type II error - missing a real difference when it exists (false negative). An 80% power means you have a 20% chance of missing a real effect if it exists. Both matter: 95% confidence and 80% power are standard in A/B testing as they balance risk appropriately.",+ },+ },+ {+ "@type": "Question",+ name: "How long should I run my A/B test?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Run your A/B test until you've reached the calculated sample size, regardless of what the results look like mid-test. The duration depends on your daily visitor volume. If you need 10,000 visitors total and get 1,000/day, you'll need about 10 days. At 5,000/day, that's 2 days. Running tests longer than needed wastes resources, but stopping early risks false positives - you might declare a 'winner' that's just random luck. Use analytics to track progress toward your sample size goal.",+ },+ },+ {+ "@type": "Question",+ name: "What baseline conversion rate should I use?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Your baseline conversion rate is your current control variant's conversion rate. If you're testing a website redesign and currently 2.5% of visitors convert, use 2.5% as your baseline. You can get this from your analytics tools (Google Analytics, Rybbit Analytics, etc.). Use your most recent data that's representative of normal traffic. Seasonal variations and traffic changes can affect your baseline, so update it if conditions change significantly. More accurate baselines lead to more realistic sample size calculations.",+ },+ },+ ],+ },+ ],+};- // Average of the two proportions- const pBar = (baseline + p2) / 2;+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What Is Sample Size?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Sample size is the number of visitors or observations needed in each variant (control and treatment) of your A/B+ test to achieve statistical significance. It's a critical calculation that determines whether your test results+ are reliable or just due to random chance.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Without proper sample size, you risk two costly mistakes: (1) declaring a "winning" variant that's actually just+ lucky variation (Type I error), or (2) missing a real improvement because you didn't collect enough data (Type II+ error). The correct sample size balances these risks based on your specific test parameters.+ </p>- // Sample size formula for proportions- const n = Math.pow((zAlpha + zBeta), 2) * 2 * pBar * (1 - pBar) / Math.pow(mde, 2);+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Why Sample Size Matters for A/B Tests+ </h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Avoid False Positives:</strong> Adequate sample size reduces the risk of declaring a winner when the+ difference is just random fluctuation. At 95% confidence, you accept only a 5% chance of being wrong.+ </li>+ <li>+ <strong>Detect Real Improvements:</strong> Proper power (typically 80%) ensures you have a high probability of+ catching real improvements when they exist, avoiding missed opportunities.+ </li>+ <li>+ <strong>Business Confidence:</strong> Statistically significant results give you confidence to implement changes+ with real revenue impact, rather than relying on gut feeling.+ </li>+ <li>+ <strong>Efficient Resource Allocation:</strong> Knowing your sample size upfront prevents wasting time and+ resources running tests longer than needed or stopping early out of impatience.+ </li>+ </ul>- return Math.ceil(n);- };-- const sampleSize = calculateSampleSize();- const totalVisitors = sampleSize ? sampleSize * 2 : null; // Total for both variants-- const clearForm = () => {- setBaselineConversion("");- setMinimumDetectableEffect("");- setConfidenceLevel("95");- setStatisticalPower("80");- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- A/B Test Sample Size Calculator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Calculate how many visitors you need for statistically significant A/B test results. Never run underpowered tests again.- </p>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Understanding Statistical Significance+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Statistical significance answers the question: "Is this result real, or just random chance?" A result is+ statistically significant when the probability of observing it by chance alone (if there were truly no difference)+ is very small - typically less than 5%.+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>P-Value:</strong> The p-value is the probability of seeing your results if there's actually no+ difference. A p-value of 0.03 (3%) means there's only a 3% chance this difference occurred randomly. With 95%+ confidence, you need p < 0.05.+ </li>+ <li>+ <strong>Confidence Interval:</strong> A 95% confidence interval around your observed effect means if you+ repeated the test 100 times, the true effect would fall within this range 95 times. Wider intervals indicate+ less certainty; narrower ones indicate more precision.+ </li>+ <li>+ <strong>Statistical vs. Practical Significance:</strong> A result can be statistically significant (real+ difference exists) but practically insignificant (too small to matter). Conversely, a practically significant+ result might not reach statistical significance without enough data. Both matter for good business decisions.+ </li>+ </ul>- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Baseline Conversion Rate */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Baseline Conversion Rate <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.1"- value={baselineConversion}- onChange={e => setBaselineConversion(e.target.value)}- placeholder="2.5"- className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Your current conversion rate (control variant)</p>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Confidence Levels and Statistical Power+ </h2>- {/* Minimum Detectable Effect */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Minimum Detectable Effect (MDE) <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.1"- value={minimumDetectableEffect}- onChange={e => setMinimumDetectableEffect(e.target.value)}- placeholder="0.5"- className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Smallest improvement you want to detect (e.g., 0.5% absolute increase)- </p>- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">+ Confidence Level (Type I Error Protection)+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>90% - 10% false positive risk:</strong> More lenient, detects effects with fewer visitors. Use when+ speed matters and you can tolerate higher false positive risk.+ </li>+ <li>+ <strong>95% - 5% false positive risk:</strong> Industry standard. Recommended for most A/B tests. Provides good+ balance between safety and efficiency.+ </li>+ <li>+ <strong>99% - 1% false positive risk:</strong> Very strict, requires more visitors. Use only when false+ positives are extremely costly.+ </li>+ </ul>- {/* Confidence Level */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Confidence Level</label>- <select- value={confidenceLevel}- onChange={e => setConfidenceLevel(e.target.value)}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"- >- <option value="90">90% (10% chance of false positive)</option>- <option value="95">95% (5% chance of false positive) - Recommended</option>- <option value="99">99% (1% chance of false positive)</option>- </select>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- How confident you want to be in your results- </p>- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">+ Statistical Power (Type II Error Protection)+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>80% - 20% false negative risk:</strong> Standard in A/B testing. Recommended for most tests. Good+ balance of detecting real effects while managing sample size.+ </li>+ <li>+ <strong>90% - 10% false negative risk:</strong> More strict, requires more visitors. Use when missing+ improvements is very costly.+ </li>+ </ul>- {/* Statistical Power */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Statistical Power</label>- <select- value={statisticalPower}- onChange={e => setStatisticalPower(e.target.value)}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"- >- <option value="80">80% (20% chance of false negative) - Recommended</option>- <option value="90">90% (10% chance of false negative)</option>- </select>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Probability of detecting an effect if it exists- </p>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Minimum Detectable Effect (MDE)</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Minimum detectable effect is the smallest change in conversion rate (or other metric) that your test is powered to+ detect reliably. It's expressed as an absolute percentage point change.+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>0.1% MDE:</strong> 2.5% → 2.6% conversion - Very large sample size (hundreds of thousands)+ </li>+ <li>+ <strong>0.5% MDE:</strong> 2.5% → 3.0% conversion - Large sample size (tens of thousands)+ </li>+ <li>+ <strong>1.0% MDE:</strong> 2.5% → 3.5% conversion - Moderate sample size (thousands)+ </li>+ <li>+ <strong>5.0% MDE:</strong> 2.5% → 7.5% conversion - Small sample size (hundreds)+ </li>+ </ul>+ <p className="text-neutral-700 dark:text-neutral-300 mb-6">+ Smaller MDEs require exponentially larger sample sizes. Define your MDE based on business impact: what's the+ smallest improvement worth implementing? If a 0.5% improvement would save $100K/year, that's worth detecting; if a+ 0.1% improvement would only save $5K, you might not need to detect it.+ </p>- {/* Results */}- {sampleSize !== null && totalVisitors !== null && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Sample Size Per Variant- </label>- <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">- <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">- {sampleSize.toLocaleString()}- </div>- <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">visitors per variant (A and B)</div>- </div>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Use This Calculator</h2>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Enter Your Baseline Conversion Rate:</strong> Get this from your analytics (Google Analytics, Rybbit,+ etc.). If 100 visitors and 3 convert, your baseline is 3%. Use your most recent representative data.+ </li>+ <li>+ <strong>Define Your Minimum Detectable Effect:</strong> What's the smallest improvement worth detecting? If your+ baseline is 2%, a 0.5% MDE means you want to reliably detect moving to 2.5% or higher. Think about business+ impact, not just percentage points.+ </li>+ <li>+ <strong>Choose Your Confidence Level (Default: 95%):</strong> 95% is standard and recommended. This means you+ accept a 5% chance that your result is a false positive. Only use 90% if time is critical, or 99% if false+ positives are extremely costly.+ </li>+ <li>+ <strong>Select Your Statistical Power (Default: 80%):</strong> 80% power is standard, meaning you accept a 20%+ chance of missing a real improvement. Use 90% if missing improvements is very costly (requires larger sample+ size).+ </li>+ <li>+ <strong>Calculate and Plan Your Test:</strong> The calculator shows the required sample size per variant, total+ visitors needed, and estimated test duration. Use Rybbit Analytics to monitor progress and track when you reach+ statistical significance.+ </li>+ </ol>+ </>+);- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Total Test Size- </label>- <div className="px-4 py-6 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">- <div className="text-4xl font-bold text-blue-600 dark:text-blue-400">- {totalVisitors.toLocaleString()}- </div>- <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">total visitors needed</div>- </div>- </div>+const faqs = [+ {+ question: "What is sample size in A/B testing?",+ answer: (+ <>+ Sample size is the number of visitors needed in each test variant (control and treatment) to reach statistical+ significance. It's calculated based on your baseline conversion rate, the minimum detectable effect you want to+ find, your desired confidence level, and statistical power. Proper sample size ensures your A/B test results are+ reliable and not due to random chance.+ </>+ ),+ },+ {+ question: "Why does MDE matter for sample size?",+ answer: (+ <>+ Minimum detectable effect (MDE) defines the smallest improvement you want to reliably detect. Smaller MDEs+ require exponentially larger sample sizes. For example, detecting a 0.5% improvement might require 10 times more+ visitors than detecting a 5% improvement. Set your MDE based on business impact: what's the smallest improvement+ worth implementing? This helps balance statistical rigor with practical feasibility.+ </>+ ),+ },+ {+ question: "What is statistical significance and why does it matter?",+ answer: (+ <>+ Statistical significance means the difference between your variants is real and not just due to random chance.+ At 95% confidence, a statistically significant result means there's less than a 5% probability the difference+ occurred randomly. Without sufficient sample size, you might see a "winning" variant that's just lucky+ variation. Reaching calculated sample size is critical - don't stop tests early even if you see early winners.+ </>+ ),+ },+ {+ question: "What is the difference between confidence level and statistical power?",+ answer: (+ <>+ Confidence level (typically 95%) measures Type I error - the risk of claiming a difference exists when it+ doesn't (false positive). At 95% confidence, you accept a 5% chance of being wrong. Statistical power (typically+ 80%) measures Type II error - the risk of missing a real difference when it exists (false negative). At 80%+ power, you have a 20% chance of missing a real effect. Both matter for reliable A/B testing.+ </>+ ),+ },+ {+ question: "How long should I run my A/B test?",+ answer: (+ <>+ Run your test until you reach the calculated sample size, even if you see apparent "winners" mid-test. Stopping+ early increases false positive risk. The duration depends on your daily visitor volume - if you need 10,000+ visitors and get 1,000/day, run it about 10 days. Use{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to track progress and know when you reach statistical significance.+ </>+ ),+ },+ {+ question: "What baseline conversion rate should I use?",+ answer: (+ <>+ Your baseline is your current control variant's conversion rate. Get this from your analytics tools. If 2.5% of+ visitors currently convert, use 2.5%. Use your most recent representative data. Seasonal variations and traffic+ changes can affect your baseline, so update it if conditions change. More accurate baselines lead to more+ realistic sample size calculations and test planning.+ </>+ ),+ },+];- <div className="p-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">- <p className="text-sm text-blue-900 dark:text-blue-200">- <strong>Test Duration:</strong> If you get 1,000 visitors per day, you'll need approximately{" "}- <strong>{Math.ceil(totalVisitors / 1000)} days</strong> to complete this test. At 5,000 visitors per day,- you'll need <strong>{Math.ceil(totalVisitors / 5000)} days</strong>.- </p>- </div>-- <div className="p-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg">- <h3 className="font-semibold text-neutral-900 dark:text-white mb-2">What this means:</h3>- <ul className="text-sm text-neutral-700 dark:text-neutral-300 space-y-1">- <li>• You need {sampleSize.toLocaleString()} visitors to see variant A (control)</li>- <li>• You need {sampleSize.toLocaleString()} visitors to see variant B (treatment)</li>- <li>• This gives you {confidenceLevel}% confidence in detecting a {minimumDetectableEffect}% improvement</li>- <li>• With {statisticalPower}% power to avoid false negatives</li>- </ul>- </div>- </div>- )}-- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding A/B Test Sample Sizes</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is minimum detectable effect (MDE)?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- MDE is the smallest change in conversion rate that you want to reliably detect. A smaller MDE requires a larger sample size. For example, detecting a 0.5% improvement requires many more visitors than detecting a 5% improvement.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Why do I need so many visitors?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Statistical significance requires enough data to distinguish real effects from random variation. Small sample sizes can lead to false positives (thinking something works when it doesn't) or false negatives (missing real improvements). Running tests to completion ensures reliable results.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- When should I stop my A/B test?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Run your test until you've reached the calculated sample size, even if you see early "winners." Stopping tests early increases the risk of false positives. Use{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to track your test progress and know when you've reached statistical significance.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Run better A/B tests with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- Track conversions, variants, and statistical significance in real-time. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "sample_size_calculator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+export default function SampleSizeCalculatorPage() {+ return (+ <ToolPageLayout+ toolSlug="sample-size-calculator"+ title="A/B Test Sample Size Calculator"+ description="Calculate how many visitors you need for statistically significant A/B test results. Never run underpowered tests again."+ badge="Free Tool"+ toolComponent={<SampleSizeForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Run better A/B tests with Rybbit"+ ctaDescription="Track conversions, variants, and statistical significance in real-time. Know exactly when you've reached statistical significance and avoid costly false positives."+ ctaEventLocation="sample_size_calculator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/seo-title-generator/SEOTitleForm.tsx b/docs/src/app/(home)/tools/seo-title-generator/SEOTitleForm.tsxnew file mode 100644index 000000000..04a1603db--- /dev/null+++ b/docs/src/app/(home)/tools/seo-title-generator/SEOTitleForm.tsx@@ -0,0 +1,199 @@+"use client";++import { TrackedButton } from "@/components/TrackedButton";+import { DEFAULT_EVENT_LIMIT } from "@/lib/const";+import { CheckCircle, Copy, Loader2 } from "lucide-react";+import Link from "next/link";+import { useState } from "react";++interface TitleOption {+ title: string;+ length: number;+ approach: string;+}++export function SEOTitleForm() {+ const [topic, setTopic] = useState("");+ const [keywords, setKeywords] = useState("");+ const [titles, setTitles] = useState<TitleOption[]>([]);+ const [isLoading, setIsLoading] = useState(false);+ const [error, setError] = useState("");+ const [copiedIndex, setCopiedIndex] = useState<number | null>(null);+ const [remainingRequests, setRemainingRequests] = useState<number | null>(null);++ const generateTitles = async () => {+ if (!topic) {+ setError("Please enter a topic");+ return;+ }++ setIsLoading(true);+ setError("");+ setTitles([]);++ try {+ const response = await fetch("/api/tools/generate-seo-title", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ topic, keywords: keywords || undefined }),+ });++ const remaining = response.headers.get("X-RateLimit-Remaining");+ if (remaining) setRemainingRequests(parseInt(remaining));++ if (!response.ok) {+ const data = await response.json();+ throw new Error(data.error || "Failed to generate titles");+ }++ const data = await response.json();+ setTitles(data.titles);+ } catch (err) {+ setError(err instanceof Error ? err.message : "An error occurred");+ } finally {+ setIsLoading(false);+ }+ };++ const copyTitle = async (title: string, index: number) => {+ await navigator.clipboard.writeText(title);+ setCopiedIndex(index);+ setTimeout(() => setCopiedIndex(null), 2000);+ };++ const getLengthColor = (length: number) => {+ if (length >= 50 && length <= 60) return "text-emerald-600 dark:text-emerald-400";+ if (length > 60 && length <= 70) return "text-orange-600 dark:text-orange-400";+ return "text-red-600 dark:text-red-400";+ };++ return (+ <>+ {remainingRequests !== null && (+ <p className="text-sm text-neutral-500 dark:text-neutral-400 mb-4">+ {remainingRequests} requests remaining this minute+ </p>+ )}++ <div className="mb-16">+ <div className="space-y-6">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Page Topic <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={topic}+ onChange={e => setTopic(e.target.value)}+ placeholder="e.g., Best Project Management Software for Teams"+ disabled={isLoading}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Target Keywords (Optional)+ </label>+ <input+ type="text"+ value={keywords}+ onChange={e => setKeywords(e.target.value)}+ placeholder="e.g., project management, team collaboration, productivity"+ disabled={isLoading}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">+ Comma-separated keywords to include+ </p>+ </div>++ {error && (+ <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">+ <p className="text-sm text-red-900 dark:text-red-200">{error}</p>+ </div>+ )}++ <button+ onClick={generateTitles}+ disabled={isLoading}+ className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"+ >+ {isLoading ? (+ <>+ <Loader2 className="w-5 h-5 animate-spin" />+ Generating Titles...+ </>+ ) : (+ "Generate SEO Titles"+ )}+ </button>++ {titles.length > 0 && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-3">+ <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">Generated Titles</h3>+ {titles.map((option, index) => (+ <div+ key={index}+ className="p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg hover:border-emerald-500/40 dark:hover:border-emerald-500/30 transition-colors"+ >+ <div className="flex items-start justify-between gap-4 mb-2">+ <p className="flex-1 text-neutral-900 dark:text-white font-medium">{option.title}</p>+ <button+ onClick={() => copyTitle(option.title, index)}+ className="flex-shrink-0 px-3 py-1.5 bg-neutral-200 dark:bg-neutral-700 hover:bg-neutral-300 dark:hover:bg-neutral-600 text-neutral-900 dark:text-white text-sm rounded-lg transition-colors flex items-center gap-2"+ >+ {copiedIndex === index ? (+ <>+ <CheckCircle className="w-4 h-4" />+ Copied+ </>+ ) : (+ <>+ <Copy className="w-4 h-4" />+ Copy+ </>+ )}+ </button>+ </div>+ <div className="flex items-center gap-4 text-xs">+ <span className={`font-medium ${getLengthColor(option.length)}`}>+ {option.length} characters+ </span>+ <span className="text-neutral-500 dark:text-neutral-400">•</span>+ <span className="text-neutral-600 dark:text-neutral-400">{option.approach}</span>+ </div>+ </div>+ ))}+ <div className="p-3 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">+ <p className="text-sm text-blue-900 dark:text-blue-200">+ <strong>Tip:</strong> Optimal title length is 50-60 characters. Longer titles may be truncated in search results.+ </p>+ </div>+ </div>+ )}+ </div>+ </div>++ {/* CTA */}+ <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20 -mx-6">+ <div className="max-w-4xl mx-auto px-6 text-center">+ <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">+ Track your SEO performance with Rybbit+ </h2>+ <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">+ See which pages drive organic traffic and optimize your titles based on real data. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.+ </p>+ <TrackedButton+ href="https://app.rybbit.io/signup"+ eventName="signup"+ eventProps={{ location: "seo_title_generator_cta" }}+ className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"+ >+ Start tracking for free+ </TrackedButton>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/seo-title-generator/page.tsx b/docs/src/app/(home)/tools/seo-title-generator/page.tsxindex 85e564795..e568f6438 100644--- a/docs/src/app/(home)/tools/seo-title-generator/page.tsx+++ b/docs/src/app/(home)/tools/seo-title-generator/page.tsx@@ -1,254 +1,237 @@-"use client";--import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { CheckCircle, Copy, Loader2 } from "lucide-react";+import { ToolPageLayout } from "../components/ToolPageLayout";+import { SEOTitleForm } from "./SEOTitleForm";import Link from "next/link";-import { useState } from "react";--interface TitleOption {- title: string;- length: number;- approach: string;-}+import { Metadata } from "next";++export const metadata: Metadata = {+ title: "Free SEO Title Generator | AI-Powered Title Tag Creator for Better Rankings",+ description:+ "Generate optimized SEO title tags in seconds with our free AI-powered tool. Get multiple title variations, character count validation, and SEO best practices. Perfect for improving click-through rates and search rankings.",+ openGraph: {+ title: "Free SEO Title Generator | Create Optimized Title Tags",+ description:+ "AI-powered tool to generate click-worthy SEO titles. Free, unlimited use. Optimize your title tags for better search engine rankings.",+ type: "website",+ url: "https://rybbit.com/tools/seo-title-generator",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free SEO Title Generator",+ description: "Generate optimized SEO titles with AI in seconds. Free tool with unlimited use.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/seo-title-generator",+ },+};++const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "SEO Title Generator",+ applicationCategory: "SEO Tool",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ featureList: [+ "AI-powered title generation",+ "Character count validation",+ "Multiple title variations",+ "SEO best practices",+ "Real-time optimization",+ ],+ operatingSystem: "Any",+ url: "https://rybbit.com/tools/seo-title-generator",+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What makes a good SEO title?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "A good SEO title is 50-60 characters, includes your primary keyword, accurately describes the page content, and is compelling enough to attract clicks. Front-load important keywords and make it unique for each page.",+ },+ },+ {+ "@type": "Question",+ name: "Why is title length important?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Google typically displays the first 50-60 characters of a title tag. Longer titles get truncated with '...' which can reduce click-through rates. Keep your most important information at the start.",+ },+ },+ {+ "@type": "Question",+ name: "How do I track title performance?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Use analytics to track CTR from search results. Tools like Rybbit can show you which pages get the most organic traffic, helping you identify successful titles and opportunities for improvement.",+ },+ },+ {+ "@type": "Question",+ name: "Should I include my brand name in the title tag?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Include your brand name at the end of the title tag if you have characters to spare, especially for branded searches. Format: 'Primary Keyword - Secondary Keyword | Brand Name'. For homepage and key landing pages, brand name can be more prominent.",+ },+ },+ {+ "@type": "Question",+ name: "How often should I update my title tags?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Update title tags when you notice declining CTR, keyword rankings drop, or when your content significantly changes. Test new titles during seasonal campaigns or when targeting new keywords. Monitor performance for 2-4 weeks before making additional changes.",+ },+ },+ ],+ },+ ],+};++const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">Why SEO Title Tags Matter</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Your title tag is one of the most important on-page SEO elements. It appears in search engine results pages+ (SERPs) as the clickable headline and tells both search engines and users what your page is about. A well-crafted+ title tag can significantly improve your click-through rate (CTR) and search rankings.+ </p>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">Best Practices for SEO Titles</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Keep it 50-60 characters:</strong> Search engines typically display the first 50-60 characters. Anything+ longer gets truncated with an ellipsis.+ </li>+ <li>+ <strong>Include your primary keyword:</strong> Place your main keyword near the beginning of the title for+ maximum SEO impact.+ </li>+ <li>+ <strong>Make it compelling:</strong> Your title should entice users to click. Use power words, numbers, or+ questions when appropriate.+ </li>+ <li>+ <strong>Be unique:</strong> Each page should have a unique title tag that accurately describes its specific+ content.+ </li>+ <li>+ <strong>Match search intent:</strong> Align your title with what users are actually searching for and expecting+ to find.+ </li>+ <li>+ <strong>Include modifiers:</strong> Words like "best," "guide," "2024," or "free" can help you rank for+ long-tail variations.+ </li>+ </ul>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ Common Title Tag Mistakes to Avoid+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Keyword stuffing:</strong> Don't repeat the same keyword multiple times. It looks spammy and can hurt+ rankings.+ </li>+ <li>+ <strong>Being too vague:</strong> Generic titles like "Home" or "Products" don't help users or search engines+ understand your content.+ </li>+ <li>+ <strong>Duplicate titles:</strong> Using the same title across multiple pages confuses search engines about+ which page to rank.+ </li>+ <li>+ <strong>Ignoring branding:</strong> For established brands, omitting your brand name can reduce branded search+ visibility.+ </li>+ <li>+ <strong>Writing for bots, not humans:</strong> While keywords matter, your title should still read naturally and+ appeal to real people.+ </li>+ </ul>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-8">+ How to Use This SEO Title Generator+ </h3>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Enter your page topic:</strong> Describe what your page is about in a few words.+ </li>+ <li>+ <strong>Add target keywords (optional):</strong> Include specific keywords you want to rank for, separated by+ commas.+ </li>+ <li>+ <strong>Generate titles:</strong> Our AI will create multiple optimized title variations for you.+ </li>+ <li>+ <strong>Review and select:</strong> Choose the title that best matches your content and target audience.+ </li>+ <li>+ <strong>Test and optimize:</strong> Monitor your CTR and rankings, then refine as needed.+ </li>+ </ol>+ </>+);++const faqs = [+ {+ question: "What makes a good SEO title?",+ answer:+ "A good SEO title is 50-60 characters, includes your primary keyword, accurately describes the page content, and is compelling enough to attract clicks. Front-load important keywords and make it unique for each page.",+ },+ {+ question: "Why is title length important?",+ answer:+ 'Google typically displays the first 50-60 characters of a title tag. Longer titles get truncated with "..." which can reduce click-through rates. Keep your most important information at the start.',+ },+ {+ question: "How do I track title performance?",+ answer: (+ <>+ Use analytics to track CTR from search results. Tools like{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit+ </Link>{" "}+ can show you which pages get the most organic traffic, helping you identify successful titles and opportunities+ for improvement.+ </>+ ),+ },+ {+ question: "Should I include my brand name in the title tag?",+ answer:+ 'Include your brand name at the end of the title tag if you have characters to spare, especially for branded searches. Format: "Primary Keyword - Secondary Keyword | Brand Name". For homepage and key landing pages, brand name can be more prominent.',+ },+ {+ question: "How often should I update my title tags?",+ answer:+ "Update title tags when you notice declining CTR, keyword rankings drop, or when your content significantly changes. Test new titles during seasonal campaigns or when targeting new keywords. Monitor performance for 2-4 weeks before making additional changes.",+ },+];export default function SEOTitleGeneratorPage() {- const [topic, setTopic] = useState("");- const [keywords, setKeywords] = useState("");- const [titles, setTitles] = useState<TitleOption[]>([]);- const [isLoading, setIsLoading] = useState(false);- const [error, setError] = useState("");- const [copiedIndex, setCopiedIndex] = useState<number | null>(null);- const [remainingRequests, setRemainingRequests] = useState<number | null>(null);-- const generateTitles = async () => {- if (!topic) {- setError("Please enter a topic");- return;- }-- setIsLoading(true);- setError("");- setTitles([]);-- try {- const response = await fetch("/api/tools/generate-seo-title", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ topic, keywords: keywords || undefined }),- });-- const remaining = response.headers.get("X-RateLimit-Remaining");- if (remaining) setRemainingRequests(parseInt(remaining));-- if (!response.ok) {- const data = await response.json();- throw new Error(data.error || "Failed to generate titles");- }-- const data = await response.json();- setTitles(data.titles);- } catch (err) {- setError(err instanceof Error ? err.message : "An error occurred");- } finally {- setIsLoading(false);- }- };-- const copyTitle = async (title: string, index: number) => {- await navigator.clipboard.writeText(title);- setCopiedIndex(index);- setTimeout(() => setCopiedIndex(null), 2000);- };-- const getLengthColor = (length: number) => {- if (length >= 50 && length <= 60) return "text-emerald-600 dark:text-emerald-400";- if (length > 60 && length <= 70) return "text-orange-600 dark:text-orange-400";- return "text-red-600 dark:text-red-400";- };-return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">AI-Powered Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- SEO Title Generator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Generate optimized, click-worthy title tags for your pages using AI. Get multiple variations tailored to your topic and keywords.- </p>- {remainingRequests !== null && (- <p className="text-sm text-neutral-500 dark:text-neutral-400 mt-4">- {remainingRequests} requests remaining this minute- </p>- )}- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Page Topic <span className="text-red-500">*</span>- </label>- <input- type="text"- value={topic}- onChange={e => setTopic(e.target.value)}- placeholder="e.g., Best Project Management Software for Teams"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Target Keywords (Optional)- </label>- <input- type="text"- value={keywords}- onChange={e => setKeywords(e.target.value)}- placeholder="e.g., project management, team collaboration, productivity"- disabled={isLoading}- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 disabled:opacity-50"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">- Comma-separated keywords to include- </p>- </div>-- {error && (- <div className="p-4 bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 rounded-lg">- <p className="text-sm text-red-900 dark:text-red-200">{error}</p>- </div>- )}-- <button- onClick={generateTitles}- disabled={isLoading}- className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"- >- {isLoading ? (- <>- <Loader2 className="w-5 h-5 animate-spin" />- Generating Titles...- </>- ) : (- "Generate SEO Titles"- )}- </button>-- {titles.length > 0 && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-3">- <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">Generated Titles</h3>- {titles.map((option, index) => (- <div- key={index}- className="p-4 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg hover:border-emerald-500/40 dark:hover:border-emerald-500/30 transition-colors"- >- <div className="flex items-start justify-between gap-4 mb-2">- <p className="flex-1 text-neutral-900 dark:text-white font-medium">{option.title}</p>- <button- onClick={() => copyTitle(option.title, index)}- className="flex-shrink-0 px-3 py-1.5 bg-neutral-200 dark:bg-neutral-700 hover:bg-neutral-300 dark:hover:bg-neutral-600 text-neutral-900 dark:text-white text-sm rounded-lg transition-colors flex items-center gap-2"- >- {copiedIndex === index ? (- <>- <CheckCircle className="w-4 h-4" />- Copied- </>- ) : (- <>- <Copy className="w-4 h-4" />- Copy- </>- )}- </button>- </div>- <div className="flex items-center gap-4 text-xs">- <span className={`font-medium ${getLengthColor(option.length)}`}>- {option.length} characters- </span>- <span className="text-neutral-500 dark:text-neutral-400">•</span>- <span className="text-neutral-600 dark:text-neutral-400">{option.approach}</span>- </div>- </div>- ))}- <div className="p-3 bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-900 rounded-lg">- <p className="text-sm text-blue-900 dark:text-blue-200">- <strong>Tip:</strong> Optimal title length is 50-60 characters. Longer titles may be truncated in search results.- </p>- </div>- </div>- )}- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">SEO Title Best Practices</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What makes a good SEO title?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- A good SEO title is 50-60 characters, includes your primary keyword, accurately describes the page content, and is compelling enough to attract clicks. Front-load important keywords and make it unique for each page.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Why is title length important?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Google typically displays the first 50-60 characters of a title tag. Longer titles get truncated with "..." which can reduce click-through rates. Keep your most important information at the start.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How do I track title performance?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Use analytics to track CTR from search results. Tools like{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit- </Link>{" "}- can show you which pages get the most organic traffic, helping you identify successful titles and opportunities for improvement.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track your SEO performance with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- See which pages drive organic traffic and optimize your titles based on real data. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "seo_title_generator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="seo-title-generator"+ title="SEO Title Generator"+ description="Generate optimized, click-worthy title tags for your pages using AI. Get multiple variations tailored to your topic and keywords."+ badge="AI-Powered Tool"+ toolComponent={<SEOTitleForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="seo"+ ctaTitle="Track your SEO performance with Rybbit"+ ctaDescription="Monitor organic traffic, CTR, and page performance in real-time."+ ctaEventLocation="seo_title_generator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/traffic-value-calculator/TrafficValueForm.tsx b/docs/src/app/(home)/tools/traffic-value-calculator/TrafficValueForm.tsxnew file mode 100644index 000000000..e49c758f0--- /dev/null+++ b/docs/src/app/(home)/tools/traffic-value-calculator/TrafficValueForm.tsx@@ -0,0 +1,286 @@+"use client";++import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";+import Link from "next/link";+import { useState } from "react";++export function TrafficValueForm() {+ const [monthlyVisitors, setMonthlyVisitors] = useState("");+ const [conversionRate, setConversionRate] = useState("");+ const [averageOrderValue, setAverageOrderValue] = useState("");+ const [profitMargin, setProfitMargin] = useState("");++ const calculateValue = () => {+ const visitors = parseFloat(monthlyVisitors);+ const cr = parseFloat(conversionRate) / 100;+ const aov = parseFloat(averageOrderValue);+ const margin = parseFloat(profitMargin) / 100;++ if (!visitors || !cr || !aov || !margin) return null;++ const conversions = visitors * cr;+ const revenue = conversions * aov;+ const profit = revenue * margin;+ const valuePerVisitor = profit / visitors;+ const annualProfit = profit * 12;++ return {+ conversions,+ revenue,+ profit,+ valuePerVisitor,+ annualProfit,+ };+ };++ const metrics = calculateValue();++ const clearForm = () => {+ setMonthlyVisitors("");+ setConversionRate("");+ setAverageOrderValue("");+ setProfitMargin("");+ };++ return (+ <>+ {/* Tool Section */}+ <div className="mb-16">+ <div className="space-y-6">+ {/* Monthly Visitors */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Monthly Visitors <span className="text-red-500">*</span>+ </label>+ <input+ type="number"+ value={monthlyVisitors}+ onChange={(e) => setMonthlyVisitors(e.target.value)}+ placeholder="50000"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total visitors per month</p>+ </div>++ {/* Conversion Rate */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Conversion Rate <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.01"+ value={conversionRate}+ onChange={(e) => setConversionRate(e.target.value)}+ placeholder="2.5"+ className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Percentage of visitors who convert</p>+ </div>++ {/* Average Order Value */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Average Order Value <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>+ <input+ type="number"+ step="0.01"+ value={averageOrderValue}+ onChange={(e) => setAverageOrderValue(e.target.value)}+ placeholder="75.00"+ className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Average revenue per conversion</p>+ </div>++ {/* Profit Margin */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Profit Margin <span className="text-red-500">*</span>+ </label>+ <div className="relative">+ <input+ type="number"+ step="0.1"+ value={profitMargin}+ onChange={(e) => setProfitMargin(e.target.value)}+ placeholder="30"+ className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Net profit margin per sale</p>+ </div>++ {/* Results */}+ {metrics && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Value Per Visitor+ </label>+ <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">+ <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">+ ${metrics.valuePerVisitor.toFixed(2)}+ </div>+ <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">per visitor</div>+ </div>+ </div>++ <div className="grid grid-cols-2 gap-4">+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Monthly Conversions+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-2xl font-bold text-neutral-900 dark:text-white">+ {Math.round(metrics.conversions).toLocaleString()}+ </div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Monthly Revenue+ </label>+ <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">+ <div className="text-2xl font-bold text-neutral-900 dark:text-white">+ ${metrics.revenue.toLocaleString(undefined, { maximumFractionDigits: 0 })}+ </div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Monthly Profit+ </label>+ <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">+ <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">+ ${metrics.profit.toLocaleString(undefined, { maximumFractionDigits: 0 })}+ </div>+ </div>+ </div>++ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Annual Profit+ </label>+ <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">+ <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">+ ${metrics.annualProfit.toLocaleString(undefined, { maximumFractionDigits: 0 })}+ </div>+ </div>+ </div>+ </div>++ <div className="p-4 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-200 dark:border-emerald-900 rounded-lg">+ <h3 className="font-semibold text-emerald-900 dark:text-emerald-200 mb-2">What this means:</h3>+ <ul className="text-sm text-emerald-900 dark:text-emerald-200 space-y-1">+ <li>• Each visitor is worth <strong>${metrics.valuePerVisitor.toFixed(2)}</strong> in profit</li>+ <li>+ • A <strong>10% traffic increase</strong> would add{" "}+ <strong>+ ${(metrics.profit * 0.1).toLocaleString(undefined, { maximumFractionDigits: 0 })}+ /month+ </strong>{" "}+ in profit+ </li>+ <li>+ • A <strong>1% conversion rate improvement</strong> would add{" "}+ <strong>+ $+ {(+ (parseFloat(monthlyVisitors) *+ 0.01 *+ parseFloat(averageOrderValue) *+ parseFloat(profitMargin)) /+ 100+ ).toLocaleString(undefined, { maximumFractionDigits: 0 })}+ /month+ </strong>{" "}+ in profit+ </li>+ <li>• You can afford to spend up to <strong>${metrics.valuePerVisitor.toFixed(2)}</strong> per visitor on acquisition</li>+ </ul>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ </div>++ {/* FAQ Section */}+ <div className="mb-12">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Frequently Asked Questions</h2>+ <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">+ <Accordion type="single" collapsible className="w-full">+ <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ Why is knowing visitor value important?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Understanding visitor value helps you make informed decisions about marketing spend, SEO investments, and website optimization. If each visitor is worth $2, you can confidently spend up to $2 per visitor on advertising while breaking even, and anything less is profitable.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ How can I increase visitor value?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ You can increase visitor value by: improving conversion rate (better UX, faster site, clearer CTAs), increasing average order value (upsells, cross-sells, bundles), improving profit margins (better pricing, lower costs), or attracting higher-intent traffic (better targeting, SEO for buyer keywords).+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-3" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ Should I include customer lifetime value?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ This calculator shows immediate value per visitor. For businesses with repeat customers, your actual visitor value is higher when including lifetime value (LTV). Track customer behavior over time with{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit Analytics+ </Link>{" "}+ to understand true LTV.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-4" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ How do I calculate traffic value?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Traffic value = (Monthly Visitors × Conversion Rate × Average Order Value × Profit Margin). This shows what each visitor is worth in profit. Our calculator does this automatically, but understanding the formula helps you see how each metric impacts your total value.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-5">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What profit margin should I use?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Use your net profit margin (profit after all costs including COGS, wages, overhead, taxes). If you're not sure, calculate it as: (Total Profit / Total Revenue) × 100. Using an accurate margin ensures your visitor value calculations reflect real profitability, not just revenue.+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/traffic-value-calculator/page.tsx b/docs/src/app/(home)/tools/traffic-value-calculator/page.tsxindex 74623ed7f..0277ccc9f 100644--- a/docs/src/app/(home)/tools/traffic-value-calculator/page.tsx+++ b/docs/src/app/(home)/tools/traffic-value-calculator/page.tsx@@ -1,284 +1,303 @@-"use client";+import type { Metadata } from "next";+import { TrafficValueForm } from "./TrafficValueForm";+import { ToolPageLayout } from "../components/ToolPageLayout";-import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import Link from "next/link";-import { useState } from "react";+export const metadata: Metadata = {+ title: "Free Traffic Value Calculator | Website Traffic ROI & Value Calculator",+ description:+ "Calculate the monetary value of your website traffic. Understand what each visitor is worth to your business. Get insights into conversion rates, revenue per visitor, and optimize your marketing budget allocation.",+ openGraph: {+ title: "Free Traffic Value Calculator | Website Traffic ROI & Value Calculator",+ description:+ "Calculate the monetary value of your website traffic. Understand what each visitor is worth to your business and optimize your marketing spend.",+ type: "website",+ url: "https://rybbit.com/tools/traffic-value-calculator",+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free Traffic Value Calculator | Website Traffic ROI & Value Calculator",+ description:+ "Calculate the value of each website visitor and make smarter marketing decisions based on traffic ROI.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/traffic-value-calculator",+ },+};-export default function TrafficValueCalculatorPage() {- const [monthlyVisitors, setMonthlyVisitors] = useState("");- const [conversionRate, setConversionRate] = useState("");- const [averageOrderValue, setAverageOrderValue] = useState("");- const [profitMargin, setProfitMargin] = useState("");+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "Traffic Value Calculator",+ description: "Free tool to calculate the monetary value of website traffic and understand visitor ROI",+ url: "https://rybbit.com/tools/traffic-value-calculator",+ applicationCategory: "Utility",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is traffic value?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Traffic value is the estimated monetary worth of each visitor to your website. It's calculated by multiplying your monthly visitors by your conversion rate, average order value, and profit margin. This metric helps you understand how much each visitor is worth in profit to your business.",+ },+ },+ {+ "@type": "Question",+ name: "Why is knowing traffic value important?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Knowing your traffic value helps you make informed decisions about marketing spend and investments. If each visitor is worth $2 in profit, you can confidently spend up to $2 per visitor on advertising while breaking even. This enables smarter budget allocation across marketing channels.",+ },+ },+ {+ "@type": "Question",+ name: "How do I calculate traffic value?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Traffic value is calculated as: Monthly Visitors × Conversion Rate × Average Order Value × Profit Margin. For example, 50,000 visitors × 2.5% conversion × $75 AOV × 30% margin = $2.81 per visitor in monthly profit.",+ },+ },+ {+ "@type": "Question",+ name: "What factors affect traffic value?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Traffic value is affected by: conversion rate (how many visitors buy), average order value (revenue per customer), profit margin (actual profitability after costs), and traffic quality (whether visitors are likely to purchase). Improving any of these factors increases your traffic value.",+ },+ },+ {+ "@type": "Question",+ name: "How can I increase my traffic value?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Increase traffic value by: improving conversion rates through better UX and faster load times, increasing average order value with upsells and cross-sells, raising profit margins through better pricing or lower costs, and attracting higher-intent traffic through SEO and targeted advertising.",+ },+ },+ ],+ },+ ],+};- const calculateValue = () => {- const visitors = parseFloat(monthlyVisitors);- const cr = parseFloat(conversionRate) / 100;- const aov = parseFloat(averageOrderValue);- const margin = parseFloat(profitMargin) / 100;+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What is Traffic Value?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Traffic value is the estimated monetary worth of each visitor to your website. It represents how much profit you+ generate from the average visitor based on your conversion rate, average order value, and profit margin.+ Understanding this metric is crucial for evaluating the effectiveness of your marketing efforts and optimizing+ your advertising budget allocation.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ For example, if you have 50,000 monthly visitors, a 2.5% conversion rate, an average order value of $75, and a 30%+ profit margin, your traffic value would be approximately $2.81 per visitor in monthly profit. This means+ increasing your traffic by just 10% could add nearly $1,400 to your monthly profit.+ </p>- if (!visitors || !cr || !aov || !margin) return null;+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Calculate Traffic Value</h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-2">+ <code className="text-sm font-mono">+ Traffic Value = Monthly Visitors × Conversion Rate × Average Order Value × Profit Margin+ </code>+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 mb-2">+ <strong>Step-by-Step Example:</strong>+ </p>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>Monthly Visitors: 50,000 people visit your website each month</li>+ <li>Conversion Rate: 2.5% of visitors make a purchase (1,250 conversions)</li>+ <li>Average Order Value: Each customer spends $75 on average ($93,750 total revenue)</li>+ <li>Profit Margin: 30% of revenue is actual profit ($28,125 monthly profit)</li>+ <li>Traffic Value: $28,125 ÷ 50,000 visitors = $0.56 per visitor</li>+ </ol>+ <p className="text-neutral-700 dark:text-neutral-300 mb-6">+ Our calculator automates this process and also shows you important insights like annual profit potential, how+ traffic increases impact your bottom line, and what you can afford to spend per visitor on acquisition.+ </p>- const conversions = visitors * cr;- const revenue = conversions * aov;- const profit = revenue * margin;- const valuePerVisitor = profit / visitors;- const annualProfit = profit * 12;+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Factors Affecting Traffic Value</h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Conversion Rate:</strong> The percentage of visitors who complete a desired action (purchase, signup,+ etc.). Higher conversion rates dramatically increase traffic value. Even a 1% increase from 2% to 3% conversion+ boosts value by 50%. Focus on improving UX, page load speed, compelling copy, and clear calls-to-action.+ </li>+ <li>+ <strong>Average Order Value (AOV):</strong> The average amount each customer spends per transaction. Increasing+ AOV through upsells, cross-sells, product bundles, and premium tiers directly increases your traffic value.+ Strategies include recommending complementary products, offering volume discounts, and tiered pricing.+ </li>+ <li>+ <strong>Profit Margin:</strong> Your actual profit after all costs (COGS, wages, overhead, taxes). A 30% margin+ means 30 cents of every dollar is profit. Improve margins by optimizing supply chains, reducing operational+ costs, improving pricing strategy, or shifting to higher-margin products.+ </li>+ <li>+ <strong>Traffic Quality:</strong> Not all visitors have equal value. High-intent traffic (people actively+ searching for your solution) converts better than cold traffic. Attract better traffic through targeted SEO,+ buyer-intent keyword campaigns, detailed audience targeting, and strategic partnerships.+ </li>+ <li>+ <strong>Customer Lifetime Value (LTV):</strong> For businesses with repeat customers, true traffic value is much+ higher than single-purchase value. Include repeat purchases, subscriptions, and long-term customer value in your+ calculations. Use analytics tools to track actual LTV rather than assuming single purchases.+ </li>+ </ul>- return {- conversions,- revenue,- profit,- valuePerVisitor,- annualProfit- };- };+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Strategies to Maximize Traffic Value+ </h2>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Optimize Conversion Funnel:</strong> Reduce friction in your checkout process, improve page load speed+ (aim for under 3 seconds), use compelling headlines and CTAs, add trust signals (reviews, guarantees), and+ implement exit-intent popups with discounts to recover abandoning visitors.+ </li>+ <li>+ <strong>Increase Average Order Value:</strong> Implement product recommendations, offer bundle deals, use tiered+ pricing, suggest upgrades at checkout, and create loyalty programs. Even a $5 increase in AOV significantly+ boosts your traffic value when applied to thousands of monthly visitors.+ </li>+ <li>+ <strong>Improve Profit Margins:</strong> Negotiate better supplier rates, optimize inventory management, reduce+ operational waste, automate manual processes, and raise prices strategically. Higher margins on the same revenue+ directly increase your traffic value.+ </li>+ <li>+ <strong>Attract Higher-Quality Traffic:</strong> Focus on buyer-intent keywords in SEO, use detailed audience+ targeting in ads, build partnerships with complementary brands, and create educational content that attracts+ serious prospects rather than casual browsers.+ </li>+ <li>+ <strong>Build Customer Retention:</strong> Implement email marketing, create loyalty programs, offer excellent+ customer support, and track repeat purchase rates. Customers who return multiple times have significantly higher+ lifetime value.+ </li>+ </ol>- const metrics = calculateValue();+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ Industry Benchmarks & Typical Values+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4 leading-relaxed">+ Traffic value varies significantly by industry, business model, and traffic quality. Here are approximate+ benchmarks to help you understand if your traffic value is competitive:+ </p>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>E-commerce - $0.50 - $3.00 per visitor:</strong> Higher values if selling premium products with high+ margins. Lower conversion rates but good AOV drives value. Direct traffic and email often have higher value than+ social media.+ </li>+ <li>+ <strong>SaaS / Subscriptions - $2.00 - $10.00+ per visitor:</strong> High profit margins and customer lifetime+ value. Lower initial conversion rates but recurring revenue compounds value over time. Free trials increase+ conversion rates.+ </li>+ <li>+ <strong>Lead Generation - $1.00 - $5.00 per visitor:</strong> Value depends on lead quality, cost per lead, and+ conversion rate to paying customer. B2B often higher than B2C. Your sales team's close rate significantly+ impacts actual value.+ </li>+ <li>+ <strong>Affiliate / AdSense - $0.01 - $0.25 per visitor:</strong> Low CPM (cost per thousand impressions) from+ ad networks. High traffic volume needed. Value depends on content niche and audience quality. Finance/SaaS+ topics have higher CPM.+ </li>+ <li>+ <strong>Content / Publishing - $0.05 - $1.00 per visitor:</strong> Highly dependent on monetization model (ads,+ subscriptions, sponsorships). Niche audiences with high engagement earn more. Consistent, high-quality content+ builds value.+ </li>+ <li>+ <strong>Marketplace / Classifieds - $0.10 - $2.00 per visitor:</strong> Value from transaction fees or listing+ fees. Higher traffic volume needed due to lower per-visitor monetization. Network effects increase value over+ time.+ </li>+ </ul>+ </>+);- const clearForm = () => {- setMonthlyVisitors("");- setConversionRate("");- setAverageOrderValue("");- setProfitMargin("");- };+const faqs = [+ {+ question: "What is traffic value?",+ answer: (+ <>+ Traffic value is the estimated monetary worth of each visitor to your website. It's calculated by multiplying+ your monthly visitors by your conversion rate, average order value, and profit margin. This metric helps you+ understand how much each visitor is worth in profit to your business.+ </>+ ),+ },+ {+ question: "Why is knowing traffic value important?",+ answer: (+ <>+ Knowing your traffic value helps you make informed decisions about marketing spend and investments. If each+ visitor is worth $2 in profit, you can confidently spend up to $2 per visitor on advertising while breaking+ even. This enables smarter budget allocation across marketing channels.+ </>+ ),+ },+ {+ question: "How do I calculate traffic value?",+ answer: (+ <>+ Traffic value is calculated as: Monthly Visitors × Conversion Rate × Average Order Value × Profit Margin. For+ example, 50,000 visitors × 2.5% conversion × $75 AOV × 30% margin = $2.81 per visitor in monthly profit.+ </>+ ),+ },+ {+ question: "What factors affect traffic value?",+ answer: (+ <>+ Traffic value is affected by: conversion rate (how many visitors buy), average order value (revenue per+ customer), profit margin (actual profitability after costs), and traffic quality (whether visitors are likely to+ purchase). Improving any of these factors increases your traffic value.+ </>+ ),+ },+ {+ question: "How can I increase my traffic value?",+ answer: (+ <>+ Increase traffic value by: improving conversion rates through better UX and faster load times, increasing+ average order value with upsells and cross-sells, raising profit margins through better pricing or lower costs,+ and attracting higher-intent traffic through SEO and targeted advertising.+ </>+ ),+ },+];+export default function TrafficValueCalculatorPage() {return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- Traffic Value Calculator- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Estimate the monetary value of your website traffic. Understand what each visitor is worth to your business.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Monthly Visitors */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Monthly Visitors <span className="text-red-500">*</span>- </label>- <input- type="number"- value={monthlyVisitors}- onChange={e => setMonthlyVisitors(e.target.value)}- placeholder="50000"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Total visitors per month</p>- </div>-- {/* Conversion Rate */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Conversion Rate <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.01"- value={conversionRate}- onChange={e => setConversionRate(e.target.value)}- placeholder="2.5"- className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Percentage of visitors who convert</p>- </div>-- {/* Average Order Value */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Average Order Value <span className="text-red-500">*</span>- </label>- <div className="relative">- <span className="absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">$</span>- <input- type="number"- step="0.01"- value={averageOrderValue}- onChange={e => setAverageOrderValue(e.target.value)}- placeholder="75.00"- className="w-full pl-8 pr-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Average revenue per conversion</p>- </div>-- {/* Profit Margin */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Profit Margin <span className="text-red-500">*</span>- </label>- <div className="relative">- <input- type="number"- step="0.1"- value={profitMargin}- onChange={e => setProfitMargin(e.target.value)}- placeholder="30"- className="w-full pl-4 pr-10 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <span className="absolute right-4 top-1/2 -translate-y-1/2 text-neutral-500 dark:text-neutral-400">%</span>- </div>- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Net profit margin per sale</p>- </div>-- {/* Results */}- {metrics && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800 space-y-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Value Per Visitor- </label>- <div className="px-4 py-6 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-center">- <div className="text-4xl font-bold text-emerald-600 dark:text-emerald-400">- ${metrics.valuePerVisitor.toFixed(2)}- </div>- <div className="text-sm text-neutral-600 dark:text-neutral-400 mt-1">per visitor</div>- </div>- </div>-- <div className="grid grid-cols-2 gap-4">- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Monthly Conversions- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-2xl font-bold text-neutral-900 dark:text-white">- {Math.round(metrics.conversions).toLocaleString()}- </div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Monthly Revenue- </label>- <div className="px-4 py-4 bg-neutral-100 dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-center">- <div className="text-2xl font-bold text-neutral-900 dark:text-white">- ${metrics.revenue.toLocaleString(undefined, { maximumFractionDigits: 0 })}- </div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Monthly Profit- </label>- <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">- <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">- ${metrics.profit.toLocaleString(undefined, { maximumFractionDigits: 0 })}- </div>- </div>- </div>-- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Annual Profit- </label>- <div className="px-4 py-4 bg-blue-50 dark:bg-blue-950/30 border border-blue-300 dark:border-blue-800 rounded-lg text-center">- <div className="text-2xl font-bold text-blue-600 dark:text-blue-400">- ${metrics.annualProfit.toLocaleString(undefined, { maximumFractionDigits: 0 })}- </div>- </div>- </div>- </div>-- <div className="p-4 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-200 dark:border-emerald-900 rounded-lg">- <h3 className="font-semibold text-emerald-900 dark:text-emerald-200 mb-2">What this means:</h3>- <ul className="text-sm text-emerald-900 dark:text-emerald-200 space-y-1">- <li>• Each visitor is worth <strong>${metrics.valuePerVisitor.toFixed(2)}</strong> in profit</li>- <li>• A <strong>10% traffic increase</strong> would add <strong>${(metrics.profit * 0.1).toLocaleString(undefined, { maximumFractionDigits: 0 })}/month</strong> in profit</li>- <li>• A <strong>1% conversion rate improvement</strong> would add <strong>${((parseFloat(monthlyVisitors) * 0.01 * parseFloat(averageOrderValue) * parseFloat(profitMargin) / 100)).toLocaleString(undefined, { maximumFractionDigits: 0 })}/month</strong> in profit</li>- <li>• You can afford to spend up to <strong>${metrics.valuePerVisitor.toFixed(2)}</strong> per visitor on acquisition</li>- </ul>- </div>- </div>- )}-- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>-- {/* FAQ Section */}- <div className="mb-16">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Understanding Traffic Value</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Why is knowing visitor value important?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Understanding visitor value helps you make informed decisions about marketing spend, SEO investments, and website optimization. If each visitor is worth $2, you can confidently spend up to $2 per visitor on advertising while breaking even, and anything less is profitable.- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How can I increase visitor value?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- You can increase visitor value by: improving conversion rate (better UX, faster site, clearer CTAs), increasing average order value (upsells, cross-sells, bundles), improving profit margins (better pricing, lower costs), or attracting higher-intent traffic (better targeting, SEO for buyer keywords).- </AccordionContent>- </AccordionItem>-- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- Should I include customer lifetime value?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- This calculator shows immediate value per visitor. For businesses with repeat customers, your actual visitor value is higher when including lifetime value (LTV). Track customer behavior over time with{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit Analytics- </Link>{" "}- to understand true LTV.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Maximize your traffic value with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- Track conversions, revenue, and visitor sources to optimize your most valuable traffic. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "traffic_value_calculator_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+ <ToolPageLayout+ toolSlug="traffic-value-calculator"+ title="Traffic Value Calculator"+ description="Estimate the monetary value of your website traffic. Understand what each visitor is worth to your business and make smarter marketing decisions."+ badge="Free Tool"+ toolComponent={<TrafficValueForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Maximize your traffic value with Rybbit"+ ctaDescription="Track conversions, revenue, and visitor sources to optimize your most valuable traffic."+ ctaEventLocation="traffic_value_calculator_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/(home)/tools/utm-builder/UTMBuilderForm.tsx b/docs/src/app/(home)/tools/utm-builder/UTMBuilderForm.tsxnew file mode 100644index 000000000..8063372d8--- /dev/null+++ b/docs/src/app/(home)/tools/utm-builder/UTMBuilderForm.tsx@@ -0,0 +1,233 @@+"use client";++import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";+import { CheckCircle, Copy } from "lucide-react";+import Link from "next/link";+import { useMemo, useState } from "react";++export function UTMBuilderForm() {+ const [url, setUrl] = useState("");+ const [source, setSource] = useState("");+ const [medium, setMedium] = useState("");+ const [campaign, setCampaign] = useState("");+ const [term, setTerm] = useState("");+ const [content, setContent] = useState("");+ const [copied, setCopied] = useState(false);++ const utmUrl = useMemo(() => {+ if (!url || !source || !medium || !campaign) return "";++ try {+ const urlObj = new URL(url.startsWith("http") ? url : `https://${url}`);+ urlObj.searchParams.set("utm_source", source);+ urlObj.searchParams.set("utm_medium", medium);+ urlObj.searchParams.set("utm_campaign", campaign);+ if (term) urlObj.searchParams.set("utm_term", term);+ if (content) urlObj.searchParams.set("utm_content", content);+ return urlObj.toString();+ } catch {+ return "";+ }+ }, [url, source, medium, campaign, term, content]);++ const copyToClipboard = async () => {+ if (utmUrl) {+ await navigator.clipboard.writeText(utmUrl);+ setCopied(true);+ setTimeout(() => setCopied(false), 2000);+ }+ };++ const clearForm = () => {+ setUrl("");+ setSource("");+ setMedium("");+ setCampaign("");+ setTerm("");+ setContent("");+ setCopied(false);+ };++ return (+ <>+ {/* Tool Section */}+ <div className="mb-16">+ <div className="space-y-6">+ {/* Website URL */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Website URL <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={url}+ onChange={e => setUrl(e.target.value)}+ placeholder="https://example.com"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ </div>++ {/* Campaign Source */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Campaign Source <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={source}+ onChange={e => setSource(e.target.value)}+ placeholder="google, newsletter, facebook"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">The referrer (e.g., google, newsletter)</p>+ </div>++ {/* Campaign Medium */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Campaign Medium <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={medium}+ onChange={e => setMedium(e.target.value)}+ placeholder="cpc, email, social"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Marketing medium (e.g., cpc, email, social)</p>+ </div>++ {/* Campaign Name */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">+ Campaign Name <span className="text-red-500">*</span>+ </label>+ <input+ type="text"+ value={campaign}+ onChange={e => setCampaign(e.target.value)}+ placeholder="summer_sale, product_launch"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Product, promo code, or slogan (e.g., summer_sale)</p>+ </div>++ {/* Campaign Term (Optional) */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Campaign Term</label>+ <input+ type="text"+ value={term}+ onChange={e => setTerm(e.target.value)}+ placeholder="running_shoes, blue_widget"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Identify the paid keywords (optional)</p>+ </div>++ {/* Campaign Content (Optional) */}+ <div>+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Campaign Content</label>+ <input+ type="text"+ value={content}+ onChange={e => setContent(e.target.value)}+ placeholder="logolink, textlink"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"+ />+ <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Differentiate ads or links (optional)</p>+ </div>++ {/* Result */}+ {utmUrl && (+ <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">+ <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Your UTM URL</label>+ <div className="flex gap-2">+ <input+ type="text"+ value={utmUrl}+ readOnly+ className="flex-1 px-4 py-3 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-neutral-900 dark:text-white font-mono text-sm"+ />+ <button+ onClick={copyToClipboard}+ className="px-6 py-3 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition-colors flex items-center gap-2"+ >+ {copied ? <CheckCircle className="w-4 h-4" /> : <Copy className="w-4 h-4" />}+ {copied ? "Copied!" : "Copy"}+ </button>+ </div>+ </div>+ )}++ {/* Buttons */}+ <div className="flex gap-4 pt-4">+ <button+ onClick={clearForm}+ className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"+ >+ Clear+ </button>+ </div>+ </div>+ </div>++ {/* FAQ Section */}+ <div className="mb-12">+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">Frequently Asked Questions</h2>+ <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">+ <Accordion type="single" collapsible className="w-full">+ <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What is UTM tracking?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ UTM (Urchin Tracking Module) parameters are tags added to URLs that help you track the effectiveness of your marketing campaigns in analytics tools like Rybbit, Google Analytics, and others. They tell you exactly where your traffic is coming from and how your campaigns perform.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What are the required UTM parameters?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ The three required parameters are: <strong>utm_source</strong> (identifies the source like google or newsletter), <strong>utm_medium</strong> (identifies the medium like cpc or email), and <strong>utm_campaign</strong> (identifies the specific campaign like summer_sale).+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-3" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ How do I track UTM links with Rybbit?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Once you have Rybbit installed on your website, UTM parameters are automatically tracked. You can view your campaign performance in your{" "}+ <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">+ Rybbit dashboard+ </Link>{" "}+ under the UTM section.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-4" className="border-b border-neutral-300/50 dark:border-neutral-800/50">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What are optional UTM parameters?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ <strong>utm_term</strong> is used for tracking paid search keywords, while <strong>utm_content</strong> helps differentiate between different ads or links within the same campaign. These are optional but useful for deeper campaign analysis and A/B testing.+ </AccordionContent>+ </AccordionItem>++ <AccordionItem value="item-5">+ <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">+ What naming conventions should I follow?+ </AccordionTrigger>+ <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">+ Use lowercase letters and underscores instead of spaces (e.g., summer_sale, not Summer Sale). Be consistent across campaigns so data is properly grouped in analytics. Avoid special characters and keep names descriptive but concise.+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </div>+ </div>+ </>+ );+}diff --git a/docs/src/app/(home)/tools/utm-builder/page.tsx b/docs/src/app/(home)/tools/utm-builder/page.tsxindex 82b0611fc..623bad495 100644--- a/docs/src/app/(home)/tools/utm-builder/page.tsx+++ b/docs/src/app/(home)/tools/utm-builder/page.tsx@@ -1,253 +1,295 @@-"use client";+import { UTMBuilderForm } from "./UTMBuilderForm";+import { ToolPageLayout } from "../components/ToolPageLayout";+import type { Metadata } from "next";-import { TrackedButton } from "@/components/TrackedButton";-import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";-import { DEFAULT_EVENT_LIMIT } from "@/lib/const";-import { CheckCircle, Copy } from "lucide-react";-import Link from "next/link";-import { useMemo, useState } from "react";+export const metadata: Metadata = {+ title: "Free UTM Builder | Campaign URL Parameter Generator for Marketing Tracking",+ description:+ "Create trackable UTM campaign URLs instantly. Build utm_source, utm_medium, utm_campaign parameters for Google Analytics and marketing campaign tracking.",+ openGraph: {+ title: "Free UTM Builder | Campaign URL Parameter Generator",+ description:+ "Generate UTM campaign URLs instantly for accurate marketing tracking in Google Analytics and other analytics platforms.",+ type: "website",+ url: "https://rybbit.com/tools/utm-builder",+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: "Free UTM Builder | Campaign URL Parameter Generator",+ description: "Build trackable campaign URLs with UTM parameters for better marketing analytics.",+ },+ alternates: {+ canonical: "https://rybbit.com/tools/utm-builder",+ },+};-export default function UTMBuilderPage() {- const [url, setUrl] = useState("");- const [source, setSource] = useState("");- const [medium, setMedium] = useState("");- const [campaign, setCampaign] = useState("");- const [term, setTerm] = useState("");- const [content, setContent] = useState("");- const [copied, setCopied] = useState(false);-- const utmUrl = useMemo(() => {- if (!url || !source || !medium || !campaign) return "";-- try {- const urlObj = new URL(url.startsWith("http") ? url : `https://${url}`);- urlObj.searchParams.set("utm_source", source);- urlObj.searchParams.set("utm_medium", medium);- urlObj.searchParams.set("utm_campaign", campaign);- if (term) urlObj.searchParams.set("utm_term", term);- if (content) urlObj.searchParams.set("utm_content", content);- return urlObj.toString();- } catch {- return "";- }- }, [url, source, medium, campaign, term, content]);-- const copyToClipboard = async () => {- if (utmUrl) {- await navigator.clipboard.writeText(utmUrl);- setCopied(true);- setTimeout(() => setCopied(false), 2000);- }- };-- const clearForm = () => {- setUrl("");- setSource("");- setMedium("");- setCampaign("");- setTerm("");- setContent("");- setCopied(false);- };-- return (- <div className="min-h-screen bg-gradient-to-b from-neutral-50 to-neutral-100 dark:from-neutral-950 dark:to-neutral-900">- <div className="max-w-4xl mx-auto px-6 py-20">- {/* Header */}- <div className="mb-16">- <div className="inline-block mb-4 px-4 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 border border-emerald-200 dark:border-emerald-800 rounded-full">- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-400">Free Tool</span>- </div>- <h1 className="text-5xl md:text-6xl font-bold text-neutral-900 dark:text-white mb-6 tracking-tight">- UTM Builder- </h1>- <p className="text-xl text-neutral-600 dark:text-neutral-400 max-w-2xl leading-relaxed">- Create trackable campaign URLs with UTM parameters. Perfect for tracking your marketing campaigns across different channels.- </p>- </div>-- {/* Tool */}- <div className="mb-16">- <div className="space-y-6">- {/* Website URL */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Website URL <span className="text-red-500">*</span>- </label>- <input- type="text"- value={url}- onChange={e => setUrl(e.target.value)}- placeholder="https://example.com"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- </div>-- {/* Campaign Source */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Campaign Source <span className="text-red-500">*</span>- </label>- <input- type="text"- value={source}- onChange={e => setSource(e.target.value)}- placeholder="google, newsletter, facebook"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">The referrer (e.g., google, newsletter)</p>- </div>+const structuredData = {+ "@context": "https://schema.org",+ "@graph": [+ {+ "@type": "WebApplication",+ name: "UTM Builder Tool",+ description: "Free tool to generate UTM parameters for campaign URL tracking",+ url: "https://rybbit.com/tools/utm-builder",+ applicationCategory: "Utility",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ },+ {+ "@type": "FAQPage",+ mainEntity: [+ {+ "@type": "Question",+ name: "What is UTM tracking?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "UTM (Urchin Tracking Module) parameters are tags added to URLs that help you track the effectiveness of your marketing campaigns in analytics tools like Rybbit, Google Analytics, and others. They tell you exactly where your traffic is coming from and how your campaigns perform.",+ },+ },+ {+ "@type": "Question",+ name: "What are the required UTM parameters?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "The three required parameters are: utm_source (identifies the source like google or newsletter), utm_medium (identifies the medium like cpc or email), and utm_campaign (identifies the specific campaign like summer_sale).",+ },+ },+ {+ "@type": "Question",+ name: "How do I track UTM links with Rybbit?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Once you have Rybbit installed on your website, UTM parameters are automatically tracked. You can view your campaign performance in your Rybbit dashboard under the UTM section.",+ },+ },+ {+ "@type": "Question",+ name: "What are optional UTM parameters?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "utm_term is used for tracking paid search keywords, while utm_content helps differentiate between different ads or links within the same campaign. These are optional but useful for deeper campaign analysis and A/B testing.",+ },+ },+ {+ "@type": "Question",+ name: "What naming conventions should I follow?",+ acceptedAnswer: {+ "@type": "Answer",+ text: "Use lowercase letters and underscores instead of spaces (e.g., summer_sale, not Summer Sale). Be consistent across campaigns so data is properly grouped in analytics. Avoid special characters and keep names descriptive but concise.",+ },+ },+ ],+ },+ ],+};- {/* Campaign Medium */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Campaign Medium <span className="text-red-500">*</span>- </label>- <input- type="text"- value={medium}- onChange={e => setMedium(e.target.value)}- placeholder="cpc, email, social"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Marketing medium (e.g., cpc, email, social)</p>- </div>+const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">What are UTM Parameters?</h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ UTM (Urchin Tracking Module) parameters are special tags you add to the end of your URLs to track your marketing+ campaign performance. When someone clicks a link with UTM parameters, analytics tools like Rybbit, Google+ Analytics, and others automatically capture that data and organize it for you.+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4">+ Instead of wondering which campaigns drive the most traffic, UTM parameters let you see exactly how many visitors+ came from each campaign, where they came from, and how they behaved on your site.+ </p>- {/* Campaign Name */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">- Campaign Name <span className="text-red-500">*</span>- </label>- <input- type="text"- value={campaign}- onChange={e => setCampaign(e.target.value)}- placeholder="summer_sale, product_launch"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Product, promo code, or slogan (e.g., summer_sale)</p>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ How UTM Parameters Work with Google Analytics+ </h2>- {/* Campaign Term (Optional) */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Campaign Term</label>- <input- type="text"- value={term}- onChange={e => setTerm(e.target.value)}- placeholder="running_shoes, blue_widget"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Identify the paid keywords (optional)</p>- </div>+ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3 mt-6">The Five UTM Parameters</h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">utm_source</code> - Where the traffic+ comes from (google, newsletter, facebook)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">utm_medium</code> - How they got+ there (cpc, email, social, organic)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">utm_campaign</code> - Which campaign+ it belongs to (summer_sale, product_launch)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">utm_term</code> - Paid search+ keywords (optional)+ </li>+ <li>+ <code className="text-sm font-mono text-emerald-600 dark:text-emerald-400">utm_content</code> - Which ad or link+ was clicked (optional)+ </li>+ </ul>- {/* Campaign Content (Optional) */}- <div>- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Campaign Content</label>- <input- type="text"- value={content}- onChange={e => setContent(e.target.value)}- placeholder="logolink, textlink"- className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500"- />- <p className="text-xs text-neutral-500 dark:text-neutral-400 mt-1">Differentiate ads or links (optional)</p>- </div>+ <p className="text-neutral-700 dark:text-neutral-300 mb-2">+ <strong>Example URL:</strong>+ </p>+ <p className="text-neutral-700 dark:text-neutral-300 mb-4">+ <code className="text-xs font-mono">+ https://example.com?utm_source=google&utm_medium=cpc&utm_campaign=summer_sale&utm_term=running_shoes+ </code>+ </p>+ <p className="text-neutral-700 dark:text-neutral-300">+ Google Analytics automatically parses these parameters and shows them in your reports, making it easy to compare+ campaign performance.+ </p>- {/* Result */}- {utmUrl && (- <div className="pt-6 border-t border-neutral-200 dark:border-neutral-800">- <label className="block text-sm font-medium text-neutral-900 dark:text-white mb-2">Your UTM URL</label>- <div className="flex gap-2">- <input- type="text"- value={utmUrl}- readOnly- className="flex-1 px-4 py-3 bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-300 dark:border-emerald-800 rounded-lg text-neutral-900 dark:text-white font-mono text-sm"- />- <button- onClick={copyToClipboard}- className="px-6 py-3 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition-colors flex items-center gap-2"- >- {copied ? <CheckCircle className="w-4 h-4" /> : <Copy className="w-4 h-4" />}- {copied ? "Copied!" : "Copy"}- </button>- </div>- </div>- )}+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">+ UTM Naming Conventions & Best Practices+ </h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Use Consistent Formatting:</strong> Always use lowercase letters and underscores instead of spaces. This+ ensures consistent data grouping in your analytics. Good: summer_sale, facebook_ads, email_newsletter | Bad:+ Summer Sale, Facebook Ads, Email Newsletter+ </li>+ <li>+ <strong>Be Descriptive but Concise:</strong> Use names that clearly identify the campaign or source without+ being overly long. Short, specific names are easier to remember and less prone to typos.+ </li>+ <li>+ <strong>Establish a Naming Convention:</strong> Create a standard UTM naming scheme for your organization and+ document it. This prevents duplicate or conflicting parameter values. Example scheme: campaign =+ [season]_[product], source = [channel], medium = [type]+ </li>+ <li>+ <strong>Never Use Spaces or Special Characters:</strong> Spaces and special characters can cause encoding+ issues. Stick to alphanumeric characters and underscores.+ </li>+ </ul>- {/* Buttons */}- <div className="flex gap-4 pt-4">- <button- onClick={clearForm}- className="px-6 py-3 bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 text-neutral-900 dark:text-white font-medium rounded-lg transition-colors"- >- Clear- </button>- </div>- </div>- </div>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Common UTM Use Cases</h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Email Marketing:</strong> Track which emails drive the most traffic. Use utm_source=newsletter,+ utm_medium=email, and create unique campaign names for each send.+ </li>+ <li>+ <strong>Social Media Campaigns:</strong> Measure performance across platforms. Use+ utm_source=facebook/twitter/linkedin, utm_medium=social, and track A/B tests with utm_content.+ </li>+ <li>+ <strong>Paid Search Ads:</strong> Track Google Ads and Bing campaigns. Use utm_source=google, utm_medium=cpc,+ and utm_term for your keywords to optimize bidding.+ </li>+ <li>+ <strong>Affiliate & Referral Programs:</strong> Monitor performance by partner. Use utm_source=[partner_name],+ utm_medium=affiliate, and utm_content=[unique_id] per partner.+ </li>+ <li>+ <strong>Offline to Online Tracking:</strong> Include UTM parameters in offline marketing materials. QR codes,+ print ads, and events can all drive trackable traffic.+ </li>+ <li>+ <strong>A/B Testing Ads:</strong> Compare different ad creatives or messaging. Use utm_content to differentiate+ versions and measure which performs better.+ </li>+ </ul>- {/* FAQ Section */}- <div className="mb-12">- <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-6">What are UTM parameters?</h2>- <div className="bg-neutral-100/50 dark:bg-neutral-800/20 backdrop-blur-sm border border-neutral-300/50 dark:border-neutral-800/50 rounded-xl overflow-hidden">- <Accordion type="single" collapsible className="w-full">- <AccordionItem value="item-1" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What is UTM tracking?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- UTM (Urchin Tracking Module) parameters are tags added to URLs that help you track the effectiveness of your marketing campaigns in analytics tools like Rybbit, Google Analytics, and others. They tell you exactly where your traffic is coming from.- </AccordionContent>- </AccordionItem>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">Common UTM Mistakes to Avoid</h2>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Inconsistent Parameter Values:</strong> Using "Facebook" sometimes and "facebook" other times causes+ data to be split into separate analytics rows. Always use consistent casing and formatting.+ </li>+ <li>+ <strong>Omitting Required Parameters:</strong> While technically you can have partial UTM parameters, missing+ utm_source, utm_medium, or utm_campaign reduces your tracking insight. Always fill at least these three.+ </li>+ <li>+ <strong>Using Spaces and Special Characters:</strong> Spaces become %20 in URLs, and special characters can+ cause encoding issues. Stick to letters, numbers, hyphens, and underscores.+ </li>+ <li>+ <strong>Forgetting to Tag All Links:</strong> If you only tag some of your marketing links, you'll get+ incomplete data. Create a process to tag every single campaign link.+ </li>+ <li>+ <strong>Not Documenting Your Scheme:</strong> Without documented naming conventions, your team will create+ inconsistent UTM parameters. Create and share a style guide.+ </li>+ </ul>- <AccordionItem value="item-2" className="border-b border-neutral-300/50 dark:border-neutral-800/50">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- What are the required UTM parameters?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- The three required parameters are: utm_source (identifies the source like google or newsletter), utm_medium (identifies the medium like cpc or email), and utm_campaign (identifies the specific campaign like summer_sale).- </AccordionContent>- </AccordionItem>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4 mt-8">How to Use the UTM Builder</h2>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Enter Your Website URL:</strong> Start with your base URL (e.g., https://example.com/products)+ </li>+ <li>+ <strong>Fill Required Fields:</strong> Set your utm_source, utm_medium, and utm_campaign. These three are+ essential for proper tracking.+ </li>+ <li>+ <strong>Add Optional Parameters:</strong> Use utm_term for keywords and utm_content to differentiate ads within+ the same campaign.+ </li>+ <li>+ <strong>Copy Your UTM URL:</strong> Click the Copy button to copy your fully formed URL with all parameters+ included.+ </li>+ <li>+ <strong>Use in Your Campaigns:</strong> Paste the URL in your marketing channels (emails, ads, social posts,+ etc.) and track the results.+ </li>+ </ol>+ </>+);- <AccordionItem value="item-3">- <AccordionTrigger className="px-6 py-4 text-base font-medium hover:text-emerald-500 dark:hover:text-emerald-400 transition-colors">- How do I track UTM links with Rybbit?- </AccordionTrigger>- <AccordionContent className="px-6 pb-4 text-neutral-700 dark:text-neutral-300">- Once you have Rybbit installed on your website, UTM parameters are automatically tracked. You can view your campaign performance in your{" "}- <Link href="https://app.rybbit.io" className="text-emerald-600 dark:text-emerald-400 hover:underline">- Rybbit dashboard- </Link>{" "}- under the UTM section.- </AccordionContent>- </AccordionItem>- </Accordion>- </div>- </div>+const faqs = [+ {+ question: "What is UTM tracking?",+ answer:+ "UTM (Urchin Tracking Module) parameters are tags added to URLs that help you track the effectiveness of your marketing campaigns in analytics tools like Rybbit, Google Analytics, and others. They tell you exactly where your traffic is coming from and how your campaigns perform.",+ },+ {+ question: "What are the required UTM parameters?",+ answer:+ "The three required parameters are: utm_source (identifies the source like google or newsletter), utm_medium (identifies the medium like cpc or email), and utm_campaign (identifies the specific campaign like summer_sale).",+ },+ {+ question: "How do I track UTM links with Rybbit?",+ answer:+ "Once you have Rybbit installed on your website, UTM parameters are automatically tracked. You can view your campaign performance in your Rybbit dashboard under the UTM section.",+ },+ {+ question: "What are optional UTM parameters?",+ answer:+ "utm_term is used for tracking paid search keywords, while utm_content helps differentiate between different ads or links within the same campaign. These are optional but useful for deeper campaign analysis and A/B testing.",+ },+ {+ question: "What naming conventions should I follow?",+ answer:+ "Use lowercase letters and underscores instead of spaces (e.g., summer_sale, not Summer Sale). Be consistent across campaigns so data is properly grouped in analytics. Avoid special characters and keep names descriptive but concise.",+ },+];- </div>-- {/* CTA */}- <div className="border-t border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 py-20">- <div className="max-w-4xl mx-auto px-6 text-center">- <h2 className="text-3xl md:text-4xl font-bold text-neutral-900 dark:text-white mb-4">- Track your UTM campaigns with Rybbit- </h2>- <p className="text-lg text-neutral-600 dark:text-neutral-400 mb-8 max-w-2xl mx-auto">- See exactly which campaigns drive the most traffic and conversions. Get started for free with up to {DEFAULT_EVENT_LIMIT.toLocaleString()} events per month.- </p>- <TrackedButton- href="https://app.rybbit.io/signup"- eventName="signup"- eventProps={{ location: "utm_builder_cta" }}- className="inline-block bg-emerald-600 hover:bg-emerald-500 text-white font-semibold px-10 py-4 text-lg rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200"- >- Start tracking for free- </TrackedButton>- </div>- </div>- </div>+export default function UTMBuilderPage() {+ return (+ <ToolPageLayout+ toolSlug="utm-builder"+ title="UTM Builder"+ description="Create trackable campaign URLs with UTM parameters. Perfect for tracking your marketing campaigns across different channels and accurately measuring their performance."+ badge="Free Tool"+ toolComponent={<UTMBuilderForm />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="analytics"+ ctaTitle="Track your UTM campaigns with Rybbit"+ ctaDescription="See exactly which campaigns drive the most traffic and conversions."+ ctaEventLocation="utm_builder_cta"+ structuredData={structuredData}+ />);}diff --git a/docs/src/app/blog/[...slug]/page.tsx b/docs/src/app/blog/[...slug]/page.tsxindex a45c9e904..71afd2190 100644--- a/docs/src/app/blog/[...slug]/page.tsx+++ b/docs/src/app/blog/[...slug]/page.tsx@@ -19,7 +19,7 @@ export async function generateMetadata(props: { params: Promise<{ slug: string[]const page = blogSource.getPage(params.slug);if (!page) return {};- const url = `https://docs.rybbit.io/blog/${params.slug.join("/")}`;+ const url = `https://rybbit.com/blog/${params.slug.join("/")}`;const publishedTime = page.data.date ? new Date(page.data.date).toISOString() : undefined;const ogImage = page.data.image || "/opengraph-image.png";@@ -168,7 +168,10 @@ export default async function BlogPostPage(props: { params: Promise<{ slug: stricomponents={{...defaultMdxComponents,pre: (props: React.ComponentPropsWithoutRef<"pre">) => (- <Pre {...props} className="bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg" />+ <Pre+ {...props}+ className="bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg"+ />),code: ({ className, ...props }: React.ComponentPropsWithoutRef<"code">) => {// Check if this code is inside a pre tag (code block)diff --git a/docs/src/app/sitemap.ts b/docs/src/app/sitemap.tsindex d1f1fffef..f37eca6d9 100644--- a/docs/src/app/sitemap.ts+++ b/docs/src/app/sitemap.ts@@ -1,6 +1,8 @@import { MetadataRoute } from "next";import { source } from "@/lib/source";import { blogSource } from "@/lib/blog-source";+import { readdirSync } from "fs";+import { join } from "path";export default async function sitemap(): Promise<MetadataRoute.Sitemap> {const baseUrl = "https://rybbit.com";@@ -21,6 +23,19 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {priority: 0.7,}));+ // Dynamically get tool slugs from the tools directory+ const toolsPath = join(process.cwd(), "src/app/(home)/tools");+ const toolSlugs = readdirSync(toolsPath, { withFileTypes: true })+ .filter(dirent => dirent.isDirectory() && dirent.name !== "components")+ .map(dirent => dirent.name);++ const toolPages = toolSlugs.map(slug => ({+ url: `${baseUrl}/tools/${slug}`,+ lastModified: new Date("2025-11-23"),+ changeFrequency: "monthly" as const,+ priority: 0.8,+ }));+// Static pagesconst staticPages = [{@@ -41,6 +56,12 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {changeFrequency: "weekly" as const,priority: 0.8,},+ {+ url: `${baseUrl}/tools`,+ lastModified: new Date(),+ changeFrequency: "weekly" as const,+ priority: 0.85,+ },{url: `${baseUrl}/pricing`,lastModified: new Date(),@@ -49,5 +70,5 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {},];- return [...staticPages, ...docPages, ...blogPosts];+ return [...staticPages, ...toolPages, ...docPages, ...blogPosts];}diff --git a/docs/src/components/Breadcrumbs.tsx b/docs/src/components/Breadcrumbs.tsxnew file mode 100644index 000000000..5e0b75c7f--- /dev/null+++ b/docs/src/components/Breadcrumbs.tsx@@ -0,0 +1,48 @@+import Link from "next/link";+import { ChevronRight } from "lucide-react";++interface BreadcrumbItem {+ label: string;+ href?: string;+}++interface BreadcrumbsProps {+ items: BreadcrumbItem[];+}++export function Breadcrumbs({ items }: BreadcrumbsProps) {+ return (+ <nav aria-label="Breadcrumb" className="mb-8">+ <ol className="flex items-center gap-2 text-sm">+ {items.map((item, index) => {+ const isLast = index === items.length - 1;++ return (+ <li key={index} className="flex items-center gap-2">+ {item.href && !isLast ? (+ <Link+ href={item.href}+ className="text-neutral-600 dark:text-neutral-400 hover:text-emerald-600 dark:hover:text-emerald-400 transition-colors"+ >+ {item.label}+ </Link>+ ) : (+ <span+ className={+ isLast+ ? "text-neutral-900 dark:text-white font-medium"+ : "text-neutral-600 dark:text-neutral-400"+ }+ aria-current={isLast ? "page" : undefined}+ >+ {item.label}+ </span>+ )}+ {!isLast && <ChevronRight className="w-4 h-4 text-neutral-400 dark:text-neutral-600" />}+ </li>+ );+ })}+ </ol>+ </nav>+ );+}diff --git a/docs/src/components/RelatedTools.tsx b/docs/src/components/RelatedTools.tsxnew file mode 100644index 000000000..f0a704f51--- /dev/null+++ b/docs/src/components/RelatedTools.tsx@@ -0,0 +1,152 @@+import Link from "next/link";+import { ArrowRight } from "lucide-react";++interface Tool {+ name: string;+ description: string;+ href: string;+ category: "seo" | "analytics" | "privacy";+}++const allTools: Tool[] = [+ {+ name: "SEO Title Generator",+ description: "Generate optimized title tags for better rankings",+ href: "/tools/seo-title-generator",+ category: "seo",+ },+ {+ name: "Meta Description Generator",+ description: "Create compelling meta descriptions that boost CTR",+ href: "/tools/meta-description-generator",+ category: "seo",+ },+ {+ name: "OG Tag Generator",+ description: "Generate Open Graph tags for social sharing",+ href: "/tools/og-tag-generator",+ category: "seo",+ },+ {+ name: "UTM Builder",+ description: "Build campaign URLs with UTM parameters",+ href: "/tools/utm-builder",+ category: "analytics",+ },+ {+ name: "CTR Calculator",+ description: "Calculate click-through rates and compare to benchmarks",+ href: "/tools/ctr-calculator",+ category: "analytics",+ },+ {+ name: "Bounce Rate Calculator",+ description: "Analyze bounce rates and identify issues",+ href: "/tools/bounce-rate-calculator",+ category: "analytics",+ },+ {+ name: "Marketing ROI Calculator",+ description: "Calculate return on investment for marketing campaigns",+ href: "/tools/marketing-roi-calculator",+ category: "analytics",+ },+ {+ name: "Sample Size Calculator",+ description: "Determine A/B test sample sizes for statistical significance",+ href: "/tools/sample-size-calculator",+ category: "analytics",+ },+ {+ name: "Traffic Value Calculator",+ description: "Calculate the monetary value of your website traffic",+ href: "/tools/traffic-value-calculator",+ category: "analytics",+ },+ {+ name: "Page Speed Calculator",+ description: "Calculate revenue impact of page speed improvements",+ href: "/tools/page-speed-calculator",+ category: "analytics",+ },+ {+ name: "Funnel Visualizer",+ description: "Visualize and analyze conversion funnels",+ href: "/tools/funnel-visualizer",+ category: "analytics",+ },+ {+ name: "Analytics Detector",+ description: "Detect analytics tools on any website",+ href: "/tools/analytics-detector",+ category: "privacy",+ },+ {+ name: "AI Privacy Policy Generator",+ description: "Generate GDPR-compliant privacy policies with AI",+ href: "/tools/ai-privacy-policy-generator",+ category: "privacy",+ },+ {+ name: "Privacy Policy Builder",+ description: "Build custom privacy policies for your website",+ href: "/tools/privacy-policy-builder",+ category: "privacy",+ },+];++interface RelatedToolsProps {+ currentToolHref: string;+ category?: "seo" | "analytics" | "privacy";+ maxTools?: number;+}++export function RelatedTools({ currentToolHref, category, maxTools = 3 }: RelatedToolsProps) {+ let relatedTools = allTools.filter(tool => tool.href !== currentToolHref);++ // If category is specified, prioritize tools from the same category+ if (category) {+ const sameCategory = relatedTools.filter(tool => tool.category === category);+ const otherCategory = relatedTools.filter(tool => tool.category !== category);+ relatedTools = [...sameCategory, ...otherCategory];+ }++ // Limit to maxTools+ relatedTools = relatedTools.slice(0, maxTools);++ if (relatedTools.length === 0) {+ return null;+ }++ return (+ <div className="mt-20 pt-16 border-t border-neutral-200 dark:border-neutral-800">+ <div className="mb-6">+ <h2 className="text-xl font-semibold text-neutral-900 dark:text-white mb-4">Related Tools</h2>+ <ul className="space-y-3">+ {relatedTools.map(tool => (+ <li key={tool.href}>+ <Link+ href={tool.href}+ className="group flex items-center gap-2 text-neutral-700 dark:text-neutral-300 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors"+ >+ <ArrowRight className="w-4 h-4 flex-shrink-0 group-hover:translate-x-1 transition-transform" />+ <span className="font-medium">{tool.name}</span>+ <span className="text-sm text-neutral-500 dark:text-neutral-500">— {tool.description}</span>+ </Link>+ </li>+ ))}+ </ul>+ </div>++ <div className="mt-6">+ <Link+ href="/tools"+ className="inline-flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300 hover:text-neutral-900 dark:hover:text-neutral-100 font-medium transition-colors"+ >+ View all tools+ <ArrowRight className="w-4 h-4" />+ </Link>+ </div>+ </div>+ );+}