Skip to content

GrowthBook Setup Guide

GrowthBook is a free open-source split system. This guide covers self-hosted installation via Docker and setting up your first experiment — after that, your assignments are ready to feed into AB-Labz.

Prerequisites

  • Docker and Docker Compose installed
  • A server or local machine with ports 3000 and 3100 available
  • iOS or Android app with a stable user identifier (e.g. device_id, user_id)

1. Install GrowthBook

Clone the official repository and start the containers:

bash
git clone https://github.com/growthbook/growthbook.git
cd growthbook
docker-compose up -d

GrowthBook will start two services:

  • App (UI + API) on http://localhost:3000
  • MongoDB for storage

Open http://localhost:3000 in your browser. On first launch you'll be prompted to create an admin account.

2. Initial Setup

After logging in:

  1. Create an Organization — enter your company name
  2. Set your timezone — important for correct experiment date boundaries
  3. Go to Features → SDKs and click Add SDK Connection
  4. Select your platform (iOS or Android), give it a name, and save
  5. Copy the Client Key — you'll need it in the next step

3. Add SDK to Your App

iOS — Swift Package Manager:

In Xcode: File → Add Packages → https://github.com/growthbook/growthbook-swift

Or via Package.swift:

swift
dependencies: [
    .package(url: "https://github.com/growthbook/growthbook-swift.git")
]

Initialize at app startup:

swift
import GrowthBook

var sdkInstance: GrowthBookSDK = GrowthBookBuilder(
    apiHost: "http://YOUR_SERVER:3100",
    clientKey: "sdk-YOUR_CLIENT_KEY",
    attributes: ["id": YMMYandexMetrica.deviceID() ?? UIDevice.current.identifierForVendor?.uuidString ?? ""],
    trackingCallback: { experiment, result in
        // write assignment to your data warehouse here
        print("Experiment: \(experiment.key), Variant: \(result.key)")
    }
).initialize()

Android — Gradle:

kotlin
// build.gradle (app)
repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.growthbook.sdk:GrowthBook:7.1.0'
    // choose one network dispatcher:
    implementation 'io.growthbook.sdk:NetworkDispatcherKtor:1.0.12'   // Android + iOS + JVM
    // implementation 'io.growthbook.sdk:NetworkDispatcherOkHttp:1.0.7' // Android + JVM only
}

Initialize (after obtaining device ID — it's async in Yandex Metrica):

kotlin
import com.sdk.growthbook.GBSDKBuilder

val gb = GBSDKBuilder(
    apiKey = "sdk-YOUR_CLIENT_KEY",
    hostURL = "http://YOUR_SERVER:3100/",
    attributes = hashMapOf("id" to deviceId),
    trackingCallback = { experiment, result ->
        // write assignment to your data warehouse here
        Log.d("GrowthBook", "Experiment: ${experiment.key}, Variant: ${result.variationId}")
    }
).initialize()

Note: on Android, Yandex Metrica's getDeviceID is async — initialize GrowthBook only after you have the device ID.

4. Create Your First Experiment

  1. Go to FeaturesAdd Feature
  2. Set a Feature Key (e.g. new_onboarding_flow) and type Boolean
  3. In the feature rules, click Add Rule → select Experiment
  4. Configure:
    • Tracking Key — experiment identifier, will appear in your assignments data
    • Split — e.g. 50% / 50%
    • Variationsfalse for control, true for treatment
  5. Set the environment to Production and save

5. Use the Experiment in Your App

iOS:

swift
let isNewOnboarding = sdkInstance.isOn("new_onboarding_flow")

if isNewOnboarding {
    // show treatment
} else {
    // show control
}

Android:

kotlin
val isNewOnboarding = gb.isOn("new_onboarding_flow")

if (isNewOnboarding) {
    // show treatment
} else {
    // show control
}

The SDK assigns the user deterministically based on their id attribute — the same user always gets the same variant.

6. Verify Assignments Are Working

The trackingCallback you set during initialization fires every time a user is assigned to an experiment. Use it to write to your data warehouse:

user_id | experiment_id        | variant   | timestamp
--------|----------------------|-----------|----------
u_123   | new_onboarding_flow  | control   | 2026-05-25 10:34:12
u_456   | new_onboarding_flow  | treatment | 2026-05-25 10:35:01

This becomes the assignments table — the source for your AB-Labz datamart.

What's Next

Your GrowthBook is running and assigning users to experiment groups. The next step is building a datamart that joins assignments with your event data — then connecting it to AB-Labz for analysis.

Preparing your experiment datamart

AB-Labz - Product Experiments Laboratory