Skip to content

Commit

Permalink
Merge pull request #1688 from appwrite/cta-experiment
Browse files Browse the repository at this point in the history
update cta experiment
  • Loading branch information
thejessewinton authored Jan 23, 2025
2 parents 1f28168 + eafbe17 commit cf02a92
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
7 changes: 5 additions & 2 deletions src/lib/components/IsLoggedIn.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import { classNames } from '$lib/utils/classnames';
import { trackEvent } from '$lib/actions/analytics';
import { browser } from '$app/environment';
import { page } from '$app/stores';
const ctaCopy = $page.data.ctaCopy;
export let classes = '';
const isLoggedIn = browser && 'loggedIn' in document.body.dataset;
function getTrackingEventName() {
return browser ? (isLoggedIn ? 'Go to console' : 'Get started') : 'Get started';
return browser ? (isLoggedIn ? 'Go to console' : ctaCopy) : ctaCopy;
}
</script>

Expand All @@ -23,5 +26,5 @@
})}
>
<span class="hidden group-[&[data-logged-in]]/body:block">Go to Console</span>
<span class="block group-[&[data-logged-in]]/body:hidden">Get started</span>
<span class="block group-[&[data-logged-in]]/body:hidden">{ctaCopy}</span>
</a>
5 changes: 4 additions & 1 deletion src/lib/layouts/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import { PUBLIC_APPWRITE_DASHBOARD } from '$env/static/public';
import { trackEvent } from '$lib/actions/analytics';
import MainNav from '$lib/components/MainNav.svelte';
import { page } from '$app/stores';
const ctaCopy = $page.data.ctaCopy;
export let omitMainId = false;
let theme: 'light' | 'dark' | null = 'dark';
Expand Down Expand Up @@ -164,7 +167,7 @@
<div class="web-mobile-header-end">
{#if !$isMobileNavOpen}
<a href={PUBLIC_APPWRITE_DASHBOARD} class="web-button">
<span class="text">Get started</span>
<span class="text">{ctaCopy}</span>
</a>
{/if}
<button
Expand Down
28 changes: 9 additions & 19 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import crypto from 'node:crypto';

import { getFeatureFlag } from '$lib/experiments';
import { posthogServerClient } from '$lib/experiments';
import { getAllChangelogEntries } from './changelog/utils';

export const trailingSlash = 'never';
Expand All @@ -22,24 +22,14 @@ export const load = async ({ request, getClientAddress }) => {
};

const distinctId = generateDistinctId(fingerprintData);

const isStartBuilding = await getFeatureFlag<'cta-copy_ab-test'>(
'sticky-navigation_ab-test',
'start-building_variant',
distinctId
);

const isStartForFree = await getFeatureFlag<'cta-copy_ab-test'>(
'sticky-navigation_ab-test',
'start-for-free_variant',
distinctId
);

const ctaCopy = isStartBuilding
? 'Start building'
: isStartForFree
? 'Start for free'
: 'Get started';
const ctaVariant = await posthogServerClient?.getFeatureFlag('cta-copy_ab-test', distinctId);

const ctaCopy =
ctaVariant === 'start-building_variant'
? 'Start building'
: ctaVariant === 'start-for-free_variant'
? 'Start for free'
: 'Get started';

return {
ctaCopy,
Expand Down
9 changes: 6 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
import Badge from '$lib/components/ui/Badge.svelte';
import { trackEvent } from '$lib/actions/analytics';
import AppwriteIn100Seconds from '$lib/components/AppwriteIn100Seconds.svelte';
import { page } from '$app/stores';
const title = 'Appwrite - Build like a team of hundreds';
const description = DEFAULT_DESCRIPTION;
const ogImage = `${DEFAULT_HOST}/images/open-graph/website.png`;
const ctaCopy = $page.data.ctaCopy;
const infoBoxes: Array<{ label: string; description: string; icon: string }> = [
{
label: 'Self-Hosted',
Expand Down Expand Up @@ -153,7 +156,7 @@
posthog: { name: 'get-started-btn_hero_click' }
})}
>
Get started
{ctaCopy}
</a>

<AppwriteIn100Seconds />
Expand Down Expand Up @@ -309,10 +312,10 @@
</section>
<div class="mt-20 overflow-hidden">
<ul
class="web-info-boxes text-sub-body divide-black/4 divide-x divide-y font-medium"
class="web-info-boxes text-sub-body divide-x divide-y divide-black/4 font-medium"
>
{#each infoBoxes as box}
<li class="border-black/4 relative p-8 last-of-type:border-r">
<li class="relative border-black/4 p-8 last-of-type:border-r">
<img src={box.icon} width="40" height="40" alt="" />
<h3
class="text-primary mt-4 flex flex-wrap items-baseline gap-3"
Expand Down

0 comments on commit cf02a92

Please sign in to comment.