Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav experiment #1603

Merged
merged 45 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
656b08c
implement
thejessewinton Oct 18, 2024
b16105a
Merge branch 'main' into a-b-tests
thejessewinton Nov 18, 2024
a2b128f
Update +page.server.ts
thejessewinton Nov 18, 2024
8ab1e1d
Merge branch 'main' into a-b-tests
thejessewinton Nov 20, 2024
0216b81
Merge branch 'main' into a-b-tests
thejessewinton Dec 19, 2024
ba0f57e
rm test experiment
thejessewinton Dec 19, 2024
44019d2
add API to build steps
thejessewinton Dec 19, 2024
744f26e
Merge branch 'main' into a-b-tests
thejessewinton Dec 24, 2024
4f28283
Update posthog urls to EU, and set typing for api key
ernstmul Jan 3, 2025
66645b7
Merge branch 'main' into a-b-tests
ernstmul Jan 3, 2025
bfacddd
Merge branch 'main' into a-b-tests
thejessewinton Jan 3, 2025
c8f4508
trigger build
thejessewinton Jan 3, 2025
bbf48b3
working variants
thejessewinton Jan 3, 2025
bc8b81b
update track event to handle 2 platforms
thejessewinton Jan 3, 2025
714b7b7
Update +layout.server.ts
thejessewinton Jan 3, 2025
dee82fe
Merge branch 'main' into nav-experiment
thejessewinton Jan 6, 2025
fcb41d8
Merge branch 'main' into nav-experiment
thejessewinton Jan 6, 2025
acb717d
remove posthog from logged out button
thejessewinton Jan 6, 2025
268cd12
Update IsLoggedIn.svelte
thejessewinton Jan 6, 2025
6b47e68
improve type safety
thejessewinton Jan 6, 2025
7ae99b9
add posthog to docker build steps
thejessewinton Jan 6, 2025
7a9890a
Update system.ts
thejessewinton Jan 6, 2025
d8f98a9
add to docker compose
thejessewinton Jan 6, 2025
191d034
Update tests.yml
thejessewinton Jan 6, 2025
9d37d61
secrets?
thejessewinton Jan 6, 2025
379071d
update
thejessewinton Jan 6, 2025
5a66a06
updates
thejessewinton Jan 6, 2025
67ecee4
add debug
thejessewinton Jan 6, 2025
ec3313f
Merge branch 'main' into nav-experiment
thejessewinton Jan 6, 2025
21bfdf3
Update tests.yml
thejessewinton Jan 6, 2025
40e0add
Merge branch 'main' into nav-experiment
thejessewinton Jan 6, 2025
5814681
try rm prerender
thejessewinton Jan 6, 2025
f3e4221
Update +layout.server.ts
thejessewinton Jan 6, 2025
ae3bd20
tweaks
thejessewinton Jan 7, 2025
aea81cd
tweaks
thejessewinton Jan 7, 2025
95e5230
Merge branch 'main' into nav-experiment
thejessewinton Jan 10, 2025
c51266d
updates
thejessewinton Jan 10, 2025
62f41c4
Merge branch 'main' into nav-experiment
thejessewinton Jan 10, 2025
22411bd
updates
thejessewinton Jan 10, 2025
f3a1abe
clean up and implement SSR experiments
thejessewinton Jan 13, 2025
6318d8c
Merge branch 'main' into nav-experiment
thejessewinton Jan 13, 2025
de757e5
update
thejessewinton Jan 13, 2025
a361395
remove unneeded formatting
thejessewinton Jan 13, 2025
2779b4d
parity
thejessewinton Jan 13, 2025
2bfe0d7
Merge branch 'main' into nav-experiment
thejessewinton Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PUBLIC_APPWRITE_ENDPOINT=
PUBLIC_APPWRITE_PROJECT_ID=
PUBLIC_APPWRITE_PROJECT_INIT_ID=
PUBLIC_GROWTH_ENDPOINT=
PUBLIC_POSTHOG_API_KEY=
APPWRITE_DB_INIT_ID=
APPWRITE_COL_INIT_ID=
APPWRITE_API_KEY_INIT=
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ ENV GITHUB_TOKEN ${GITHUB_TOKEN}
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN ${SENTRY_AUTH_TOKEN}

ARG PUBLIC_POSTHOG_API_KEY
ENV PUBLIC_POSTHOG_API_KEY ${PUBLIC_POSTHOG_API_KEY}

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

Expand Down
1 change: 1 addition & 0 deletions docker/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ services:
- PUBLIC_APPWRITE_COL_THREADS_ID
- PUBLIC_APPWRITE_COL_MESSAGES_ID
- PUBLIC_APPWRITE_FN_TLDR_ID
- PUBLIC_POSTHOG_API_KEY
deploy:
<<: *x-update-config
mode: replicated
Expand Down
1 change: 1 addition & 0 deletions docker/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ services:
- PUBLIC_APPWRITE_COL_THREADS_ID
- PUBLIC_APPWRITE_COL_MESSAGES_ID
- PUBLIC_APPWRITE_FN_TLDR_ID
- PUBLIC_POSTHOG_API_KEY
deploy:
<<: *x-update-config
mode: replicated
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"oslllo-svg-fixer": "^3.0.0",
"plausible-tracker": "^0.3.9",
"postcss": "^8.4.49",
"posthog-js": "^1.204.0",
"posthog-node": "^4.2.1",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.8",
"prettier-plugin-tailwindcss": "^0.6.8",
Expand Down
73 changes: 73 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
--animate-text: fade 0.75s ease-in-out both, blur 0.75s ease-in-out both,
up 0.75s ease-in-out both;
--animate-scroll: scroll 60s linear infinite;
--animate-fade-in: fade 0.5s ease-in-out both;
--animate-fade-in: fade-in 0.5s ease-in-out both;
--animate-marquee: marquee var(--speed, 30s) linear infinite var(--direction, forwards);

/* Pink polyfills */
Expand Down
2 changes: 1 addition & 1 deletion src/lib/actions/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Analytics, type AnalyticsPlugin } from 'analytics';
import Plausible from 'plausible-tracker';
import posthogEvent from 'posthog-js';
import { get } from 'svelte/store';
import { page } from '$app/stores';
import posthogEvent from 'posthog-js';

import { ENV } from '$lib/system';
import { browser } from '$app/environment';
Expand Down
30 changes: 30 additions & 0 deletions src/lib/experiments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { PUBLIC_POSTHOG_API_KEY } from '$env/static/public';
import { PostHog } from 'posthog-node';

export const posthogServerClient = new PostHog(PUBLIC_POSTHOG_API_KEY, {
host: 'https://eu.i.posthog.com',
persistence: 'memory'
});

export const experiments = {
'sticky-navigation_ab-test': ['control', 'sticky-nav']
} as const;

type Key = keyof typeof experiments;

export const isFlagEqualTo = <K extends Key>(
variant: (typeof experiments)[K][number],
currentVariant?: string | boolean
) => {
return currentVariant === variant;
};

export const getFeatureFlag = async <K extends Key>(
key: Key,
variant: (typeof experiments)[K][number],
distinctId: string
) => {
const flagData = await posthogServerClient.getFeatureFlag(key, distinctId);

return isFlagEqualTo(variant, flagData);
};
Loading
Loading