Amplitude's Guides and Surveys iOS SDK enables you to deploy Guides and Surveys in your iOS applications.
The Guides and Surveys iOS SDK requires:
Guides and Surveys supports different installation options to work best with your existing Amplitude implementation, if you have one.
First, install the Guides and Surveys iOS SDK with Swift Package Manager or CocoaPods.
https://github.com/amplitude/Amplitude-Engagement-SwiftAmplitude-Engagement-Swift package, version 1.6.0.pod install.
pod 'AmplitudeEngagementSwift', '~> 1.6.0'
Next, make sure to initialize the SDK.
import AmplitudeEngagementSwift
let amplitudeEngagement = AmplitudeEngagement("YOUR_API_KEY")
let configuration = Configuration(
apiKey: API_KEY
)
let amplitude = Amplitude(configuration: configuration)
amplitude.add(plugin: amplitudeEngagement.getPlugin())
| Parameter | Type | Description |
|---|---|---|
apiKey |
string |
Required. API key of the Amplitude project you want to use. |
initOptions.serverZone |
EU or US |
Optional. Sets the Amplitude server zone. Set this to EU for Amplitude projects created in EU data center. Default: US |
initOptions.logLevel |
LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug. |
Optional. Sets the log level. Default: LogLevel.Warn |
initOptions.locale |
string |
Optional. Sets the locale for localization. Default: undefined. Not setting a language means the default language is used. |
Make sure the API key you provide to Guides & Surveys matches the API key used to initialize your Amplitude Analytics SDK.
amplitude.add, you are technically done installing. While screen tracking and element targeting are optional, it's highly recommended to set up URL handling for preview mode.After installing the SDK, add your iOS application to your Amplitude project settings so it appears as a platform option when you create guides and surveys.
To add your application:
com.example.myapp)After you add your application, it appears as a platform option when you create or edit guides and surveys. This enables you to target your iOS users and preview guides directly in your app.
In this case, installation is very similar to above; however, you need to manually call .boot.
First, install the Guides and Surveys iOS SDK with Swift Package Manager or CocoaPods.
https://github.com/amplitude/Amplitude-Engagement-SwiftAmplitude-Engagement-Swift package, version 1.6.0.pod install.
pod 'AmplitudeEngagementSwift', '~> 1.6.0'
import AmplitudeEngagementSwift
let amplitudeEngagement = AmplitudeEngagement("YOUR_API_KEY")
let configuration = Configuration(
apiKey: API_KEY
)
let amplitude = Amplitude(configuration: configuration)
amplitude.add(plugin: amplitudeEngagement.getPlugin())
| Parameter | Type | Description |
|---|---|---|
apiKey |
string |
Required. API key of the Amplitude project you want to use. |
initOptions.serverZone |
EU or US |
Optional. Sets the Amplitude server zone. Set this to EU for Amplitude projects created in EU data center. Default: US |
initOptions.logLevel |
LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug. |
Optional. Sets the log level. Default: LogLevel.Warn |
initOptions.locale |
string |
Optional. Sets the locale for localization. Default: undefined. Not setting a language means the default language is used. |
// Basic boot with user ID
amplitudeEngagement.boot("USER_ID")
// Advanced boot with options
let bootOptions = AmplitudeBootOptions(
user_id: "USER_ID",
device_id: "DEVICE_ID",
user_properties: ["key": "value"]
integrations: [
{ event, eventProperties in
// Custom event handler
}
]
)
amplitudeEngagement.boot(options: bootOptions)
amplitudeEngagement.boot, you are technically done installing. While screen tracking and element targeting are optional, we highly recommend setting up URL handling for preview mode.Screen tracking and element targeting are technically optional, but can be very helpful for making your guides and surveys feel more targeted.
Required for screen-based targeting and the Time on Screen trigger. The screen string (eg "HomeScreen" in the example below) is compared with the string provided in the guide or survey page targeting section.
// Track screen views to trigger guides based on screens
amplitudeEngagement.screen("HomeScreen")
Screen Viewed events from the Amplitude iOS Swift SDK's Autocapture feature are auto-forwarded to the Engagement SDK.Pin and tooltip guides require the ability for the SDK to target specific elements on screen. To enable this in your app, give the element a unique identifier.
// Swift UI
MySwiftView {
// Content
}
.amplitudeView("MySwiftView", onTrigger: {
// Optional code to run with tap element action
}
// UIKit
let myView = MyUIKitView(...)
myView.accessibilityIdentifier = "MyView"
Configure the visual theme mode if your app supports light and dark modes.
// Set the theme mode
amplitudeEngagement.setThemeMode(ThemeMode.DARK) // Options: AUTO, LIGHT, DARK
Configure how Guides and Surveys handles screen navigation.
engagement.setRouter { identifier in
// Your screen handling and navigation
}
| Parameter | Type | Description |
|---|---|---|
identifier |
String |
Required. A screen identifier (or route) that tells your app where to navigate. |
router (closure) |
(String) -> Void |
Required. A function (closure) you implement to handle screen navigation when Guides or Surveys need to change screens. |
setRouter(), update the link behavior setting in the Guides and Surveys interface. For any link actions in your guides or surveys, change the behavior to Use router. This ensures that the guide or survey uses the custom router function instead of the default browser navigation.Reset a guide or survey to a specific step.
amplitudeEngagement.reset(key = "GUIDE_KEY", stepIndex = 0)
| Parameter | Type | Description |
|---|---|---|
key |
string |
Required. The guide or survey's key. |
stepIndex |
number |
Required. The zero-based index of the step to reset to. Defaults to the initial step. |
Retrieve a list of all live guides and surveys along with their status.
val guidesAndSurveys = amplitudeEngagement.list()
Display a specific guide or survey. Ignores any targeting rules and limits except for screen targeting.
amplitudeEngagement.show(key = "GUIDE_KEY")
| Parameter | Type | Description |
|---|---|---|
key |
string |
Required. The guide or survey's key. |
If you don't use the plugin, but want to trigger Guides using events.
amplitudeEngagement.forwardEvent([
"event_type": "my event type",
"event_properties": [String: String]()
])
Close all active guides and surveys.
amplitudeEngagement.closeAll()
To use preview mode to test a guide or survey in your app, configure a custom URL scheme.
Before you can use preview mode, add your iOS app to your project settings in Amplitude:
com.example.MyApp).After you add your app, Amplitude generates a unique URL scheme for mobile preview.
After adding your app to project settings, locate the URL scheme:
amp-abc123.AmplitudeURLScheme.amp-abc123.// In your AppDelegate or SceneDelegate
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if amplitudeEngagement.handleUrl(url) {
return true
}
// Handle other URL schemes
return false
}
You can access the changelog here.
June 23rd, 2025
Need help? Contact Support
Visit Amplitude.com
Have a look at the Amplitude Blog
Learn more at Amplitude Academy
© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.