Skip to main content
All CollectionsRayn Air Surveys & Distributions
Installing Survey Distribution for Web
Installing Survey Distribution for Web
Niels Baarsma avatar
Written by Niels Baarsma
Updated over a week ago

Obtain the distribution wrapper tag from the Rayn Console. Navigate to your distribution of choice and select the install tab.

Example:

<script src="https://wrappers.prod.rayn.io/distributions/[distributionId]/bundle.js"></script>

The survey will be displayed automatically when the wrapper is loaded.

Interacting with the Survey

raynSurveyReturn Event

When a survey is submitted it will emit an event with the submitted data:

Example:

{
"raynSurveyReturn": [{
"lang_code": "en",
"distribution_id": "distribution-id-1",
"question_id": "question-id-1",
"survey_id": "survey-id-1",
"user_id": "3ca1a8d4-d05a-4447-8f91-53a7c1c42158",
"answer_id": "question-id-1-answer-id-1"
},
{
"lang_code": "en",
"distribution_id": "distribution-id-1",
"question_id": "question-id-2",
"survey_id": "survey-id-1",
"user_id": "3ca1a8d4-d05a-4447-8f91-53a7c1c42158",
"answer_id": "question-id-1-answer-id-2"
}
...
]
}

JS API getAnswers

You may also use the JS API to obtain survey answers.
โ€‹
API function to retrieve survey answers:

raynSurvey.getAnswers([questionIds])

Arguments


โ€‹questionIds (Array<string>): Optional parameter, if provided this function will return only the given answers to those questions. If this parameter is not passed then all answers will be returned. The structure of the returned object is the same as the raynSurveyReturn event.


Example:

raynSurvey.getAnswers();

[
{
"lang_code": "en",
"distribution_id": "distribution-id-1",
"question_id": "question-id-1",
"survey_id": "survey-id-1",
"user_id": "3ca1a8d4-d05a-4447-8f91-53a7c1c42158",
"answer_id": "question-id-1-answer-id-1"
},
{
"lang_code": "en",
"distribution_id": "distribution-id-1",
"question_id": "question-id-2",
"survey_id": "survey-id-1",
"user_id": "3ca1a8d4-d05a-4447-8f91-53a7c1c42158",
"answer_id": "question-id-1-answer-id-2"
}
...
]
Did this answer your question?