API Reference
This section provides a complete reference for all publicly available methods within the Experience SDK.
- iOS
- Android
- React Native
Qualtrics
The Qualtrics enum serves as the entry point for the SDK. All methods are static and can be invoked directly on the enum.
Swift: Add
import QualtricsExperienceat the top of any.swiftfile where you call the SDK.
Methods
initialize(sdkKey:configuration:)
Manually initializes the SDK.
Use this method only if you disabled automatic initialization. If
SdkKeyis present in theQualtricsdictionary inInfo.plist, automatic initialization takes precedence and all manual initialization calls are ignored.
You must call the
initializemethod before any other SDK method. Calling any other method first will cause errors and undefined behavior.
This method attempts to retrieve the current
UIWindowautomatically. If it cannot be retrieved, you must provide it explicitly usinginitialize(sdkKey:window:configuration:).
Parameters
| Parameter | Type | Description |
|---|---|---|
| sdkKey | String | The key used to initialize the SDK. Can be obtained from the App Insights project settings. |
| configuration (optional) | QualtricsConfiguration? | Optional configuration object for the SDK. If not provided, uses default settings. |
initialize(sdkKey:window:configuration:)
Manually initializes the SDK.
Use this method only if you disabled automatic initialization. If
SdkKeyis present in theQualtricsdictionary inInfo.plist, automatic initialization takes precedence and all manual initialization calls are ignored.
You must call the
initializemethod before any other SDK method. Calling any other method first will cause errors and undefined behavior.
Parameters
| Parameter | Type | Description |
|---|---|---|
| sdkKey | String | The key used to initialize the SDK. Can be obtained from the App Insights project settings. |
| window | UIWindow | The UIWindow instance. |
| configuration (optional) | QualtricsConfiguration? | Optional configuration object for the SDK. If not provided, uses default settings. |
setStringProperty(key:value:)
Sets a custom string property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | String | The string value to set. |
setBoolProperty(key:value:)
Sets a custom bool property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | Bool | The bool value to set. |
setNumberProperty(key:value:)
Sets a custom number property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | Double | The number value to set. |
setDateProperty(key:value:)
Sets a custom date property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | Date | The date value to set. |
setLanguage(languageCode:)
Sets a language for incoming intercepts. If language code is applied via this function, autodetected language will be overwritten.
Parameters
| Parameter | Type | Description |
|---|---|---|
| languageCode | String | The language code. |
getStringProperty(key:)
Retrieves a custom string property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The String value if found, otherwise nil.
getBoolProperty(key:)
Retrieves a custom bool property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The Bool value if found, otherwise nil.
getNumberProperty(key:)
Retrieves a custom number property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The Double value if found, otherwise nil.
getDateProperty(key:)
Retrieves a custom date property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The Date value if found, otherwise nil.
removeProperty(key:)
Removes a custom property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
reportEvent(_ name: String)
Reports a custom event by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the event to report. |
reportScreenAppearance(_ screenName:)
Reports that a screen has appeared.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | String | The name of the screen that appeared. |
reportScreenDisappearance(_ screenName:)
Reports that a screen has disappeared.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | String | The name of the screen that disappeared. |
reportScreenAppearance(_ screens:)
Reports a screen appearance event with detailed screen information. Use this overload when you need to track nested screen hierarchies or specify screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screens | [QualtricsScreen] | The screens that appeared, in hierarchy order (outermost to innermost). |
reportScreenDisappearance(_ screens:)
Reports a screen disappearance event with detailed screen information. Use this overload when you need to track nested screen hierarchies or specify screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screens | [QualtricsScreen] | The screens that disappeared, in hierarchy order (outermost to innermost). |
Properties
logLevel
Controls the verbosity of logs emitted by the SDK.
| Value | Description |
|---|---|
.debug | Logs detailed troubleshooting (all internal SDK logs). |
.info (default) | Logs SDK operations and lifecycle events. |
.error | Logs errors only. |
.none | Silences all logging. |
Types
QualtricsScreen
Represents a screen that can be reported to the SDK. Used with reportScreenAppearance(_ screens:) and reportScreenDisappearance(_ screens:) when tracking nested screen hierarchies or specifying screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | String | The name of the screen. |
| screenType | String | The type of the screen. Defaults to "Screen". |
Example
import QualtricsExperience
QualtricsScreen(screenName: "Home") // uses default type "Screen"
QualtricsScreen(screenName: "ProductDetails", screenType: "UIViewController") // custom type
Qualtrics
The Qualtrics object serves as the entry point for the SDK. All methods are static and can be invoked directly on the object.
Methods
initialize(sdkKey, activity, configuration)
Manually initializes the SDK.
Use this method only if you disabled automatic initialization. If
qualtrics_sdk_keyis present inres/values, automatic initialization takes precedence and all manual initialization calls are ignored.
You must call the
initializemethod before any other SDK method. Calling any other method first will cause errors and undefined behavior.
Parameters
| Parameter | Type | Description |
|---|---|---|
| sdkKey | String | The key used to initialize the SDK. Can be obtained from the App Insights project settings. |
| activity | Activity | The Android activity instance. |
| configuration (optional) | QualtricsConfiguration? | Optional configuration object for the SDK. If not provided, uses default settings. |
captureComposeNavigation(navController)
@Composable method on Qualtrics that attaches Screen Name Auto Capture to a Navigation Compose NavController. Call it in the same @Composable where you create the controller with rememberNavController().
Requires Jetpack Compose auto capture to be enabled in the QualtricsConfiguration.
Parameters
| Parameter | Type | Description |
|---|---|---|
| navController | NavController | The controller passed to NavHost; the SDK listens for destination changes on this instance. |
Example
import androidx.navigation.compose.rememberNavController
import com.qualtrics.expsdk.core.Qualtrics
@Composable
fun MainNav() {
val navController = rememberNavController()
Qualtrics.captureComposeNavigation(navController)
NavHost(navController = navController, startDestination = "home") {
// { ... }
}
}
setStringProperty(key, value)
Sets a custom string property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | String | The string value to set. |
setBoolProperty(key, value)
Sets a custom bool property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | Boolean | The boolean value to set. |
setNumberProperty(key, value)
Sets a custom number property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | Double | The number value to set. |
setDateProperty(key, value)
Sets a custom date property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
| value | Instant | The instant value to set. |
setLanguage(languageCode)
Sets a language code for incoming intercepts. If language code is applied via this function, autodetected language will be overwritten.
Parameters
| Parameter | Type | Description |
|---|---|---|
| languageCode | String | The language code. |
getStringProperty(key)
Retrieves a custom string property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The String value if found, otherwise null.
getBoolProperty(key)
Retrieves a custom bool property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The Boolean value if found, otherwise null.
getNumberProperty(key)
Retrieves a custom number property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The Double value if found, otherwise null.
getDateProperty(key)
Retrieves a custom date property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
Returns
The Instant value if found, otherwise null.
removeProperty(key)
Removes a custom property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | String | The property key. |
reportEvent(name)
Reports a custom event by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the event to report. |
reportScreenAppearance(screenName)
Reports that a screen has appeared.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | String | The name of the screen that appeared. |
reportScreenDisappearance(screenName)
Reports that a screen has disappeared.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | String | The name of the screen that disappeared. |
reportScreenAppearance(screens)
Reports a screen appearance event with detailed screen information. Use this overload when you need to track nested screen hierarchies or specify screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screens | List<QualtricsScreen> | The screens that appeared, in hierarchy order (outermost to innermost). |
reportScreenDisappearance(screens)
Reports a screen disappearance event with detailed screen information. Use this overload when you need to track nested screen hierarchies or specify screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screens | List<QualtricsScreen> | The screens that disappeared, in hierarchy order (outermost to innermost). |
Properties
logLevel
Controls the verbosity of logs emitted by the SDK.
| Value | Description |
|---|---|
LogLevel.DEBUG | Logs detailed troubleshooting (all internal SDK logs). |
LogLevel.INFO (default) | Logs SDK operations and lifecycle events. |
LogLevel.ERROR | Logs errors only. |
LogLevel.NONE | Silences all logging. |
Types
QualtricsScreen
Represents a screen that can be reported to the SDK. Used with reportScreenAppearance(screens) and reportScreenDisappearance(screens) when tracking nested screen hierarchies or specifying screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | String | The name of the screen. |
| screenType | String | The type of the screen. Defaults to "Screen". |
Example
QualtricsScreen("Home") // uses default type "Screen"
QualtricsScreen("Settings", "Fragment") // custom type
Methods
initialize(sdkKey)
Manually initializes the SDK.
Use this method only if you disabled automatic initialization. If
SDK_KEYis present in.qualtricsconfig, automatic initialization takes precedence and all manual initialization calls are ignored.
You must call the
initializemethod before any other SDK method. Calling any other method first will cause errors and undefined behavior.
Parameters
| Parameter | Type | Description |
|---|---|---|
| sdkKey | string | The key used to initialize the SDK. Can be obtained from the App Insights project settings. |
setStringProperty(key, value)
Sets a custom string property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
| value | string | The string value to set. |
setBoolProperty(key, value)
Sets a custom bool property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
| value | boolean | The boolean value to set. |
setNumberProperty(key, value)
Sets a custom number property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
| value | number | The number value to set. |
setDateProperty(key, value)
Sets a custom date property. If a property with the same key already exists, it will be overwritten.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
| value | Date | The date value to set. |
setLanguage(languageCode)
Sets a language for incoming intercepts. If language code is applied via this function, autodetected language will be overwritten.
Parameters
| Parameter | Type | Description |
|---|---|---|
| languageCode | string | The language code. |
getStringProperty(key)
Retrieves a custom string property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
Returns
The string value if found, otherwise null.
getBoolProperty(key)
Retrieves a custom bool property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
Returns
The boolean value if found, otherwise null.
getNumberProperty(key)
Retrieves a custom number property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
Returns
The number value if found, otherwise null.
getDateProperty(key)
Retrieves a custom date property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
Returns
The Date value if found, otherwise null.
removeProperty(key)
Removes a custom property.
Each custom property must be configured in the App Insights project before it can be used.
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | string | The property key. |
reportEvent(name)
Reports a custom event by name.
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the event to report. |
reportScreenAppearance(screenName)
Reports that a screen has appeared.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | string | The name of the screen that appeared. |
reportScreenDisappearance(screenName)
Reports that a screen has disappeared.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | string | The name of the screen that disappeared. |
reportScreenAppearance(screens)
Reports a screen appearance event with detailed screen information. Use this overload when you need to track nested screen hierarchies or specify screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screens | QualtricsScreen[] | The screens that appeared, in hierarchy order (outermost to innermost). |
reportScreenDisappearance(screens)
Reports a screen disappearance event with detailed screen information. Use this overload when you need to track nested screen hierarchies or specify screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screens | QualtricsScreen[] | The screens that disappeared, in hierarchy order (outermost to innermost). |
setLogLevel(level)
Sets the SDK log level to control the verbosity of logs emitted by the SDK.
Parameters
| Parameter | Type | Description |
|---|---|---|
| level | LogLevel | The desired log level. |
LogLevel values
| Value | Description |
|---|---|
LogLevel.DEBUG | Logs detailed troubleshooting (all internal SDK logs). |
LogLevel.INFO (default) | Logs SDK operations and lifecycle events. |
LogLevel.ERROR | Logs errors only. |
LogLevel.NONE | Silences all logging. |
Types
QualtricsScreen
Represents a screen element in the hierarchy. Used with reportScreenAppearance(screens) and reportScreenDisappearance(screens) when tracking nested screen hierarchies or specifying screen types.
Parameters
| Parameter | Type | Description |
|---|---|---|
| screenName | string | The name of the screen. |
| screenType | string | The type of the screen. Defaults to 'Screen'. |
Example
new QualtricsScreen("Home") // uses default type "Screen"
new QualtricsScreen("Settings", "Fragment") // custom type