Two SDKs, a few lines
Steps
- 1
Add the SDK
TypeScript: install @amzn/flagship-sdk and call createClient. Swift: import Flagship and call Flagship.configure.
- 2
Paste your key
Each channel of a project has its own key for each environment. Copy it from the SDK keys page.
- 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
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' })import Flagship
Flagship.configure(key: flagshipKey)
await Flagship.shared.identify(id: alias)
if Flagship.shared.isEnabled("whats-new-preview") {
showWhatsNewPreview()
}
let color = Flagship.shared.param("checkout.buttonColor", default: "blue")
let limit = Flagship.shared.param("limits.maxItems", default: 5)
Flagship.shared.track("whats-new-opened", ["source": "menu"])Request access
Open a ticket and your workspace owner adds you.