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!

A/B test old vs new hero variants

Blue Mouse70ffd3a4ad00
diff --git a/web/app/components/marketing/FeaturesGrid.tsx b/web/app/components/marketing/FeaturesGrid.tsx
index 0b7e24180..95c769d98 100644
--- a/web/app/components/marketing/FeaturesGrid.tsx
+++ b/web/app/components/marketing/FeaturesGrid.tsx
@@ -45,7 +45,7 @@ const DashboardMockup = () => (
<Text
size='xxs'
weight='semibold'
- colour='muted'
+ colour='secondary'
tracking='wide'
className='uppercase'
>
@@ -103,7 +103,7 @@ const DashboardMockup = () => (
</svg>
<div className='mt-1 flex justify-between'>
{['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map((d) => (
- <Text key={d} size='xxs' colour='muted'>
+ <Text key={d} size='xxs' colour='secondary'>
{d}
</Text>
))}
@@ -116,10 +116,10 @@ const DashboardMockup = () => (
Events
</Text>
<div className='mt-2 mb-1.5 flex items-center justify-between px-1'>
- <Text size='xxs' weight='medium' colour='muted'>
+ <Text size='xxs' weight='medium' colour='secondary'>
Event
</Text>
- <Text size='xxs' weight='medium' colour='muted'>
+ <Text size='xxs' weight='medium' colour='secondary'>
Quantity
</Text>
</div>
@@ -136,7 +136,7 @@ const DashboardMockup = () => (
className='relative flex items-center justify-between rounded-sm px-1 py-1.5'
>
<div
- className='absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/10'
+ className='absolute inset-0 rounded-sm bg-blue-50 dark:bg-blue-900/30'
style={{ width: `${barW}%` }}
/>
<Text size='xs' className='relative z-10'>
@@ -146,10 +146,10 @@ const DashboardMockup = () => (
<Text size='xs' weight='medium'>
{count}
</Text>
- <Text size='xs' colour='muted' className='mx-1.5'>
+ <Text size='xs' colour='secondary' className='mx-1.5'>
|
</Text>
- <Text size='xs' colour='muted'>
+ <Text size='xs' colour='secondary'>
{pct}%
</Text>
</span>
@@ -168,7 +168,7 @@ const DashboardMockup = () => (
{ label: 'Bounce rate', value: '42%', up: false },
].map(({ label, value, up }) => (
<div key={label} className='flex items-center justify-between'>
- <Text size='xs' colour='muted'>
+ <Text size='xs' colour='secondary'>
{label}
</Text>
<div className='flex items-center gap-1.5'>
@@ -195,10 +195,10 @@ const DashboardMockup = () => (
Pages
</Text>
<div className='mb-1 flex items-center justify-between px-1'>
- <Text size='xs' weight='medium' colour='muted'>
+ <Text size='xs' weight='medium' colour='secondary'>
Page
</Text>
- <Text size='xs' weight='medium' colour='muted'>
+ <Text size='xs' weight='medium' colour='secondary'>
Visitors
</Text>
</div>
diff --git a/web/app/components/marketing/LogoCloud.tsx b/web/app/components/marketing/LogoCloud.tsx
index b217c10ce..858c7f141 100644
--- a/web/app/components/marketing/LogoCloud.tsx
+++ b/web/app/components/marketing/LogoCloud.tsx
@@ -1,5 +1,6 @@
import { useTranslation } from 'react-i18next'
+import { useTheme } from '~/providers/ThemeProvider'
import { Text } from '~/ui/Text'
import { cn } from '~/utils/generic'
@@ -57,23 +58,46 @@ const LOGOS: ImageLogo[] = [
},
]
-export const LogoCloud = () => {
+type LogoCloudVariant = 'old' | 'new'
+
+interface LogoCloudProps {
+ variant?: LogoCloudVariant
+}
+
+export const LogoCloud = ({ variant = 'new' }: LogoCloudProps) => {
const { t } = useTranslation('common')
+ const { theme } = useTheme()
+ const isNewVariant = variant === 'new'
return (
- <section className='mx-2 -mt-px rounded-b-4xl bg-slate-950 pt-14 pb-16 ring-1 ring-black/5 dark:ring-white/10'>
+ <section
+ className={cn(
+ 'rounded-b-4xl pt-14 pb-16',
+ isNewVariant
+ ? 'mx-2 -mt-px bg-slate-950 ring-1 ring-black/5 dark:ring-white/10'
+ : 'bg-gray-100/80 dark:bg-slate-900/50',
+ )}
+ >
<div className='mx-auto max-w-7xl px-4 sm:px-6 lg:px-8'>
<Text
as='p'
size='xs'
weight='semibold'
- colour='inherit'
- className='text-center tracking-[0.18em] text-gray-200 uppercase'
+ colour={isNewVariant ? 'inherit' : 'muted'}
+ className={cn(
+ 'text-center tracking-[0.18em] uppercase',
+ isNewVariant && 'text-gray-200',
+ )}
>
{t('main.logoCloud.title')}
</Text>
- <ul className='mx-auto mt-10 grid max-w-6xl grid-cols-2 items-center justify-items-center gap-x-8 gap-y-10 sm:grid-cols-3 sm:gap-x-12 lg:grid-cols-6 lg:gap-x-8'>
+ <ul
+ className={cn(
+ 'mx-auto mt-10 grid grid-cols-2 items-center justify-items-center gap-x-8 gap-y-10 sm:grid-cols-3 sm:gap-x-12 lg:max-w-6xl lg:grid-cols-6 lg:gap-x-8',
+ isNewVariant ? 'max-w-6xl' : 'max-w-5xl',
+ )}
+ >
{LOGOS.map((logo) => (
<li
key={logo.name}
@@ -81,12 +105,21 @@ export const LogoCloud = () => {
>
<img
alt={logo.name}
- src={logo.dark ?? logo.light}
+ src={
+ isNewVariant
+ ? (logo.dark ?? logo.light)
+ : logo.dark && theme === 'dark'
+ ? logo.dark
+ : logo.light
+ }
loading='lazy'
className={cn(
'w-auto max-w-[180px] object-contain',
logo.heightClass,
- !logo.dark && 'brightness-0 invert',
+ !logo.dark &&
+ (isNewVariant
+ ? 'brightness-0 invert'
+ : 'dark:brightness-0 dark:invert'),
)}
/>
</li>
diff --git a/web/app/routes/_index.tsx b/web/app/routes/_index.tsx
index f89807ca2..df647c4a7 100644
--- a/web/app/routes/_index.tsx
+++ b/web/app/routes/_index.tsx
@@ -1,6 +1,8 @@
import _map from 'lodash/map'
import {
CookieIcon,
+ HardDrivesIcon,
+ DatabaseIcon,
GaugeIcon,
GithubLogoIcon,
ArrowRightIcon,
@@ -38,6 +40,7 @@ import { FeaturesGrid } from '~/components/marketing/FeaturesGrid'
import { LogoCloud } from '~/components/marketing/LogoCloud'
import { WhySwitch } from '~/components/marketing/WhySwitch'
import { Text } from '~/ui/Text'
+import { getExperimentVariant } from '~/utils/analytics.server'
export const meta: MetaFunction = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
@@ -55,19 +58,43 @@ export const sitemap: SitemapFunction = () => ({
exclude: isSelfhosted || isDisableMarketingPages,
})
+const DEFAULT_LANDING_HERO_EXPERIMENT_ID = 'landing-page-hero-redesign'
+const OLD_LANDING_HERO_VARIANT = 'old'
+const NEW_LANDING_HERO_VARIANT = 'new'
+
+type LandingHeroVariant =
+ | typeof OLD_LANDING_HERO_VARIANT
+ | typeof NEW_LANDING_HERO_VARIANT
+
+const getLandingHeroVariant = (variant: string | null): LandingHeroVariant => {
+ return variant === NEW_LANDING_HERO_VARIANT
+ ? NEW_LANDING_HERO_VARIANT
+ : OLD_LANDING_HERO_VARIANT
+}
+
export async function loader({ request }: LoaderFunctionArgs) {
if (isSelfhosted || isDisableMarketingPages) {
return redirect('/login', 302)
}
- const [metainfoResult, stats] = await Promise.all([
- serverFetch<Metainfo>(request, 'user/metainfo', { skipAuth: true }),
- getGeneralStats(request),
- ])
+ const landingHeroExperimentId =
+ process.env.LANDING_HERO_EXPERIMENT_ID || DEFAULT_LANDING_HERO_EXPERIMENT_ID
+
+ const [metainfoResult, stats, landingHeroExperimentVariant] =
+ await Promise.all([
+ serverFetch<Metainfo>(request, 'user/metainfo', { skipAuth: true }),
+ getGeneralStats(request),
+ getExperimentVariant(
+ request,
+ landingHeroExperimentId,
+ OLD_LANDING_HERO_VARIANT,
+ ),
+ ])
return {
metainfo: metainfoResult.data ?? DEFAULT_METAINFO,
stats,
+ landingHeroVariant: getLandingHeroVariant(landingHeroExperimentVariant),
}
}
@@ -269,7 +296,84 @@ const Testimonials = ({
)
}
-const LiveDemoPreview = () => {
+const OldLiveDemoPreview = () => {
+ const { t } = useTranslation('common')
+ const { theme } = useTheme()
+ const {
+ i18n: { language },
+ } = useTranslation('common')
+
+ const isUpToLg = !useBreakpoint('lg')
+
+ if (isUpToLg) {
+ return (
+ <div className='relative z-20 mx-auto mt-10 overflow-hidden rounded-xl ring-2 ring-gray-900/10 dark:ring-white/10'>
+ <img
+ src={
+ theme === 'dark'
+ ? '/assets/screenshot_dark.png'
+ : '/assets/screenshot_light.png'
+ }
+ className='relative h-auto w-full'
+ width={2328}
+ height={1666}
+ alt='Swetrix Analytics dashboard'
+ />
+ <div className='absolute inset-0 flex items-center justify-center bg-slate-900/20 opacity-100 backdrop-blur-[1px] transition-opacity duration-200'>
+ <a
+ href={LIVE_DEMO_URL}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='pointer-events-auto inline-flex items-center rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-black/10 transition-all hover:bg-gray-50 dark:bg-slate-950 dark:text-white dark:ring-white/10 dark:hover:bg-slate-900'
+ aria-label={`${t('main.seeLiveDemo')} (opens in a new tab)`}
+ >
+ <ArrowRightIcon className='mr-2 h-4 w-4' />
+ {t('common.liveDemo')}
+ </a>
+ </div>
+ </div>
+ )
+ }
+
+ const localisedDemoPath = localisePath('/projects/STEzHcB1rALV', language)
+
+ return (
+ <div
+ className='group relative -mr-6 ml-auto w-[140%] overflow-hidden rounded-2xl bg-gray-50 shadow-lg ring-1 ring-black/5 transition-shadow ease-out sm:-mr-12 sm:w-[160%] lg:-mr-16 lg:w-[180%] xl:-mr-24 2xl:-mr-32 dark:bg-slate-950 dark:ring-white/10'
+ style={{
+ transform: 'translateZ(0)',
+ WebkitTransform: 'translateZ(0)',
+ willChange: 'transform',
+ contain: 'paint',
+ WebkitMaskImage: '-webkit-radial-gradient(white, black)',
+ }}
+ >
+ <div className='pointer-events-none relative h-[580px] overflow-hidden rounded-2xl lg:h-[640px] xl:h-[700px]'>
+ <iframe
+ src={`https://swetrix.com${localisedDemoPath}?tab=traffic&theme=${theme}&embedded=true`}
+ className='size-full rounded-2xl'
+ title='Swetrix Analytics Live Demo'
+ style={{ pointerEvents: 'none' }}
+ tabIndex={-1}
+ />
+ <div className='pointer-events-none absolute inset-0 flex items-center justify-center rounded-2xl bg-slate-900/40 opacity-0 backdrop-blur-[2px] transition-opacity duration-200 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100'>
+ <a
+ href={LIVE_DEMO_URL}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='pointer-events-auto inline-flex items-center rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-black/10 transition-all hover:bg-gray-50 dark:bg-slate-950 dark:text-white dark:ring-white/10 dark:hover:bg-slate-900'
+ aria-label={`${t('main.seeLiveDemo')} (opens in a new tab)`}
+ >
+ <ArrowRightIcon className='mr-2 h-4 w-4' />
+ {t('main.seeLiveDemo')}
+ </a>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+const NewLiveDemoPreview = () => {
const { theme } = useTheme()
const {
i18n: { language },
@@ -320,9 +424,87 @@ const LiveDemoPreview = () => {
)
}
-const Hero = () => {
+const OldHero = ({ stats }: { stats: Stats | null }) => {
+ const { t } = useTranslation('common')
+
+ return (
+ <div className='relative isolate bg-gray-100/80 pt-2 dark:bg-slate-900/50'>
+ <div className='relative mx-2 overflow-hidden rounded-4xl'>
+ <div aria-hidden className='pointer-events-none absolute inset-0 -z-10'>
+ <div className='absolute inset-0 rounded-4xl bg-linear-115 from-slate-100 from-28% via-purple-500 via-70% to-indigo-600 opacity-50 ring-1 ring-black/5 ring-inset sm:bg-linear-145 dark:from-slate-950 dark:opacity-45 dark:ring-white/10' />
+ </div>
+ <Header transparent />
+ <section className='mx-auto max-w-7xl px-4 pt-10 pb-5 sm:px-3 lg:grid lg:grid-cols-12 lg:gap-8 lg:px-6 lg:pt-20 xl:px-8'>
+ <div className='z-20 col-span-6 flex flex-col items-start'>
+ <Text
+ as='h1'
+ weight='semibold'
+ tracking='tight'
+ className='max-w-5xl text-left text-5xl text-pretty sm:leading-none lg:mt-6 lg:text-6xl xl:text-7xl'
+ >
+ {t('main.slogan')}
+ </Text>
+ <Text as='p' size='lg' className='mt-4 max-w-2xl text-left'>
+ {t('main.description')}
+ </Text>
+ <div className='mt-8 flex flex-col items-stretch sm:flex-row sm:items-center'>
+ <Link
+ to={routesPath.signup}
+ className='flex h-12 items-center justify-center rounded-md border-2 border-slate-900 bg-slate-900 px-4 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:text-gray-50'
+ aria-label={t('titles.signup')}
+ >
+ <span className='mr-1 text-center text-base font-semibold'>
+ {t('main.startAXDayFreeTrial', { amount: 14 })}
+ </span>
+ <ArrowRightIcon className='mt-[1px] h-4 w-5' />
+ </Link>
+ </div>
+ <div className='mt-8 grid w-full grid-cols-2 gap-3 text-slate-900 dark:text-gray-50'>
+ <div className='flex items-center gap-3 text-sm'>
+ <StarIcon className='size-5' />
+ <span>{t('main.heroBenefits.trial', { days: 14 })}</span>
+ </div>
+ <div className='flex items-center gap-3 text-sm'>
+ <GaugeIcon className='size-5' />
+ <span>{t('main.heroBenefits.quickSetup')}</span>
+ </div>
+ <div className='flex items-center gap-3 text-sm'>
+ <CookieIcon className='size-5' />
+ <span>{t('main.heroBenefits.cookieless')}</span>
+ </div>
+ <div className='flex items-center gap-3 text-sm'>
+ <GithubLogoIcon className='size-5' />
+ <span>{t('main.heroBenefits.openSource')}</span>
+ </div>
+ <div className='flex items-center gap-3 text-sm'>
+ <DatabaseIcon className='size-5' />
+ <span>{t('main.heroBenefits.dataOwnership')}</span>
+ </div>
+ <div className='flex items-center gap-3 text-sm'>
+ <HardDrivesIcon className='size-5' />
+ <span>{t('main.heroBenefits.selfHostable')}</span>
+ </div>
+ </div>
+ <Testimonials className='mt-8 hidden lg:block' stats={stats} />
+ </div>
+ <div className='col-span-6 mt-10 overflow-visible lg:mt-0 lg:mr-0 lg:ml-4'>
+ <ClientOnly
+ fallback={
+ <div className='h-[240px] w-full rounded-2xl bg-slate-800/10 ring-1 ring-black/5 sm:h-[320px] md:h-[580px] lg:h-[640px] xl:h-[700px] dark:bg-slate-800/20 dark:ring-white/10' />
+ }
+ >
+ {() => <OldLiveDemoPreview />}
+ </ClientOnly>
+ </div>
+ <Testimonials className='mt-8 lg:hidden' stats={stats} />
+ </section>
+ </div>
+ </div>
+ )
+}
+
+const NewHero = ({ stats }: { stats: Stats | null }) => {
const { t } = useTranslation('common')
- const { stats } = useLoaderData<typeof loader>()
return (
<div className='relative isolate overflow-hidden bg-gray-50 pt-2 dark:bg-slate-950'>
@@ -408,7 +590,7 @@ const Hero = () => {
<div className='mx-auto mt-12 h-[580px] w-full max-w-[1480px] rounded-2xl bg-white/10 ring-1 ring-white/20 backdrop-blur-xl lg:h-[640px] xl:h-[700px]' />
}
>
- {() => <LiveDemoPreview />}
+ {() => <NewLiveDemoPreview />}
</ClientOnly>
</div>
</section>
@@ -417,6 +599,16 @@ const Hero = () => {
)
}
+const Hero = ({ variant }: { variant: LandingHeroVariant }) => {
+ const { stats } = useLoaderData<typeof loader>()
+
+ if (variant === NEW_LANDING_HERO_VARIANT) {
+ return <NewHero stats={stats} />
+ }
+
+ return <OldHero stats={stats} />
+}
+
const SOFTWARE_APPLICATION_JSONLD = {
'@context': 'https://schema.org',
'@type': 'SoftwareApplication',
@@ -460,14 +652,14 @@ const SOFTWARE_APPLICATION_JSONLD = {
}
export default function Index() {
- const { metainfo } = useLoaderData<typeof loader>()
+ const { landingHeroVariant, metainfo } = useLoaderData<typeof loader>()
return (
<div className='overflow-hidden'>
<main className='bg-gray-50 dark:bg-slate-950'>
- <Hero />
+ <Hero variant={landingHeroVariant} />
- <LogoCloud />
+ <LogoCloud variant={landingHeroVariant} />
<FeaturesGrid />
diff --git a/web/knip.jsonc b/web/knip.jsonc
index 7dcfc7be4..50e55bf64 100644
--- a/web/knip.jsonc
+++ b/web/knip.jsonc
@@ -4,11 +4,11 @@
"@tailwindcss/forms",
"@tailwindcss/typography",
"tailwindcss",
- "@swetrix/node",
- ],
- "ignore": [
- "./app/utils/analytics.server.ts",
+ // "@swetrix/node",
],
+ // "ignore": [
+ // "./app/utils/analytics.server.ts",
+ // ],
"project": ["./app/**/*.{js,ts,tsx,jsx,cjs}"],
"paths": {
"~/*": ["./app/*"],