Skip to content

Two SDKs, a few lines

Steps

  1. 1

    Add the SDK

    TypeScript: install @amzn/flagship-sdk and call createClient. Swift: import Flagship and call Flagship.configure.

  2. 2

    Paste your key

    Each channel of a project has its own key for each environment. Copy it from the SDK keys page.

  3. 3

    Read a value

    Call isEnabled for a gate, or get and param with a default for a config or parameter. The SDK never throws. If Flagship cannot be reached you get the last answer, then your default. Swift refreshes every 60 seconds and when the app becomes active.

  4. 4

    Track what happens

    Call identify with the person, then track events. Exposure to each variation is recorded, so experiment results line up with your goal event.

Samples

import { createClient } from '@amzn/flagship-sdk'

const flagship = createClient({ key: FLAGSHIP_CLIENT_KEY })
flagship.identify({ id: user.alias })
await flagship.ready()

if (await flagship.isEnabled('whats-new-preview')) {
  showWhatsNewPreview()
}

const color = flagship.get('checkout.buttonColor', 'blue')
const theme = flagship.peek('ui.theme', { color: 'black' })

flagship.track('whats-new-opened', { source: 'menu' })

Request access

Open a ticket and your workspace owner adds you.

Request access