abtesting-mobile
Mobile A/B: Firebase Remote Config, Optimizely, Statsig, app store experiments, staged rollout
What this skill does
# abtesting-mobile
## Purpose
This skill handles A/B testing for mobile applications using tools like Firebase Remote Config, Optimizely, Statsig, and app store experiments. It focuses on feature flagging, staged rollouts, and canary releases to optimize user experiences.
## When to Use
Use this skill when you need to run experiments on mobile apps, such as testing UI changes, feature toggles, or gradual rollouts. Apply it for apps on iOS/Android to minimize risks, gather data-driven insights, or comply with app store guidelines for experiments.
## Key Capabilities
- Configure Firebase Remote Config for dynamic parameter updates without app redeployment.
- Integrate Optimizely SDK for full A/B testing cycles, including event tracking and audience segmentation.
- Use Statsig for quick feature flags and experiments with minimal setup.
- Manage staged rollouts via Firebase or app store APIs to control user exposure.
- Support canary releases by defining percentages for new features.
## Usage Patterns
To set up an A/B test, first authenticate with the service, then define parameters in a config file, fetch values in your app code, and monitor results. For Firebase, use the CLI to update configs; for Optimizely, initialize the SDK early in your app lifecycle. Always wrap experiments in try-catch blocks for error resilience. Pattern: Load config → Assign variants → Track events → Analyze data.
## Common Commands/API
For Firebase Remote Config:
- CLI: `firebase rc:fetch --token $FIREBASE_API_KEY` to fetch parameters.
- API Endpoint: POST to `https://firebaseremoteconfig.googleapis.com/v1/projects/{projectId}/remoteConfig` with JSON body like `{"parameters": {"feature_flag": {"defaultValue": {"value": "true"}}}}`.
- Code Snippet (Swift for iOS):
```
let remoteConfig = RemoteConfig.remoteConfig()
remoteConfig.fetch { status, error in
if status == .success { remoteConfig.activate() }
}
```
For Optimizely:
- CLI: `optimizely project create --apiKey $OPTIMIZELY_API_KEY --name "MobileExperiment"`.
- API Endpoint: GET `https://api.optimizely.com/v2/experiments` to list experiments.
- Code Snippet (Android Kotlin):
```
OptimizelyManager.getInstance().optimizely.start { userId, attributes ->
val variation = optimizely.decide(userId, "experimentKey")
// Apply variation
}
```
For Statsig:
- CLI: `statsig config set --key $STATSIG_API_KEY --feature "newFeature" --value true`.
- API Endpoint: POST to `https://api.statsig.com/v1/evaluate` with body `{"userID": "123", "featureKey": "feature"}`.
- Code Snippet (General JS for React Native):
```
import Statsig from 'statsig-react-native';
Statsig.initialize('your-sdk-key').then(() => {
const value = Statsig.checkGate('feature_gate');
});
```
## Integration Notes
Integrate by adding SDKs via package managers (e.g., `pod 'Firebase/RemoteConfig'` for iOS or `implementation 'com.optimizely.ab:android-sdk:4.0.0'` for Android). Use environment variables for auth: set `$FIREBASE_API_KEY` in your CI/CD pipeline. For config formats, use JSON files like:
```
{
"parameters": {
"color_scheme": {
"defaultValue": { "value": "blue" },
"description": "A/B test for app theme"
}
}
}
```
Ensure apps handle offline scenarios by caching configs. For multi-tool setups, prioritize Firebase for simple flags and Optimizely for complex experiments.
## Error Handling
Handle authentication errors by checking for 401 responses and retrying with refreshed tokens. For Firebase, catch `NSError` with code 3 (network error) and fallback to default values. In code:
```
try {
remoteConfig.fetchAndActivate { status, error in
if let error = error { print("Error: \(error.localizedDescription)") }
}
} catch { print("Fetch failed: \(error)") }
```
For Optimizely, log decision errors and use a default variation. Common issues: Invalid API keys—verify with `echo $OPTIMIZELY_API_KEY`; Network failures—implement exponential backoff.
## Concrete Usage Examples
Example 1: Set up a staged rollout for a new feature using Firebase.
- Steps: Export `$FIREBASE_API_KEY`, run `firebase rc:set --project myapp --params '{"rollout_percent": 50}'`, then in app code, fetch and check the value to enable the feature for 50% of users.
Example 2: Run an A/B test with Optimizely for button color.
- Steps: Create an experiment via `optimizely experiment create --apiKey $OPTIMIZELY_API_KEY --key "buttonColorTest" --variations '["red", "blue"]'`, integrate SDK, and in code, use the decided variation to set the button color and track clicks.
## Graph Relationships
- Related to: abtesting cluster (e.g., abtesting-web for web variants)
- Connected via: mobile tag (links to skills like mobile-analytics)
- Dependencies: Requires firebase and optimizely clusters for full functionality
- Overlaps: With rollout tag, shares edges to deployment skills
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.