iOS
Installation
Binary vs. Source Code
To install Pulse Insights in your application, follow these steps:
Add the following line in
Podfile
Execute the cmd
pod install
to download and set up the SDKFind the generated
.xcworkspace
and open it in Xcode
Upgrading
To upgrade the library, simply overwrite the .framework package with the newer version.
Usage
1. Initialization
First, configure the shared PulseInsights object inside AppDelegate. You’ll do the following:
Include the necessary headers.
Setup the PulseInsights object inside didFinishLaunchingWithOptions.
Replace YOUR_ACCOUNT_ID with your own PulseInsights ID, for example PI-12345678.
First add PulseInsights inside AppDelegate
:
Then, override the didFinishLaunchingWithOptions
method:
2. View tracking
Pulse Insights allows targeting surveys to a given screen name. In order for the SDK to know the current screen name, you can use the following method to notify it of the current screen name change:
For example, you can override the viewDidAppear function on the UIViewController subclass:
3. Survey polling
The Pulse Insights SDK will automatically regularly fetch surveys that would match various targeting conditions, based on a frequency that you can override as shown below:
If you want to manually fetch new surveys, you can also use this method:
4. Render a specific survey
It is also possible to manually trigger a survey by its id:
5. Inline surveys
Inline surveys are rendered within the content of the application, instead of overlaying the application content.
In order to integrate inline surveys, you can programmatically create the InlineSurveyView
object by assigning an identifier and inserting it into a view:
If you integrate InlineSurveyView
with the nib/xib, you can assign the tracking identifier by using the method setIdentifier
Here's another example of assigning the identifier for the inline view from xib
If you prefer, set up the identifier with the nib layout, as the following screenshot shows. You can find the Identifier
attribute from the Xcode interface
6. Survey rendering
You can pause and resume the survey rendering feature with the following method:
And check the current configuration with the following method:
true: survey rendering feature is enabled
false: survey rendering feature is paused
It is also possible to pause the survey rendering from the initialization of the Pulse Insights library as follows:
7. Client Key
Client key can be set using this method:
The configured client key can be fetched with this method:
8. Preview mode
Preview mode can be enabled/disabled by:
Preview mode can be programmatically enabled or disabled by this method:
It is also possible to set preview mode from the initialization of the Pulse Insights library:
In order to check the status of the preview mode, use this method:
9. Callbacks
If you want to know if a survey has been answered by the current device, this method can be used:
It is also possible to configure a callback to be executed when a survey has been answered:
10. Context data
You can save context data along with the survey results, or for a refined survey targeting, using the customData
config attribute. For example:
11. Device data
If you want to set device data, which will be saved along the survey results, the method setDeviceData
can be used as follows:
setDeviceData
can be called at any time. It will trigger a separate network request to save the data.
12. Advanced usage
The default host is "survey.pulseinsights.com". If you want to target the staging environment, or any other environment, it is possible to override the default host:
The debug mode can be turned on and off:
PulseInsights creates a unique UDID to track a given device. If you wish to reset this UDID, you can call the following method:
If you want manually config the view controller, you can call the following method:
And get the view controller object that has been configured.
Themes
You can configure approximately 50 properties - such as font color and size - using SDK Themes in the Console:
Styling is not driven by CSS but uses native components and formatting instead.
To create a mobile app-compatible theme in the Pulse Insights Console:
Click the Settings dropdown menu from the top navigation bar
Select "Themes"
Click the "New Theme" button
Give a name to your theme
In the "Type" dropdown menu, select "Native"
Input your Native JSON theme into the code box
"Update"
Uninstall
Remove the following statement from your
Podfile
Execute
pod install
, so the SDK will be removed
Last updated