🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add 'Tools' link to Footer component for improved navigation (#718)
Bill Yangbb52956bb579
diff --git a/docs/package-lock.json b/docs/package-lock.jsonindex 62bfd69d5..2488d3634 100644--- a/docs/package-lock.json+++ b/docs/package-lock.json@@ -20,6 +20,7 @@"fumadocs-core": "16.0.3","fumadocs-mdx": "13.0.2","fumadocs-ui": "16.0.3",+ "lodash": "^4.17.21","lucide-react": "^0.548.0","mermaid": "^11.12.0","next": "16.0.0",@@ -32,6 +33,7 @@},"devDependencies": {"@tailwindcss/postcss": "^4.1.16",+ "@types/lodash": "^4.17.20","@types/mdx": "^2.0.13","@types/node": "24.9.1","@types/react": "^19.2.2",@@ -109,7 +111,6 @@"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@babel/code-frame": "^7.27.1","@babel/generator": "^7.28.5",@@ -3339,6 +3340,13 @@"dev": true,"license": "MIT"},+ "node_modules/@types/lodash": {+ "version": "4.17.20",+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.20.tgz",+ "integrity": "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/mdast": {"version": "4.0.4","resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",@@ -3376,7 +3384,6 @@"integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==","devOptional": true,"license": "MIT",- "peer": true,"dependencies": {"csstype": "^3.0.2"}@@ -3387,7 +3394,6 @@"integrity": "sha512-9KQPoO6mZCi7jcIStSnlOWn2nEF3mNmyr3rIAsGnAbQKYbRLyqmeSc39EVgtxXVia+LMT8j3knZLAZAh+xLmrw==","devOptional": true,"license": "MIT",- "peer": true,"peerDependencies": {"@types/react": "^19.2.0"}@@ -3451,7 +3457,6 @@"integrity": "sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@typescript-eslint/scope-manager": "8.46.2","@typescript-eslint/types": "8.46.2",@@ -3987,7 +3992,6 @@"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz","integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==","license": "MIT",- "peer": true,"bin": {"acorn": "bin/acorn"},@@ -4368,7 +4372,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"baseline-browser-mapping": "^2.8.19","caniuse-lite": "^1.0.30001751",@@ -4535,7 +4538,6 @@"resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.0.3.tgz","integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==","license": "Apache-2.0",- "peer": true,"dependencies": {"@chevrotain/cst-dts-gen": "11.0.3","@chevrotain/gast": "11.0.3",@@ -4728,7 +4730,6 @@"resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.33.1.tgz","integrity": "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ==","license": "MIT",- "peer": true,"engines": {"node": ">=0.10"}@@ -5129,7 +5130,6 @@"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz","integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==","license": "ISC",- "peer": true,"engines": {"node": ">=12"}@@ -5755,7 +5755,6 @@"integrity": "sha512-t5aPOpmtJcZcz5UJyY2GbvpDlsK5E8JqRqoKtfiKE3cNh437KIqfJr3A3AKf5k64NPx6d0G3dno6XDY05PqPtw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@eslint-community/eslint-utils": "^4.8.0","@eslint-community/regexpp": "^4.12.1",@@ -5941,7 +5940,6 @@"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@rtsao/scc": "^1.1.0","array-includes": "^3.1.9",@@ -6453,7 +6451,6 @@"resolved": "https://registry.npmjs.org/fumadocs-core/-/fumadocs-core-16.0.3.tgz","integrity": "sha512-3kr1u0V0iHgIcQek+iRQKvJdbHp+Th8PAO4t74ZzgMpTbHOH6mI1zEpMEask/fTZHKOxDLSJ+q16s+1sAvC5yg==","license": "MIT",- "peer": true,"dependencies": {"@formatjs/intl-localematcher": "^0.6.2","@orama/orama": "^3.1.16",@@ -8153,6 +8150,12 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/lodash": {+ "version": "4.17.21",+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",+ "license": "MIT"+ },"node_modules/lodash-es": {"version": "4.17.21","resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",@@ -8203,7 +8206,6 @@"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.548.0.tgz","integrity": "sha512-63b16z63jM9yc1MwxajHeuu0FRZFsDtljtDjYm26Kd86UQ5HQzu9ksEtoUUw4RBuewodw/tGFmvipePvRsKeDA==","license": "ISC",- "peer": true,"peerDependencies": {"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"}@@ -9456,7 +9458,6 @@"resolved": "https://registry.npmjs.org/next/-/next-16.0.0.tgz","integrity": "sha512-nYohiNdxGu4OmBzggxy9rczmjIGI+TpR5vbKTsE1HqYwNm1B+YSiugSrFguX6omMOKnDHAmBPY4+8TNJk0Idyg==","license": "MIT",- "peer": true,"dependencies": {"@next/env": "16.0.0","@swc/helpers": "0.5.15",@@ -10043,7 +10044,6 @@"resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz","integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==","license": "MIT",- "peer": true,"engines": {"node": ">=0.10.0"}@@ -10053,7 +10053,6 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz","integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==","license": "MIT",- "peer": true,"dependencies": {"scheduler": "^0.27.0"},@@ -11133,8 +11132,7 @@"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.16.tgz","integrity": "sha512-pONL5awpaQX4LN5eiv7moSiSPd/DLDzKVRJz8Q9PgzmAdd1R4307GQS2ZpfiN7ZmekdQrfhZZiSE5jkLR4WNaA==","devOptional": true,- "license": "MIT",- "peer": true+ "license": "MIT"},"node_modules/tapable": {"version": "2.3.0",@@ -11356,7 +11354,6 @@"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==","dev": true,"license": "Apache-2.0",- "peer": true,"bin": {"tsc": "bin/tsc","tsserver": "bin/tsserver"@@ -11899,7 +11896,6 @@"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.12.tgz","integrity": "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --git a/docs/package.json b/docs/package.jsonindex f0454dea2..6e16578c6 100644--- a/docs/package.json+++ b/docs/package.json@@ -20,6 +20,7 @@"fumadocs-core": "16.0.3","fumadocs-mdx": "13.0.2","fumadocs-ui": "16.0.3",+ "lodash": "^4.17.21","lucide-react": "^0.548.0","mermaid": "^11.12.0","next": "16.0.0",@@ -32,6 +33,7 @@},"devDependencies": {"@tailwindcss/postcss": "^4.1.16",+ "@types/lodash": "^4.17.20","@types/mdx": "^2.0.13","@types/node": "24.9.1","@types/react": "^19.2.2",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.tsxnew file mode 100644index 000000000..daa58c2d2--- /dev/null+++ b/docs/src/app/(home)/tools/ai-privacy-policy-generator/page.tsx@@ -0,0 +1,277 @@+"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/page.tsx b/docs/src/app/(home)/tools/analytics-detector/page.tsxnew file mode 100644index 000000000..03a472b29--- /dev/null+++ b/docs/src/app/(home)/tools/analytics-detector/page.tsx@@ -0,0 +1,258 @@+"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 Link from "next/link";+import { useState } from "react";++interface Platform {+ name: string;+ category: string;+ privacy: string;+ identifier?: string;+}++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 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="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>+ );+}diff --git a/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsx b/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsxnew file mode 100644index 000000000..4edf1dcb8--- /dev/null+++ b/docs/src/app/(home)/tools/bounce-rate-calculator/page.tsx@@ -0,0 +1,252 @@+"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";++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 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 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-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>++ <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">+ <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>++ {/* 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>+ );+}diff --git a/docs/src/app/(home)/tools/ctr-calculator/page.tsx b/docs/src/app/(home)/tools/ctr-calculator/page.tsxnew file mode 100644index 000000000..fcf9ac1ba--- /dev/null+++ b/docs/src/app/(home)/tools/ctr-calculator/page.tsx@@ -0,0 +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 Link from "next/link";+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 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>++ {/* 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>++ {/* 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>++ {/* 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>++ <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>++ <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>++ </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 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>+ );+}diff --git a/docs/src/app/(home)/tools/funnel-visualizer/page.tsx b/docs/src/app/(home)/tools/funnel-visualizer/page.tsxnew file mode 100644index 000000000..50d77c8bc--- /dev/null+++ b/docs/src/app/(home)/tools/funnel-visualizer/page.tsx@@ -0,0 +1,323 @@+"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 Link from "next/link";+import { useState } from "react";++interface FunnelStep {+ name: string;+ visitors: string;+}++interface FunnelChartData {+ stepName: string;+ visitors: number;+ conversionRate: number;+ dropoffRate: number;+ stepNumber: number;+}++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 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 lastStep = chartData?.[chartData.length - 1];+ const totalConversionRate = lastStep?.conversionRate || 0;++ const clearForm = () => {+ setSteps([+ { name: "Landing Page", visitors: "" },+ { name: "Product Page", visitors: "" },+ { name: "Cart", visitors: "" },+ { name: "Checkout", visitors: "" },+ { name: "Purchase", visitors: "" },+ ]);+ };++ 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>+ );+}diff --git a/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsx b/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsxnew file mode 100644index 000000000..dceb712a8--- /dev/null+++ b/docs/src/app/(home)/tools/marketing-roi-calculator/page.tsx@@ -0,0 +1,288 @@+"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";++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>++ {/* 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>+ </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>++ <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>++ <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>++ </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>+ );+}diff --git a/docs/src/app/(home)/tools/meta-description-generator/page.tsx b/docs/src/app/(home)/tools/meta-description-generator/page.tsxnew file mode 100644index 000000000..a006be064--- /dev/null+++ b/docs/src/app/(home)/tools/meta-description-generator/page.tsx@@ -0,0 +1,254 @@+"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 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;+ }++ 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 (+ <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>+ );+}diff --git a/docs/src/app/(home)/tools/og-tag-generator/page.tsx b/docs/src/app/(home)/tools/og-tag-generator/page.tsxnew file mode 100644index 000000000..ed5aa016f--- /dev/null+++ b/docs/src/app/(home)/tools/og-tag-generator/page.tsx@@ -0,0 +1,287 @@+"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 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);++ 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="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>++ {/* 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>++ <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>+ )}++ <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>+ </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>+ );+}diff --git a/docs/src/app/(home)/tools/page-speed-calculator/page.tsx b/docs/src/app/(home)/tools/page-speed-calculator/page.tsxnew file mode 100644index 000000000..c4622844e--- /dev/null+++ b/docs/src/app/(home)/tools/page-speed-calculator/page.tsx@@ -0,0 +1,349 @@+"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";++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>+ );+}diff --git a/docs/src/app/(home)/tools/page.tsx b/docs/src/app/(home)/tools/page.tsxnew file mode 100644index 000000000..ad324e284--- /dev/null+++ b/docs/src/app/(home)/tools/page.tsx@@ -0,0 +1,177 @@+import Link from "next/link";+import {+ Activity,+ Calculator,+ DollarSign,+ FileText,+ Gauge,+ Link as LinkIcon,+ MousePointerClick,+ Search,+ Share2,+ Sparkles,+ TrendingDown,+ Type,+ Users,+} from "lucide-react";++export const metadata = {+ title: "Free Marketing Tools | Rybbit",+ description:+ "Free calculators and AI-powered tools for marketers. UTM builder, CTR calculator, ROI calculator, SEO generators, and more.",+};++const tools = [+ {+ href: "/tools/utm-builder",+ icon: LinkIcon,+ title: "UTM Builder",+ description:+ "Create trackable campaign URLs with UTM parameters. Perfect for tracking your marketing campaigns across different channels.",+ category: "Campaign Tools",+ },+ {+ href: "/tools/ctr-calculator",+ icon: MousePointerClick,+ title: "CTR Calculator",+ description:+ "Calculate your click-through rate and compare it to industry benchmarks. See how your campaigns perform against the competition.",+ category: "Analytics",+ },+ {+ href: "/tools/marketing-roi-calculator",+ icon: Calculator,+ title: "Marketing ROI Calculator",+ description:+ "Calculate ROI, ROAS, and profit margins for your marketing campaigns. Make data-driven decisions about your ad spend.",+ category: "Analytics",+ },+ {+ href: "/tools/bounce-rate-calculator",+ icon: TrendingDown,+ 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.",+ category: "Analytics",+ },+ {+ href: "/tools/sample-size-calculator",+ icon: Users,+ 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.",+ category: "Analytics",+ },+ {+ href: "/tools/traffic-value-calculator",+ icon: DollarSign,+ title: "Traffic Value Calculator",+ description:+ "Estimate the monetary value of your website traffic. Understand what each visitor is worth to your business.",+ category: "Analytics",+ },+ {+ href: "/tools/page-speed-calculator",+ icon: Gauge,+ title: "Page Speed Impact Calculator",+ description:+ "Calculate how page load time affects your conversions and revenue. See the real cost of a slow website.",+ category: "Analytics",+ },+ {+ href: "/tools/funnel-visualizer",+ icon: Activity,+ title: "Funnel Visualizer",+ description:+ "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,+ title: "Analytics Platform Detector",+ description:+ "Discover what analytics and tracking tools any website is using. Analyze privacy implications and data collection practices.",+ category: "AI-Powered",+ },+ {+ href: "/tools/seo-title-generator",+ icon: Type,+ 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.",+ category: "AI-Powered SEO",+ },+ {+ href: "/tools/meta-description-generator",+ icon: FileText,+ title: "Meta Description Generator",+ description:+ "Create compelling meta descriptions that boost click-through rates. AI-powered variations optimized for search engines.",+ category: "AI-Powered SEO",+ },+ {+ href: "/tools/og-tag-generator",+ icon: Share2,+ title: "Open Graph Tag Generator",+ description:+ "Generate optimized Open Graph tags for social media sharing. Get perfect previews on Facebook, Twitter, and LinkedIn.",+ category: "AI-Powered SEO",+ },+ {+ href: "/tools/privacy-policy-builder",+ icon: FileText,+ title: "Privacy Policy Builder",+ description:+ "Generate a customized privacy policy for your website. Answer a few questions and get a compliant privacy policy instantly.",+ category: "Legal",+ },+];++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="max-w-[1300px] mx-auto px-6 py-20">+ {/* Header */}+ <div className="text-center mb-16">+ <h1 className="text-4xl md:text-5xl font-bold text-neutral-900 dark:text-white mb-4">Free Marketing Tools</h1>+ <p className="text-lg text-neutral-600 dark:text-neutral-400 max-w-2xl mx-auto">+ Powerful calculators and generators to help you make data-driven marketing decisions. All tools are 100%+ free to use.+ </p>+ </div>++ {/* Tools Grid */}+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">+ {tools.map(tool => {+ const Icon = tool.icon;+ return (+ <Link+ key={tool.href}+ href={tool.href}+ className="group bg-white/50 dark:bg-neutral-900/50 border border-neutral-200 dark:border-neutral-800 rounded-xl p-8 transition-all hover:border-emerald-500/40 dark:hover:border-emerald-500/30 hover:-translate-y-1 duration-300"+ >+ <div className="w-12 h-12 rounded-xl bg-gradient-to-br from-emerald-500/30 to-emerald-600/20 dark:from-emerald-500/20 dark:to-emerald-600/10 border border-emerald-500/40 dark:border-emerald-500/30 shadow-md shadow-emerald-500/20 dark:shadow-emerald-500/10 flex items-center justify-center mb-6 group-hover:scale-110 transition-transform duration-300">+ <Icon className="w-6 h-6 text-emerald-600 dark:text-emerald-400" />+ </div>+ <h2 className="text-xl font-semibold text-neutral-900 dark:text-white mb-2">{tool.title}</h2>+ <p className="text-sm text-neutral-600 dark:text-neutral-300 mb-4">{tool.description}</p>+ <div className="flex items-center text-emerald-600 dark:text-emerald-400 text-sm font-medium group-hover:translate-x-1 transition-transform duration-300">+ Try it now →+ </div>+ </Link>+ );+ })}+ </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.tsxnew file mode 100644index 000000000..a16c079f8--- /dev/null+++ b/docs/src/app/(home)/tools/privacy-policy-builder/page.tsx@@ -0,0 +1,397 @@+"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";++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>+ );+}diff --git a/docs/src/app/(home)/tools/sample-size-calculator/page.tsx b/docs/src/app/(home)/tools/sample-size-calculator/page.tsxnew file mode 100644index 000000000..6e6ff6ca2--- /dev/null+++ b/docs/src/app/(home)/tools/sample-size-calculator/page.tsx@@ -0,0 +1,261 @@+"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";++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;++ // 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="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>++ {/* 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>++ {/* 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>+ </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>+ );+}diff --git a/docs/src/app/(home)/tools/seo-title-generator/page.tsx b/docs/src/app/(home)/tools/seo-title-generator/page.tsxnew file mode 100644index 000000000..85e564795--- /dev/null+++ b/docs/src/app/(home)/tools/seo-title-generator/page.tsx@@ -0,0 +1,254 @@+"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 Link from "next/link";+import { useState } from "react";++interface TitleOption {+ title: string;+ length: number;+ approach: string;+}++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>+ );+}diff --git a/docs/src/app/(home)/tools/traffic-value-calculator/page.tsx b/docs/src/app/(home)/tools/traffic-value-calculator/page.tsxnew file mode 100644index 000000000..74623ed7f--- /dev/null+++ b/docs/src/app/(home)/tools/traffic-value-calculator/page.tsx@@ -0,0 +1,284 @@+"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";++export default function TrafficValueCalculatorPage() {+ 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 (+ <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>+ );+}diff --git a/docs/src/app/(home)/tools/utm-builder/page.tsx b/docs/src/app/(home)/tools/utm-builder/page.tsxnew file mode 100644index 000000000..82b0611fc--- /dev/null+++ b/docs/src/app/(home)/tools/utm-builder/page.tsx@@ -0,0 +1,253 @@+"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 } from "lucide-react";+import Link from "next/link";+import { useMemo, useState } from "react";++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>++ {/* 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">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>++ <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>++ <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>++ </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>+ );+}diff --git a/docs/src/app/api/tools/detect-analytics/route.ts b/docs/src/app/api/tools/detect-analytics/route.tsnew file mode 100644index 000000000..33023d9aa--- /dev/null+++ b/docs/src/app/api/tools/detect-analytics/route.ts@@ -0,0 +1,125 @@+import { callOpenRouter } from "@/lib/openrouter";+import { getClientIP, rateLimit } from "@/lib/rate-limit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const requestSchema = z.object({+ url: z.string().url(),+});++export async function POST(request: NextRequest) {+ try {+ // Rate limiting+ const ip = getClientIP(request);+ const rateLimitResult = rateLimit(`analytics-detect:${ip}`, 5, 60 * 1000);++ const headers = new Headers({+ "X-RateLimit-Limit": rateLimitResult.limit.toString(),+ "X-RateLimit-Remaining": rateLimitResult.remaining.toString(),+ "X-RateLimit-Reset": new Date(rateLimitResult.reset).toISOString(),+ });++ if (!rateLimitResult.success) {+ return NextResponse.json({ error: "Rate limit exceeded. Please try again later." }, { status: 429, headers });+ }++ // Parse and validate request+ const body = await request.json();+ const validatedData = requestSchema.parse(body);++ // Fetch the website HTML+ let html: string;+ try {+ const response = await fetch(validatedData.url, {+ headers: {+ "User-Agent": "Mozilla/5.0 (compatible; RybbitBot/1.0; +https://rybbit.com)",+ },+ signal: AbortSignal.timeout(10000), // 10 second timeout+ });++ if (!response.ok) {+ throw new Error(`Failed to fetch website: ${response.status}`);+ }++ html = await response.text();+ } catch (fetchError) {+ return NextResponse.json(+ { error: "Failed to fetch website. Please check the URL and try again." },+ { status: 400, headers }+ );+ }++ // Extract script tags and common analytics patterns+ const scriptMatches = html.match(/<script[^>]*>[\s\S]*?<\/script>/gi) || [];+ const scripts = scriptMatches.slice(0, 20).join("\n"); // Limit to first 20 scripts++ // Call OpenRouter to analyze+ const prompt = `You are an expert in web analytics and tracking technologies. Analyze the following HTML snippets from a website and identify all analytics and tracking platforms being used.++Website URL: ${validatedData.url}++HTML Scripts (first 20):+${scripts}++Identify:+1. All analytics platforms (Google Analytics, Mixpanel, Amplitude, Plausible, Rybbit, etc.)+2. Tag managers (Google Tag Manager, Segment, etc.)+3. Heatmap tools (Hotjar, Crazy Egg, etc.)+4. Session replay tools+5. Any other tracking technologies++For each platform found, provide:+- Platform name+- What it's used for (analytics, marketing, etc.)+- Privacy implications (cookies used, data collected)+- Detected version/identifier if available++Return your analysis in JSON format:+{+ "platforms": [+ {+ "name": "Platform Name",+ "category": "Analytics/Tag Manager/Heatmap/etc",+ "privacy": "Brief privacy assessment",+ "identifier": "ID or version if found"+ }+ ],+ "summary": "Brief overall summary of tracking on this site",+ "privacyScore": "Low/Medium/High (based on tracking intensity)"+}++If no analytics platforms are detected, say so clearly.`;++ const response = await callOpenRouter([+ {+ role: "user",+ content: prompt,+ },+ ]);++ // Try to parse JSON response+ let result;+ try {+ // Extract JSON from markdown code blocks if present+ const jsonMatch = response.match(/```json\s*([\s\S]*?)\s*```/) || response.match(/\{[\s\S]*\}/);+ const jsonStr = jsonMatch ? jsonMatch[1] || jsonMatch[0] : response;+ result = JSON.parse(jsonStr);+ } catch {+ // If parsing fails, return the raw response+ result = {+ platforms: [],+ summary: response,+ privacyScore: "Unknown",+ };+ }++ return NextResponse.json(result, { headers });+ } catch (error) {+ if (error instanceof z.ZodError) {+ return NextResponse.json({ error: "Invalid request data", details: z.treeifyError(error) }, { status: 400 });+ }++ console.error("Analytics detection error:", error);+ return NextResponse.json({ error: "Failed to detect analytics platforms. Please try again." }, { status: 500 });+ }+}diff --git a/docs/src/app/api/tools/generate-meta-description/route.ts b/docs/src/app/api/tools/generate-meta-description/route.tsnew file mode 100644index 000000000..a9efae44f--- /dev/null+++ b/docs/src/app/api/tools/generate-meta-description/route.ts@@ -0,0 +1,88 @@+import { callOpenRouter } from "@/lib/openrouter";+import { getClientIP, rateLimit } from "@/lib/rate-limit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const requestSchema = z.object({+ topic: z.string().min(3).max(500),+ keywords: z.string().max(200).optional(),+});++export async function POST(request: NextRequest) {+ try {+ // Rate limiting+ const ip = getClientIP(request);+ const rateLimitResult = rateLimit(`meta-desc:${ip}`, 10, 60 * 1000);++ const headers = new Headers({+ "X-RateLimit-Limit": rateLimitResult.limit.toString(),+ "X-RateLimit-Remaining": rateLimitResult.remaining.toString(),+ "X-RateLimit-Reset": new Date(rateLimitResult.reset).toISOString(),+ });++ if (!rateLimitResult.success) {+ return NextResponse.json({ error: "Rate limit exceeded. Please try again later." }, { status: 429, headers });+ }++ // Parse and validate request+ const body = await request.json();+ const validatedData = requestSchema.parse(body);++ const keywordsText = validatedData.keywords ? `\nTarget keywords: ${validatedData.keywords}` : "";++ // Call OpenRouter to generate meta descriptions+ const prompt = `You are an SEO expert. Generate 5 optimized meta descriptions for a webpage about the following topic:++Topic: ${validatedData.topic}${keywordsText}++Requirements:+- Each description should be 150-160 characters long (optimal for search engines)+- Include the primary keyword naturally+- Make them compelling with a clear call-to-action+- Vary the approach (e.g., benefit-focused, problem-solution, feature highlight, social proof, urgency)+- Accurately summarize the page content++Return ONLY a JSON array of description objects in this exact format:+[+ {+ "description": "The meta description text here",+ "length": 156,+ "approach": "Benefit-focused"+ }+]++Do not include any markdown formatting or explanation, just the raw JSON array.`;++ const response = await callOpenRouter([+ {+ role: "user",+ content: prompt,+ },+ ]);++ // Parse JSON response+ let descriptions;+ try {+ // Extract JSON from response+ const jsonMatch = response.match(/\[[\s\S]*\]/);+ if (!jsonMatch) {+ throw new Error("No JSON array found in response");+ }+ descriptions = JSON.parse(jsonMatch[0]);+ } catch {+ return NextResponse.json(+ { error: "Failed to parse generated descriptions. Please try again." },+ { status: 500, headers }+ );+ }++ return NextResponse.json({ descriptions }, { headers });+ } catch (error) {+ if (error instanceof z.ZodError) {+ return NextResponse.json({ error: "Invalid request data", details: z.treeifyError(error) }, { status: 400 });+ }++ console.error("Meta description generation error:", error);+ return NextResponse.json({ error: "Failed to generate meta descriptions. Please try again." }, { status: 500 });+ }+}diff --git a/docs/src/app/api/tools/generate-og-tags/route.ts b/docs/src/app/api/tools/generate-og-tags/route.tsnew file mode 100644index 000000000..2a13380c3--- /dev/null+++ b/docs/src/app/api/tools/generate-og-tags/route.ts@@ -0,0 +1,93 @@+import { callOpenRouter } from "@/lib/openrouter";+import { getClientIP, rateLimit } from "@/lib/rate-limit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const requestSchema = z.object({+ pageTitle: z.string().min(3).max(200),+ pageDescription: z.string().min(10).max(500),+ pageType: z.enum(["website", "article", "product", "blog"]),+});++export async function POST(request: NextRequest) {+ try {+ // Rate limiting+ const ip = getClientIP(request);+ const rateLimitResult = rateLimit(`og-tags:${ip}`, 10, 60 * 1000);++ const headers = new Headers({+ "X-RateLimit-Limit": rateLimitResult.limit.toString(),+ "X-RateLimit-Remaining": rateLimitResult.remaining.toString(),+ "X-RateLimit-Reset": new Date(rateLimitResult.reset).toISOString(),+ });++ if (!rateLimitResult.success) {+ return NextResponse.json({ error: "Rate limit exceeded. Please try again later." }, { status: 429, headers });+ }++ // Parse and validate request+ const body = await request.json();+ const validatedData = requestSchema.parse(body);++ // Call OpenRouter to generate OG tags+ const prompt = `You are a social media and SEO expert. Generate optimized Open Graph tags for a webpage with the following details:++Page Title: ${validatedData.pageTitle}+Page Description: ${validatedData.pageDescription}+Page Type: ${validatedData.pageType}++Generate 3 variations of Open Graph tags optimized for social media sharing (Facebook, Twitter, LinkedIn). For each variation:+- og:title: Compelling title for social shares (may differ from page title, 60-90 chars)+- og:description: Engaging description (150-200 chars)+- og:type: ${validatedData.pageType}+- og:image suggestion: Describe what kind of image would work best+- twitter:card: Appropriate card type (summary, summary_large_image, etc.)++Return ONLY a JSON array in this exact format:+[+ {+ "variation": "Professional",+ "ogTitle": "Title here",+ "ogDescription": "Description here",+ "ogType": "${validatedData.pageType}",+ "ogImageSuggestion": "Description of ideal image",+ "twitterCard": "summary_large_image",+ "htmlCode": "<meta property=\\"og:title\\" content=\\"...\\">\\n<meta property=\\"og:description\\" content=\\"...\\">\\n..."+ }+]++Include complete HTML meta tags in the htmlCode field. Do not include any markdown formatting or explanation.`;++ const response = await callOpenRouter([+ {+ role: "user",+ content: prompt,+ },+ ]);++ // Parse JSON response+ let variations;+ try {+ // Extract JSON from response+ const jsonMatch = response.match(/\[[\s\S]*\]/);+ if (!jsonMatch) {+ throw new Error("No JSON array found in response");+ }+ variations = JSON.parse(jsonMatch[0]);+ } catch {+ return NextResponse.json(+ { error: "Failed to parse generated OG tags. Please try again." },+ { status: 500, headers }+ );+ }++ return NextResponse.json({ variations }, { headers });+ } catch (error) {+ if (error instanceof z.ZodError) {+ return NextResponse.json({ error: "Invalid request data", details: z.treeifyError(error) }, { status: 400 });+ }++ console.error("OG tags generation error:", error);+ return NextResponse.json({ error: "Failed to generate OG tags. Please try again." }, { status: 500 });+ }+}diff --git a/docs/src/app/api/tools/generate-privacy-policy/route.ts b/docs/src/app/api/tools/generate-privacy-policy/route.tsnew file mode 100644index 000000000..d132abb8b--- /dev/null+++ b/docs/src/app/api/tools/generate-privacy-policy/route.ts@@ -0,0 +1,70 @@+import { callOpenRouter } from "@/lib/openrouter";+import { getClientIP, rateLimit } from "@/lib/rate-limit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const requestSchema = z.object({+ siteDescription: z.string().min(10).max(1000),+ websiteName: z.string().min(1).max(200),+ websiteUrl: z.string().url(),+ contactEmail: z.string().email(),+});++export async function POST(request: NextRequest) {+ try {+ // Rate limiting+ const ip = getClientIP(request);+ const rateLimitResult = rateLimit(`privacy-policy:${ip}`, 5, 60 * 1000);++ const headers = new Headers({+ "X-RateLimit-Limit": rateLimitResult.limit.toString(),+ "X-RateLimit-Remaining": rateLimitResult.remaining.toString(),+ "X-RateLimit-Reset": new Date(rateLimitResult.reset).toISOString(),+ });++ if (!rateLimitResult.success) {+ return NextResponse.json({ error: "Rate limit exceeded. Please try again later." }, { status: 429, headers });+ }++ // Parse and validate request+ const body = await request.json();+ const validatedData = requestSchema.parse(body);++ // Call OpenRouter to generate privacy policy+ const prompt = `You are a legal expert specializing in privacy policies. Generate a comprehensive, GDPR and CCPA compliant privacy policy for a website based on the following information:++Website Name: ${validatedData.websiteName}+Website URL: ${validatedData.websiteUrl}+Contact Email: ${validatedData.contactEmail}+Description: ${validatedData.siteDescription}++IMPORTANT: Include a section about analytics that mentions they use Rybbit (https://rybbit.com), a privacy-focused, cookieless analytics platform that doesn't track users across sites and is GDPR compliant.++Return the privacy policy in markdown format with proper headings, sections, and formatting. Include sections for:+- Information We Collect+- How We Use Your Information+- Cookies and Tracking (mention that Rybbit doesn't use cookies)+- Data Sharing+- Your Rights+- Contact Information+- Updates to This Policy++Make it professional, legally sound, and tailored to their specific use case.`;++ const response = await callOpenRouter([+ {+ role: "user",+ content: prompt,+ },+ ]);++ return NextResponse.json({ policy: response }, { headers });+ } catch (error) {+ if (error instanceof z.ZodError) {+ return NextResponse.json({ error: "Invalid request data", details: z.treeifyError(error) }, { status: 400 });+ }++ console.error("Privacy policy generation error:", error);+ return NextResponse.json({ error: "Failed to generate privacy policy. Please try again." }, { status: 500 });+ }+}diff --git a/docs/src/app/api/tools/generate-seo-title/route.ts b/docs/src/app/api/tools/generate-seo-title/route.tsnew file mode 100644index 000000000..214cb5545--- /dev/null+++ b/docs/src/app/api/tools/generate-seo-title/route.ts@@ -0,0 +1,88 @@+import { callOpenRouter } from "@/lib/openrouter";+import { getClientIP, rateLimit } from "@/lib/rate-limit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const requestSchema = z.object({+ topic: z.string().min(3).max(500),+ keywords: z.string().max(200).optional(),+});++export async function POST(request: NextRequest) {+ try {+ // Rate limiting+ const ip = getClientIP(request);+ const rateLimitResult = rateLimit(`seo-title:${ip}`, 10, 60 * 1000);++ const headers = new Headers({+ "X-RateLimit-Limit": rateLimitResult.limit.toString(),+ "X-RateLimit-Remaining": rateLimitResult.remaining.toString(),+ "X-RateLimit-Reset": new Date(rateLimitResult.reset).toISOString(),+ });++ if (!rateLimitResult.success) {+ return NextResponse.json({ error: "Rate limit exceeded. Please try again later." }, { status: 429, headers });+ }++ // Parse and validate request+ const body = await request.json();+ const validatedData = requestSchema.parse(body);++ const keywordsText = validatedData.keywords ? `\nTarget keywords: ${validatedData.keywords}` : "";++ // Call OpenRouter to generate titles+ const prompt = `You are an SEO expert. Generate 5 optimized title tags for a webpage about the following topic:++Topic: ${validatedData.topic}${keywordsText}++Requirements:+- Each title should be 50-60 characters long (optimal for search engines)+- Include the primary keyword naturally+- Make them compelling and click-worthy+- Vary the approach (e.g., question, how-to, list, benefit-focused, urgency)+- Front-load important keywords when possible++Return ONLY a JSON array of title objects in this exact format:+[+ {+ "title": "The title text here",+ "length": 55,+ "approach": "How-to"+ }+]++Do not include any markdown formatting or explanation, just the raw JSON array.`;++ const response = await callOpenRouter([+ {+ role: "user",+ content: prompt,+ },+ ]);++ // Parse JSON response+ let titles;+ try {+ // Extract JSON from response+ const jsonMatch = response.match(/\[[\s\S]*\]/);+ if (!jsonMatch) {+ throw new Error("No JSON array found in response");+ }+ titles = JSON.parse(jsonMatch[0]);+ } catch {+ return NextResponse.json(+ { error: "Failed to parse generated titles. Please try again." },+ { status: 500, headers }+ );+ }++ return NextResponse.json({ titles }, { headers });+ } catch (error) {+ if (error instanceof z.ZodError) {+ return NextResponse.json({ error: "Invalid request data", details: z.treeifyError(error) }, { status: 400 });+ }++ console.error("SEO title generation error:", error);+ return NextResponse.json({ error: "Failed to generate SEO titles. Please try again." }, { status: 500 });+ }+}diff --git a/docs/src/components/Footer.tsx b/docs/src/components/Footer.tsxindex e4f3aaa07..48b1d1a5d 100644--- a/docs/src/components/Footer.tsx+++ b/docs/src/components/Footer.tsx@@ -138,6 +138,11 @@ export function Footer() {Blog</Link></li>+ <li>+ <Link href="/tools" className="text-neutral-400 hover:text-white transition-colors">+ Tools+ </Link>+ </li><li><ahref="https://github.com/rybbit-io/rybbit"diff --git a/docs/src/lib/openrouter.ts b/docs/src/lib/openrouter.tsnew file mode 100644index 000000000..82d567edc--- /dev/null+++ b/docs/src/lib/openrouter.ts@@ -0,0 +1,72 @@+const OPENROUTER_API_URL = "https://openrouter.ai/api/v1/chat/completions";++export interface OpenRouterMessage {+ role: "system" | "user" | "assistant";+ content: string;+}++export interface OpenRouterResponse {+ id: string;+ choices: Array<{+ message: {+ role: string;+ content: string;+ };+ finish_reason: string;+ }>;+ usage: {+ prompt_tokens: number;+ completion_tokens: number;+ total_tokens: number;+ };+}++export async function callOpenRouter(+ messages: OpenRouterMessage[],+ options?: {+ temperature?: number;+ maxTokens?: number;+ model?: string;+ }+): Promise<string> {+ const apiKey = process.env.OPENROUTER_API_KEY;+ const model = options?.model || process.env.OPENROUTER_MODEL;++ if (!apiKey) {+ throw new Error("OPENROUTER_API_KEY is not configured");+ }++ try {+ const response = await fetch(OPENROUTER_API_URL, {+ method: "POST",+ headers: {+ Authorization: `Bearer ${apiKey}`,+ "Content-Type": "application/json",+ "HTTP-Referer": "https://rybbit.com",+ "X-Title": "Rybbit Analytics Tools",+ },+ body: JSON.stringify({+ model,+ messages,+ temperature: options?.temperature ?? 0.7,+ max_tokens: options?.maxTokens ?? 2000,+ }),+ });++ if (!response.ok) {+ const error = await response.text();+ throw new Error(`OpenRouter API error: ${response.status} - ${error}`);+ }++ const data = (await response.json()) as OpenRouterResponse;++ if (!data.choices || data.choices.length === 0) {+ throw new Error("No response from OpenRouter");+ }++ return data.choices[0].message.content;+ } catch (error) {+ console.error("OpenRouter error:", error);+ throw error;+ }+}diff --git a/docs/src/lib/rate-limit.ts b/docs/src/lib/rate-limit.tsnew file mode 100644index 000000000..f8753b6fb--- /dev/null+++ b/docs/src/lib/rate-limit.ts@@ -0,0 +1,84 @@+interface RateLimitEntry {+ count: number;+ resetTime: number;+}++const rateLimitStore = new Map<string, RateLimitEntry>();++// Clean up old entries every 5 minutes+setInterval(() => {+ const now = Date.now();+ for (const [key, entry] of rateLimitStore.entries()) {+ if (entry.resetTime < now) {+ rateLimitStore.delete(key);+ }+ }+}, 5 * 60 * 1000);++export interface RateLimitResult {+ success: boolean;+ limit: number;+ remaining: number;+ reset: number;+}++export function rateLimit(+ identifier: string,+ limit: number = 10,+ windowMs: number = 60 * 1000 // 1 minute+): RateLimitResult {+ const now = Date.now();+ const entry = rateLimitStore.get(identifier);++ // No existing entry or expired+ if (!entry || entry.resetTime < now) {+ const resetTime = now + windowMs;+ rateLimitStore.set(identifier, {+ count: 1,+ resetTime,+ });+ return {+ success: true,+ limit,+ remaining: limit - 1,+ reset: resetTime,+ };+ }++ // Check if limit exceeded+ if (entry.count >= limit) {+ return {+ success: false,+ limit,+ remaining: 0,+ reset: entry.resetTime,+ };+ }++ // Increment count+ entry.count++;+ rateLimitStore.set(identifier, entry);++ return {+ success: true,+ limit,+ remaining: limit - entry.count,+ reset: entry.resetTime,+ };+}++export function getClientIP(request: Request): string {+ // Try to get IP from various headers (Vercel, Cloudflare, etc.)+ const forwarded = request.headers.get("x-forwarded-for");+ if (forwarded) {+ return forwarded.split(",")[0].trim();+ }++ const real = request.headers.get("x-real-ip");+ if (real) {+ return real;+ }++ // Fallback to a default identifier+ return "unknown";+}