Surveys

Once you have created surveys in the PVP web interface, you must retrieve and display the surveys within your mobile app.

Retrieving Surveys

There are 2 types of surveys you can set up, and these will be retrieved in different ways:

Triggered Surveys

These surveys are returned in the BRScanResults.qualifiedSurveys property contingent on the receipt data that was scanned meeting the criteria you set up when you created the survey.

Note

You must have the BRScanOptions.validatePromotions property enabled for triggered surveys to be returned in the scan results)

Non-triggered Surveys

These surveys are returned in the callback to -[BRScanManager getSurveysWithCompletion:] which you can call at any time.

Displaying Surveys

Once you have retrieved one or more BRSurvey objects through one of the above methods, you can display them using our prepackaged survey controller or with your own custom UI.

Using the Prepackaged Controller

Creating a Custom UI

  • You can display a survey from start to finish with your own custom UI by simply iterating over the BRSurvey.questions array and displaying the appropriate controls for each question. The text of the question is in the BRSurveyQuestion.text property

  • Each BRSurveyQuestion has a type. Currently only two types are supported:

    • BRSurveyQuestionTypeOpenEnded
    • BRSurveyQuestionTypeMultipleChoice
  • If the question is multiple choice, the choices will be found in BRSurveyQuestion.answers which is an array of BRSurveyAnswer objects. Additionally, whether the question allows the user to select multiple answers is controlled by the BRSurveyQuestion.multipleAnswers property

  • Each BRSurveyAnswer object has only a single property called text which is the text to display for that answer choice

  • When the user has finished a question by making a selection or entering free text, you must create a new BRSurveyResponse object and populate it with the user’s response (which will either be a string or an array of indexes of the answers selected) and attach it to the current question via its -[BRSurveyQuestion addUserResponse:] method

  • At this point you would call -[BRSurveyQuestion getNextQuestionIndex]. The reason for this is that some surveys can be non-linear, for example if the user answers A to question 1, they move on to question 2 but if they answer B, they move on to question 3. Therefore you call this method to determine the index of the next BRSurveyQuestion you should show. A return value of -1 indicates there are no further questions

  • Once the user completes the survey, you must call -[BRScanManager submitSurveyResults:] to finalize the survey