Once you have [installed](🔗), [initialized](🔗), and customized the Objective-C SDK for your implementation, you can run experiments and use our feature management and rollout functionality.
This topic is an addendum for specific 3.x topics in this guide by providing Objective-C SDK code samples and file links. Each section includes a link to the applicable 3.x topic for general information. **Make sure that you are using to use the correct 3.1.0-beta code examples and resources when developing your implementation.**
## Use feature flags
## Define feature variables
## Run A/B tests
## Assign variations with bucketing IDs
## Use forced bucketing
## Track events
## Include event tags
## Manage bot filtering
## Access test and variation identifiers
For Objective-C, keys and IDs can be accessed on `OPTLYExperiment
` objects using `experimentKey
` and `experimentId
` respectively. Likewise, keys and IDs can be accessed on `OPTLYVariation
` objects using `variationKey
` and `variationId
`.
For Swift, keys and IDs can be accessed on `OPTLYExperiment
` objects using `experimentKey
` and `experimentId
` respectively. Likewise, keys and IDs can be accessed on `OPTLYVariation
` objects using `variationKey
` and `variationId
`.
## Register notification listeners
## Set up Amplitude
## Set up Google Analytics
See general topic: [Set up Google Analytics](🔗).
If you're getting started, read the Google instructions for your platform:
[Google Analytics iOS Objective-C Setup instructions](🔗)
[Google Analytics iOS Swift Setup instructions](🔗)
Important
The [Google Analytics iOS SDK](🔗) does not support [non-interaction events](🔗) at this time. This may affect your bounce rate.
## Set up Localytics
See general topic: [Set up Localytics](🔗).
### Objective-C
The example code has two parts:
Add a track event listener to wrap `
[Localytics tagEvent]
`Add `
[optimizely track]
` to track conversions
Instead of calling `[Localytics tagEvent]
` directly, wrap the calls with `[optimizely track]
` to include bucketing information as event attributes.
The example code demonstrates how to add the track notification listener. Each `[optimizely track]
` event tracking adds a mapping of experiment key to variation key to the event attributes and passes the mapping to `[Localytics tagEvent]
`.
The last step is to add `[optimizely track]
` to track event conversions.
#### Consistent user identity
Maintaining a consistent user identity across multiple sessions and devices can help ensure proper reporting. Localytics provides some [guidelines](🔗) for their platform.
Optimizely recommends using the same user ID with these methods:
`
[optimizely activate]
``
[Localytics setCustomerId]
`
#### Alternative solution
Another solution is to set Localytics' [Custom Dimensions](🔗) using an activate notification listener. Custom dimensions can be used to segment users without needing to wrap `[Localytics tagEvent]
`, but they require configuration in the Localytics dashboard for each Optimizely test.
### Swift
The example code has two parts:
Add a track notification listener to wrap `
Localytics.tagEvent()
`Add `
optimizely.track()
` to track conversions
Instead of calling `Localytics.tagEvent()
` directly, wrap the calls with `optimizely.track()
` to include bucketing information as event attributes.
The example code demonstrates how to add a track notification listener. Each time `optimizely.track()
` event tracking adds a mapping of experiment key to variation key to the event attributes and pass the mapping to `Localytics.tagEvent()
`.
The last step is to add `optimizely.track()
` to track event conversions.
#### Consistent user identity
Maintaining a consistent user identity across multiple sessions and devices can help ensure proper reporting. Localytics provides some [guidelines](🔗) for their platform.
Optimizely recommends using the same user ID with these methods:
`
optimizely.activate()
``
Localytics.setCustomerId()
`
#### Alternative solution
Another solution is to set Localytics' [Custom Dimensions](🔗) using an activate notification listener. Custom dimensions can be used to segment users without needing to wrap `Localytics.tagEvent()
` but requires configuration in the Localytics dashboard for each Optimizely test.
## Set up Mixpanel
Code example for [Set up Mixpanel](🔗).
Next in the callback, we can optionally log an impression event that signifies that the Optimizely test was activated for the current user. You can use this event or another event you may already be tracking to calculate a conversion rate.
We recommend using the same user ID with the following methods:
Language | Activate Callback |
Objective-C | - `[optimizely activate] `
- `[mixpanel createAlias] `
- `[mixpanel identify] ` |
Swift | - `optimizely.activate() `
- `mixpanel.createAlias() `
- `mixpanel.identify() ` |
#### Compare results
When comparing Optimizely and Mixpanel results, remember to apply a date filter in Mixpanel to correspond with the dates your Optimizely test was running. People properties and super properties will remain set in Mixpanel even after your Optimizely test has stopped running.
#### Consistent user identity
Maintaining a consistent user identity across multiple sessions and devices can help ensure proper reporting. Mixpanel provides some [guidelines](🔗) for their platform.
## Set up mParticle
See the general topic: [Set up mParticle](🔗).
If you’re getting started, read the [mParticle Getting Started guide for the iOS SDK](🔗).
### Step 1: Prerequisites
Make sure that the required experiment is running correctly in Optimizely.
Install the mParticle SDK with the additional [Optimizely kit](🔗) on the iOS app.
### Step 2: Enable the integration
The example code below sends a DECISION notification listener that contains information about the user, experiment, and variation to mParticle in an event called `Experiment Viewed
`.
Note
You can customize the event name and also specify which event tags are included the event payload.
## Set up Segment
Segment has a semantic event that you can use to [track A/B test variations for users](🔗).
In the example code below, we add an activate listener block callback to send Segment's A/B event.
## API reference updates
This section provides updated Objective-C SDK code examples for all Optimizely methods.
Source files containing the implementations are at [Optimizely.h](🔗).
### Instantiate
#### Parameter names
#### Code example
### Activate
#### Parameter names
#### Returns
#### Code example
### Get Enabled Features
#### Parameter names
#### Returns
#### Code example
### Get Feature Variable
#### Boolean
Returns the value of the specified Boolean variable.
#### Double
Returns the value of the specified double variable.
#### Integer
Returns the value of the specified integer variable.
#### String
Returns the value of the specified string variable.
#### Parameter names
#### Returns
#### Code example
### Get Forced Variation
#### Parameter names
#### Returns
#### Code example
### Get Variation
#### Parameter names
#### Returns
#### Code example
### Is Feature Enabled
#### Parameter names
#### Returns
#### Code example
### Set Forced Variation
#### Parameter names
#### Returns
#### Code example
### Track
#### Parameter names
#### Returns
This method sends conversion data to Optimizely. It doesn't provide return values.
#### Code example