Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Update supplementary CTAs UI

Blue Mousea58afe467481
diff --git a/web/app/utils/renderCtaHtml.ts b/web/app/utils/renderCtaHtml.ts
index 91f9ff327..a18f54c36 100644
--- a/web/app/utils/renderCtaHtml.ts
+++ b/web/app/utils/renderCtaHtml.ts
@@ -1,55 +1,57 @@
import routes from './routes'
-/**
- * Renders the "Time to Switch" CTA component as static HTML
- * This is used in blog posts via the ::CTA:TIME_TO_SWITCH:: placeholder
- */
-const checkIconSvg = `<svg class="mr-1 size-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>`
+const checkIconSvg = `<svg class="size-4 text-gray-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20"/><path d="m9 12 2 2 4-4"/></svg>`
-const arrowRightSvg = `<svg class="mt-[1px] h-4 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 10a.75.75 0 01.75-.75h10.638L10.23 5.29a.75.75 0 111.04-1.08l5.5 5.25a.75.75 0 010 1.08l-5.5 5.25a.75.75 0 11-1.04-1.08l4.158-3.96H3.75A.75.75 0 013 10z" clip-rule="evenodd" /></svg>`
+const arrowRightSvg = `<svg class="mt-[1px] ml-1 h-4 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 10a.75.75 0 01.75-.75h10.638L10.23 5.29a.75.75 0 111.04-1.08l5.5 5.25a.75.75 0 010 1.08l-5.5 5.25a.75.75 0 11-1.04-1.08l4.158-3.96H3.75A.75.75 0 013 10z" clip-rule="evenodd" /></svg>`
-/**
- * Renders the "Time to Switch" CTA component as static HTML
- * This is used in blog posts via the ::CTA:TIME_TO_SWITCH:: placeholder
- */
-export function renderTimeToSwitchCta(): string {
+type ForestCtaOptions = {
+ titleHtml: string
+ description: string
+ ctaLabel: string
+ trustItems: string[]
+}
+
+function renderForestCtaHtml({
+ titleHtml,
+ description,
+ ctaLabel,
+ trustItems,
+}: ForestCtaOptions): string {
return `
<div class="not-prose relative mx-auto my-10 max-w-4xl px-2 lg:px-0">
- <div class="relative mx-auto overflow-hidden rounded-3xl p-1 text-center sm:p-2 lg:p-3">
- <div aria-hidden="true" class="pointer-events-none absolute inset-0">
- <div class="absolute inset-0 rounded-4xl bg-linear-115 from-red-500/50 to-orange-300/30 sm:bg-linear-145 dark:from-red-500/40 dark:to-slate-800/50"></div>
+ <div class="relative isolate overflow-hidden rounded-4xl bg-slate-950 px-5 py-10 ring-1 ring-black/5 sm:px-8 sm:py-14 lg:px-12 lg:py-18 dark:ring-white/10">
+ <div aria-hidden="true" class="pointer-events-none absolute inset-0 -z-10">
+ <img alt="" class="absolute inset-0 size-full object-cover object-center opacity-80 saturate-125" src="/assets/hero-background.webp" loading="lazy" />
+ <div class="absolute inset-0 bg-slate-950/65"></div>
+ <div class="absolute inset-0 bg-radial-[at_50%_38%] from-red-950/20 via-slate-950/20 to-slate-950/85"></div>
</div>
- <div class="rounded-xl p-8 backdrop-blur-xl sm:p-10 lg:p-12">
- <div class="mx-auto max-w-3xl">
- <h2 class="mb-4 text-3xl font-bold tracking-tight text-slate-900 sm:text-4xl lg:text-5xl dark:text-white">
- The web analytics your site deserves.
- </h2>
- <p class="mx-auto mb-8 max-w-2xl text-lg leading-relaxed text-slate-800 dark:text-slate-200">
- Tired of bloated dashboards, privacy concerns, and data you can't trust? Switch to Swetrix and get simple, powerful analytics that respects your users.
- </p>
- <div class="mb-6 flex flex-col items-center justify-center gap-4 sm:flex-row">
- <a
- href="${routes.signup}"
- class="flex items-center justify-center rounded-md border-2 border-slate-900 bg-slate-900 px-6 py-3 text-white transition-all hover:bg-transparent hover:text-slate-900 dark:border-slate-50 dark:bg-gray-50 dark:text-slate-900 dark:hover:bg-transparent dark:hover:text-gray-50"
- >
- <span class="mr-1 text-center text-base font-semibold">Start your free trial</span>
- ${arrowRightSvg}
- </a>
- </div>
- <div class="flex flex-wrap items-center justify-center gap-x-6 gap-y-3 text-sm text-slate-800 dark:text-slate-200">
- <div class="flex items-center">
- ${checkIconSvg}
- Cancel anytime
- </div>
- <div class="flex items-center">
- ${checkIconSvg}
- 5 minute setup
- </div>
- <div class="flex items-center">
- ${checkIconSvg}
- GDPR compliant
- </div>
- </div>
+
+ <div class="relative mx-auto flex max-w-5xl flex-col items-center text-center">
+ <h2 class="max-w-5xl text-3xl font-bold tracking-tight text-gray-50 sm:text-4xl lg:text-5xl">
+ ${titleHtml}
+ </h2>
+ <p class="mt-6 max-w-3xl text-lg leading-8 text-gray-200">
+ ${description}
+ </p>
+ <div class="mt-9 flex w-full flex-col justify-center gap-3 sm:w-auto sm:flex-row sm:items-center">
+ <a
+ href="${routes.signup}"
+ class="inline-flex h-12 items-center justify-center rounded-md bg-white px-5 text-slate-950 ring-1 ring-white/30 transition-colors hover:bg-gray-100"
+ >
+ <span class="text-center text-base font-semibold">${ctaLabel}</span>
+ ${arrowRightSvg}
+ </a>
+ </div>
+
+ <div class="mt-7 flex flex-wrap justify-center gap-x-6 gap-y-3 text-sm text-gray-200">
+ ${trustItems
+ .map(
+ (item) => `<div class="flex items-center gap-2">
+ ${checkIconSvg}
+ ${item}
+ </div>`,
+ )
+ .join('')}
</div>
</div>
</div>
@@ -57,51 +59,23 @@ export function renderTimeToSwitchCta(): string {
`
}
-/**
- * Renders the "Ditch Google Analytics" CTA component as static HTML
- * This is used in blog posts via the ::CTA:TIME_TO_DITCH_GOOGLE:: placeholder
- */
+export function renderTimeToSwitchCta(): string {
+ return renderForestCtaHtml({
+ titleHtml: 'The web analytics your site deserves.',
+ description:
+ "Tired of bloated dashboards, privacy concerns, and data you can't trust? Switch to Swetrix and get simple, powerful analytics that respects your users.",
+ ctaLabel: 'Start your free trial',
+ trustItems: ['Cancel anytime', '5 minute setup', 'GDPR compliant'],
+ })
+}
+
export function renderDitchGoogleCta(): string {
- return `
-<div class="not-prose relative mx-auto my-10 max-w-4xl px-2 lg:px-0">
- <div class="relative mx-auto overflow-hidden rounded-3xl p-1 text-center sm:p-2 lg:p-3">
- <div aria-hidden="true" class="pointer-events-none absolute inset-0">
- <div class="absolute inset-0 rounded-4xl bg-linear-115 from-red-500/50 to-orange-300/30 sm:bg-linear-145 dark:from-red-500/40 dark:to-orange-300/20"></div>
- </div>
- <div class="rounded-xl p-8 backdrop-blur-xl sm:p-10 lg:p-12">
- <div class="mx-auto max-w-3xl">
- <h2 class="mb-4 text-3xl font-bold tracking-tight text-slate-900 sm:text-4xl lg:text-5xl dark:text-white">
- Time to <span class="bg-gradient-to-r from-red-600 to-orange-600 bg-clip-text text-transparent">ditch</span> Google Analytics
- </h2>
- <p class="mx-auto mb-8 max-w-2xl text-lg leading-relaxed text-slate-800 dark:text-slate-200">
- Google Analytics is overkill for most site owners. Swetrix is a simple, privacy-focused alternative that's easy to use and doesn't require cookie consent banners.
- </p>
- <div class="mb-6 flex flex-col items-center justify-center gap-4 sm:flex-row">
- <a
- href="${routes.signup}"
- class="flex items-center justify-center rounded-md border-2 border-slate-900 bg-slate-900 px-6 py-3 text-white transition-all hover:bg-transparent hover:text-slate-900 dark:border-slate-50 dark:bg-gray-50 dark:text-slate-900 dark:hover:bg-transparent dark:hover:text-gray-50"
- >
- <span class="mr-1 text-center text-base font-semibold">Start a 14-day free trial</span>
- ${arrowRightSvg}
- </a>
- </div>
- <div class="flex flex-wrap items-center justify-center gap-x-6 gap-y-3 text-sm text-slate-800 dark:text-slate-200">
- <div class="flex items-center">
- ${checkIconSvg}
- Free to try
- </div>
- <div class="flex items-center">
- ${checkIconSvg}
- Easy to use
- </div>
- <div class="flex items-center">
- ${checkIconSvg}
- Privacy-first
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-`
+ return renderForestCtaHtml({
+ titleHtml:
+ 'Time to <span class="text-red-400">ditch</span> Google Analytics',
+ description:
+ "Google Analytics is overkill for most site owners. Swetrix is a simple, privacy-focused alternative that's easy to use and doesn't require cookie consent banners.",
+ ctaLabel: 'Start a 14-day free trial',
+ trustItems: ['Free to try', 'Easy to use', 'Privacy-first'],
+ })
}