App Feedback React Native API Reference
InitializationResult
This class is used to hold the results of the initialization methods.
Kind: global class
Properties
| Name | Type | Description |
|---|---|---|
| passed | boolean | whether or not initialization succeeded |
| surveyUrl | string | initialization message used to determine initialization status |
TargetingResult
This class is used to hold the results of the evaluation methods.
Kind: global class
Properties
| Name | Type | Description |
|---|---|---|
| passed | boolean | whether or not target evaluation succeeded |
| surveyUrl | string | link to the survey in Creative where logic evaluation passed. url used to display survey in display() |
Methods
recordClick() - void method()
Records a click to the server associated with the Intercept.
Kind: instance method
recordImpression() - void method()
Records an impression to the server associated with the Intercept.
Kind: instance method
initializeProject(brandid, projectid, [callback]) ⇒ initializationResults
Initializes the Qualtrics singleton with the specified params.
Kind: global function
Returns: initializationResults - to the callback
| Param | Type | Description |
|---|---|---|
| brandid | string | intercept brand id |
| projectid | string | intercept project id |
| [callback] | callback | optional method called, if defined, to handle initializationResults |
initializeProjectWithExtRefId(brandid, projectid, extrefid, [callback]) ⇒ initializationResults
Initializes the Qualtrics singleton that is primed for XM Directory with specified params.
Kind: global function
Returns: initializationResults - to the callback
| Param | Type | Description |
|---|---|---|
| brandid | string | intercept brand id |
| projectid | string | intercept project id |
| [extrefid] | string | optional external reference id, if defined, to integrate with XMD |
| [callback] | callback | optional method called, if defined, to handle initializationResults |
initialize(brandid, projectid, interceptid, [callback]) ⇒ InitializationResult
Initializes the Qualtrics singleton with the specified params.
Kind: global function
Returns: InitializationResult - in callback
Deprecate: marked for future deprecation with version 2.0.0
| Param | Type | Description |
|---|---|---|
| brandid | string | intercept brand id |
| projectid | string | intercept project id |
| interceptid | string | intercept id |
| [callback] | callback | optional method called, if defined, to handle the InitializationResult |
Example
import Qualtrics from 'react-native-qualtrics';
...
class App extends Component {
componentDidMount () {
Qualtrics.initialize('BRAND ID', 'PROJECT ID', 'INTERCEPT ID', (initializationResult) => {
if(initializationResult.passed) {
...
}
});
}
}
...
evaluateProject(callback) ⇒ TargetingResults
Evaluates all the initialized Intercepts and calls callback.
Kind: global function
Returns: TargetingResults - in callback
| Param | Type | Description |
|---|---|---|
| callback | callback | method called to handle TargetingResults, must be defined |
evaluateIntercept(interceptId) ⇒ TargetingResults
Evaluates the passed Intercept and calls callback.
Kind: global function
Returns: TargetingResults - in callback
| Param | Type | Description |
|---|---|---|
| interceptId | callback | method called to handle TargetingResult, must be defined |
evaluateTargetingLogic(callback) ⇒ TargetingResult
Evaluates current Intercept and calls callback.
Kind: global function
Returns: TargetingResult - in callback
Deprecate: marked for future deprecation with version 2.0.0
| Param | Type | Description |
|---|---|---|
| callback | callback | method called, to handle TargetingResult, must be defined |
Example
Qualtrics.evaluateTargetingLogic((targetingResult) => {
if (targetingResult.passed) {
...
}
});
display([autoCloseSurvey]) ⇒ Promise
Displays a creative in the view controller. If a specific Intercept is being evaluated using evaluateIntercept, then displayIntercept must be used rather than display
Kind: global function
Returns: Promise - Promise object representing a bool
| Param | Type | Description |
|---|---|---|
| [autoCloseSurvey] | boolean | optional flag for closing survey after finishing it |
Example without autoCloseSurvey
Qualtrics.evaluateTargetingLogic((targetingResult) => {
if (targetingResult.passed) {
var displayed = await Qualtrics.display()
}
});
Example with autoCloseSurvey
Qualtrics.evaluateTargetingLogic((targetingResult) => {
if (targetingResult.passed) {
var displayed = await Qualtrics.display(true)
}
});
displayIntercept([autoCloseSurvey]) ⇒ Promise
Displays a creative in the view controller.
Kind: global function
Returns: Promise - Promise object representing a bool
| Param | Type | Description |
|---|---|---|
| [autoCloseSurvey] | boolean | optional flag for closing survey after finishing it |
displayTarget([surveyUrl], [autoCloseSurvey])
Displays evaluated TargetingResult in webview, or a provided URL target
Kind: global function
| Param | Type | Description |
|---|---|---|
| [surveyUrl] | string | optional URL to display in Qualtrics webview |
| [autoCloseSurvey] | boolean | optional flag for closing survey after finishing it |
Example with surveyUrl
Qualtrics.evaluateTargetingLogic((targetingResult) => {
if (targetingResult.passed) {
Qualtrics.displayTarget(targetingResult.surveyUrl);
}
});
Example without surveyUrl
Qualtrics.evaluateTargetingLogic((targetingResult) => {
if (targetingResult.passed) {
Qualtrics.displayTarget();
}
});
registerViewVisit(viewName)
Records visits to a particular view.
Kind: global function
| Param | Type | Description |
|---|---|---|
| viewName | string | name of view to record |
Example
Qualtrics.registerViewVisit('VIEW NAME');
resetTimer()
Resets timer used for Time Spent In App.
Kind: global function
Example
Qualtrics.resetTimer();
resetViewCounter()
Resets view count used for View Count.
Kind: global function
Example
Qualtrics.resetViewCounter();
setString(propertyKey, propertyString)
Sets string value for the specified key in properties.
Kind: global function
| Param | Type | Description |
|---|---|---|
| propertyKey | string | Key for value |
| propertyString | string | String value to assign with key |
Example
Qualtrics.setString('firstName', 'John');
setNumber(propertyKey, propertyNumber)
Sets double value for specified key in properties.
Kind: global function
| Param | Type | Description |
|---|---|---|
| propertyKey | string | Key for value |
| propertyNumber | number | Numeric value to assign with key |
Example
Qualtrics.setNumber('age', 42);
setDateTime(propertyKey)
Sets current datetime value for specified key in properties.
Kind: global function
| Param | Type | Description |
|---|---|---|
| propertyKey | string | Key for value |
Example
Qualtrics.setDateTime('currentDate');
setNotificationIconAsset(propertyAsset)
Sets string file name for notificationIconAsset in properties.
Kind: global function
| Param | Type | Description |
|---|---|---|
| propertyAsset | string | File name of Image stored in Drawable folder of Android Project |
Example
Qualtrics.setNotificationIconAsset("my_notification_icon");
setLastDisplayTimeForIntercept(interceptid) - void method()
Sets the last displayed time of given intercept to the current time. Last display time is set automatically when display and displayIntercept functions are invoked but using other API (e.g. displayTarget) might require calling setLastDisplayedTime manually.
Kind: global function
| Param | Type | Description |
|---|---|---|
| interceptid | string | The ID of the intercept for which the last display time is being set |
Qualtrics.setLastDisplayTimeForIntercept("interceptID");