This repository contains the landing page for the Pixel Reborn videogame. It is built with React, TypeScript, and Vite, and showcases A/B testing and feature flags with GrowthBook, along with event and pageview tracking using Umami.
- Node.js (>= 18 recommended) and npm
- Docker and Docker Compose (optional, to self-host Umami and GrowthBook)
git clone https://github.com/aghersidev/abtesting-landing-page.git
cd abtesting-landing-pagenpm ciCreate or update a .env file in the project root with the following values:
# ========= GrowthBook =========
VITE_GROWTHBOOK_API_HOST=https://cdn.growthbook.io
VITE_GROWTHBOOK_CLIENT_KEY=sdk-abc123
VITE_GROWTHBOOK_DEV_MODE=true
# ========= Umami =========
VITE_UMAMI_SCRIPT_URL=https://analytics.tudominio.com/script.js
VITE_UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
VITE_ENABLE_ANALYTICS=true
# ========= App =========
VITE_SITE_ID=pixelrebornNote These are public client-side keys used by the application to communicate with GrowthBook and Umami. Do not store private or admin credentials in this file.
npm run devThe app will be available at:
http://localhost:5173
You can run Umami locally using Docker:
docker run -d \
-e DATABASE_URL=postgres://umami:umami@localhost:5432/umami \
-e UMAMI_ALLOWED_ORIGINS=http://localhost:5173 \
-p 3000:3000 \
--name umami umami/umamiAccess:
http://localhost:3000
From the Umami dashboard:
- Create a website
- Copy the Website ID
- Set it as
VITE_UMAMI_WEBSITE_IDin your.env
Example docker-compose.yml for GrowthBook:
version: "3.8"
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: gbuser
POSTGRES_PASSWORD: gbpass
POSTGRES_DB: growthbook
ports:
- "5432:5432"
growthbook-api:
image: growthbook/growthbook-api:latest
depends_on:
- postgres
environment:
DATABASE_URL: postgres://gbuser:gbpass@postgres:5432/growthbook
PORT: 3100
ports:
- "3100:3100"
growthbook-ui:
image: growthbook/growthbook-ui:latest
depends_on:
- growthbook-api
environment:
REACT_APP_GB_API_HOST: http://localhost:3100
ports:
- "3000:3000"Access the GrowthBook UI at:
http://localhost:3000
From there:
- Create a project
- Generate a Client Key
- Set it as
VITE_GROWTHBOOK_CLIENT_KEYin your.env
- Log in to the GrowthBook UI
- Create a Feature Flag named:
mediaType
- Add the following variations:
"trailer""images"
This flag is used by the landing page to switch media content for A/B testing.
-
The app uses GrowthBook for feature flags and A/B testing.
-
Umami tracks:
- Page views
- Custom events
-
Analytics can be toggled using:
VITE_ENABLE_ANALYTICS=trueThis project is licensed under the MIT License.
See the LICENSE file for more details.