ForeSeeCxMeasure Class Reference
Inherits from | NSObject |
---|---|
Declared in | ForeSeeCxMeasure.h |
Overview
The ForeSeeCxMeasure class provides the main interface to the ForeSee CxMeasure module. You must add a
foresee_configuration.json
file to your project that defines the behavior of the Trigger module (e.g. defines the
triggering criteria for inviting a user to participate in a survey).
Configuration
Most configuration is done through the foresee_configuration.json
file. Behavior such as trigger criteria,
invitation modes, repeat days, are done through the configuration file. If you want to customize runtime behavior
e.g. displaying custom invitations, you can provide a delegate with the setInviteDelegate: method.
Debugging
When testing your configuration, it is recommended you enable debug log mode. Useful information regarding internal state will be posted to the console for inspection.
Notifications
The CxMeasure module will post a number of notifications to the default NSNotificationCenter
:
FSInviteDidShowNotification
( Posted when the default invitation was displayed. )FSInviteWasDeclinedNotification
( Posted when the default invitation was declined. )FSInviteWasAcceptedNotification
( Posted when the default invitation was accepted. )FSSurveyWasCompletedNotification
( Posted when the survey was completed. )FSSurveyWasAbandonedNotification
( Posted when the survey was abandoned. )FSSurveyDidShowNotification
( Posted when the survey was presented. )
+ setInviteDelegate:
Sets an invite lifecycle delegate
+ (void)setInviteDelegate:(id<FSInviteDelegate>)delegate
Parameters
delegate |
An object conforming to the FSInviteDelegate protocol |
---|
Discussion
Objects conforming to the FSInviteDelegate protocol and registered with the SDK using this method will be notified of events in the SDK’s lifecycle
Declared In
ForeSeeCxMeasure.h
+ setInviteHandler:
Sets a custom invite handler
+ (void)setInviteHandler:(id<FSInviteHandler>)inviteHandler
Parameters
inviteHandler |
An object conforming to the FSInviteHandler protocol |
---|
Discussion
Use an object conforming to the FSInviteHandler protocol to display a custom invite. Objects will be told when to show and hide custom views, based on the user’s state.
Declared In
ForeSeeCxMeasure.h
+ incrementSignificantEventCountWithKey:
Increments the event count for a given key
+ (void)incrementSignificantEventCountWithKey:(NSString *)key
Parameters
key |
The key of the event |
---|
Discussion
Significant events are defined in the foresee_configuration.json file.
Declared In
ForeSeeCxMeasure.h
+ incrementSignificantEventCountAndCheckEligibilityWithKey:
Increments the event count for a given key and checks eligibity after
+ (void)incrementSignificantEventCountAndCheckEligibilityWithKey:(NSString *)key
Parameters
key |
The key of the event |
---|
Declared In
ForeSeeCxMeasure.h
+ incrementPageViews
Increments the view controller load count (“page views”). This is done automatically for most view controllers.
+ (void)incrementPageViews
Declared In
ForeSeeCxMeasure.h
+ showSurveyForSurveyID:
Force a survey to display for a given surveyID
+ (void)showSurveyForSurveyID:(NSString *)surveyID
Parameters
surveyID |
The ID of the survey you wish to display. |
---|
Discussion
Calling this method will display a survey regardless of the user’s current eligibility.
Declared In
ForeSeeCxMeasure.h
+ showInviteForSurveyID:
Force a invite to display for a given surveyID
+ (void)showInviteForSurveyID:(NSString *)surveyID
Parameters
surveyID |
The ID of the survey you wish to invite the user to take. |
---|
Discussion
Calling this method will display an invite regardless of the user’s current eligibility.
Declared In
ForeSeeCxMeasure.h
+ checkIfEligibleForSurvey
Checks to see if the user is currently eligible to be invited to a survey.
+ (void)checkIfEligibleForSurvey
Discussion
In order to be eligible, a number of conditions must be fulfilled:
- The library is in an enabled state. If the user has previously declined an invite or completed a survey, the library will be in a disabled state. Otherwise, the library is in an enabled state.
- The user has met the loyalty threshold defined in your foresee_configuration.json file.
- The user is in the sampling pool. If the previous two conditions have been met, the library makes an HTTP call to our servers to determine if the user is in the sampling pool. If s/he is, the invite will be presented. If not, the invite will not be shown. Disable this remote check with setSkipPoolingCheck:
Declared In
ForeSeeCxMeasure.h
+ surveyIdForNotificationResponse:
Returns the surveyId for the notification that triggered an invite.
+ (NSString *)surveyIdForNotificationResponse:(UNNotificationResponse *)response
Parameters
response |
The notification that was sent to the user. |
---|
Return Value
The surveyID of the measure that triggered the invitation. *
Discussion
Also, cancels the pending notification.
Declared In
ForeSeeCxMeasure.h
+ showSurveyForNotificationResponse:
Shows the survey associated with a notification.
+ (void)showSurveyForNotificationResponse:(UNNotificationResponse *)response
Parameters
response |
The notification that was presented to the user. |
---|
Discussion
Also, cancels the pending notification.
Declared In
ForeSeeCxMeasure.h
+ contactDetailsForType:
Retrieves a user’s contact details for the given contact type.
+ (NSString *)contactDetailsForType:(FSContactType)type
Parameters
type |
an FSContactType |
---|
Availability
v5.1.0
Discussion
This method can be used to provide a user’s contact information, so that they do not need to enter it manually. When provided, the default invite will auto-populate the contact input field for CONTACT surveys.
Declared In
ForeSeeCxMeasure.h
+ setContactDetails:forType:
Sets a user’s contact details.
+ (void)setContactDetails:(NSString *)contactDetails forType:(FSContactType)type
Parameters
contactDetails |
The customer’s contact information (e.g. a phone number or email address) |
---|---|
type |
an FSContactType that specifies the type of information prodvided in contactDetails |
Availability
v5.1.0
Discussion
This method can be used to provide a user’s contact information, so that they do not need to enter it manually. When provided, the default CONTACT invite will auto-populate the provided details for the user. Only valid for CONTACT surveys.
Declared In
ForeSeeCxMeasure.h
+ setPreferredContactType:
Sets a preferred contact details type.
+ (void)setPreferredContactType:(FSContactType)type
Parameters
type |
the preferred FSContactType |
---|
Declared In
ForeSeeCxMeasure.h
+ preferredContactType
Gets the preferred contact details type.
+ (FSContactType)preferredContactType
Declared In
ForeSeeCxMeasure.h
+ allContactDetails
Retrieves all user contact details for every type.
+ (NSDictionary<NSNumber*,NSString*> *)allContactDetails
Return Value
an NSDictionary where the keys are NSNumbers containing the FSContactType and the values are the actual contact details for that type
Availability
v5.1.0
Declared In
ForeSeeCxMeasure.h
+ clearUserData
Clears any and all previously-set user data
+ (void)clearUserData
Availability
v5.1.0
Declared In
ForeSeeCxMeasure.h
+ customInviteAccepted
Tells the SDK that a custom invite was accepted.
+ (void)customInviteAccepted
Discussion
You should call this method whenever a user accepts a custom invite that you’ve presented.
Declared In
ForeSeeCxMeasure.h
+ customInviteDeclined
Tells the SDK that a custom invite was declined.
+ (void)customInviteDeclined
Discussion
You should call this method whenever a user declines a custom invite that you’ve presented.
Declared In
ForeSeeCxMeasure.h
+ setSkipPoolingCheck:
Disables the pooling check.
+ (void)setSkipPoolingCheck:(BOOL)shouldSkip
Parameters
shouldSkip |
YES to skip the pooling check. |
---|
Discussion
When debugging your implementation of the ForeSee SDK, it may be useful to disable the pooling check. This ensures that the invite will always show if the loyalty criteria has been fulfilled.
Declared In
ForeSeeCxMeasure.h
+ shouldSkipPoolingCheck
Get pooling check setting
+ (BOOL)shouldSkipPoolingCheck
Return Value
YES if pooling check is skipped, NO otherwise
Declared In
ForeSeeCxMeasure.h