Quizzes
Data stores can be used to create interactive quizzes that test users' knowledge and provide rewards for completion.
Overview
Using data stores, you can save information about quizzes, including:
- Quiz metadata (name, number of questions, revision)
- Questions and answer options
- Correct answers
- User responses
- Reward behaviours to trigger
This creates a framework for educational engagement that can be tied to your rewards system.
Implementation steps
Follow these steps to create a quiz system:
-
Define behaviours
- Create behaviours to reward users for completing quizzes
- Consider using flexible behaviours to reward users based on:
- Which quiz they completed
- How many correct answers they provided
- Time taken to complete
- These behaviours will serve as the reward mechanism
-
Configure data stores
- Create a data store for the quiz itself, containing:
- Quiz metadata (name, number, revision date)
- Questions with their type (single-select, multiple-select)
- Answer options
- Correct answers
- Behaviour to trigger as a reward
- Create a separate data store type for user answers:
- Associate each user's answers to them by setting them as the owner
- Store which questions they answered correctly
- Track completion date and overall score
- Create a data store for the quiz itself, containing:
-
Build the user interface
- Create a custom UI that allows users to:
- Browse available quizzes
- Take quizzes
- See their past quiz attempts and scores
- View rewards earned from quiz completion
- Create a custom UI that allows users to:
Example code
Quiz definition data store
Below is a sample data store for a quiz:
JSON
User answers data store
Below is a sample data store for the user's answers to the quiz:
JSON
Implementation tips
- Create different quiz difficulty levels
- Implement time limits for additional challenge
- Use quiz completion to unlock additional content
- Consider creating quiz series that build upon each other
- Add leaderboards specifically for quiz performance