Triggers
Outline
A trigger listens to a certain event that occurs in an Evolve course. Once the event occurs, the trigger can run its actions if the condition set is met. There are many types of events, actions, and conditions that can be used inside a trigger to create custom behavior within a course.
This article provides you with an overview of triggers and how you can utilize them in Evolve courses.
Trigger overview
A trigger consists of an event, condition, and actions. In the example below, the trigger will set the course to complete once the selected component is completed.
Trigger event: The event is set to Components Completed. That means any time a component is completed in the course, this trigger will check its condition to see if it can run its actions.
There are many types of events available. They are organized by the content type that causes the event to occur.
Trigger condition: The condition changes depending on the event type selected. The Components Completed event requires a component to be selected in the condition.
Trigger action: The action section is used to tell the course what action to take once the condition has been met. In this example, there is a single action that sets the course to complete once the component has been completed.
Trigger events
A trigger event is an event that takes place in the course, usually based on the input of a learner. For example, a component is completed or when a page has loaded. There are many types of events that can be used inside a trigger.
The diagram below illustrates what happens when a user completes an accordion component in a course with two different triggers that are both watching for the Component Completed event.
Trigger A: The course is watching for the Text Component to be completed so it does not run the action.
Trigger B: The course is watching for the Accordion Component to be completed, which the user has done, so it does run the action.
Trigger events breakdown
The breakdown below lists all possible event types a trigger can use, as well as what the trigger will evaluate before calling its actions.
Component events
- Components Completed: If any or all the selected components have been completed.
- Components Started: If any or all the selected components have been started.
- Components Viewed: If any or all the selected components have been viewed. (This event will only work once the course has been published).
- Components Correct: If any or all the selected question components have been marked as correct and completed.
- Components Incorrect: If any or all the selected question components have marked as incorrect and completed.
- Action Button Clicked: Select an Action Button from your course that must be clicked.
Page events
- Page Loaded: If the selected page has loaded and/or when a page becomes loaded once all components on that page are ready to display.
- Page Unloaded: If the selected page has unloaded and/or occurs when the page is navigated away from.
- Pages Completed: If any or all of the selected pages have been completed.
- Pages Viewed: If any or all the selected pages have been viewed
Topic events
- Topic Loaded: If the selected topic has loaded.
- Topics Completed: If any or all the selected topics have been completed.
- Topics Viewed: If any or all the selected topics have been viewed.
Article events
- Articles Completed: If any or all the selected articles have been completed.
- Articles Viewed: If any or all the selected articles have been viewed.
Block events
- Blocks Completed: If any or all the selected blocks have been completed.
- Blocks Viewed: If any or all the selected blocks have been viewed.
Variable events
- Variables Changed: If any of the selected variables value has changed and if all the comparisons of the selected variables pass.
Extension events
- Course Assessment Completed: When the course assessment extension is set as complete. This event will be called again if the assessment is reset then completed.
- Course Assessment Passed: When the course assessment extension is set as passed. This event will be called again if the assessment is reset then completed.
- Course Assessment Failed: When the course assessment extension is set as failed. This event will be called again if the assessment is reset then completed.
- Course Assessment Reset: When the course assessment extension is reset. This event will be called again if the assessment is failed then reset.
- Course Attainment Completed: When the course attainment extension is set as complete.
Trigger actions
Once the trigger’s condition is met, the actions set in that trigger will be run. There are many types of actions such as displaying a hidden component, navigating to a page, or setting the course to complete.
Actions are called as soon as the trigger’s condition is met. In some cases, it can be useful to delay the action by a certain amount of time. In the example below, there is a delay before navigating to the article. This can give some time for the article to load any assets before navigating to it if it’s on the same page.
Trigger action breakdown
The breakdown below illustrates all possible action types a trigger can use.
- Set Course To Complete: Sets the course to be complete. This should be used alongside the Logic Completion option in the “Select How Your Course Should Set A Status” publish option.
- Set Course To Passed: Sets the course to be passed. This should be used alongside the Logic Completion and Logic Passed/failed option in the “Select How Your Course Should Set A Status” publish option.
- Set Course To Failed: Sets the course to be failed. This should be used alongside the Logic Completion and Logic Passed/failed option in the “Select How Your Course Should Set A Status” publish option.
- Set Course Progress: Sets the course progress towards completion. The progress is taken from the selected variables value.
- Progress can be set as a percentage. The percentage will be based off the Max progress value provided. The Max Progress is the maximum value that can be set.
- Setting a Max Progress of 100 will mean that if the selected variables value goes above 100, the progress set will still be 100. (note: this behavior occurs when not saving as a percentage of the Max Progress)
- This should be used alongside the Logic Completion or Logic Completion and Logic Passed/failed option in the “Select How Your Course Should Set A Status” publish option.
- Set Course Score: Sets the course's score. The score is taken from the selected variables value. Score can be set as a percentage. The percentage will be based off the Max Score value provided.
- The Max Score is the maximum value that can be set.
- Setting a Max Score of 100 will mean that if the selected variables value goes above 100, the score set will still be 100. (note: this behaviour occurs when not saving as a percentage of the Max Score)
- This should be used alongside the Logic Completion or Logic Completion and Logic Passed/failed option in the “Select How Your Course Should Set A Status” publish option.
- Reset Course: Resets the course to its original state. This also resets all variable values to their default value.
- Reset Components: Resets all selected components to their original state.
- Show Hidden Pages: Shows all selected hidden pages. Pages can be hidden using the page builder or the Hide Pages action.
- Show Hidden Articles: Shows all selected hidden articles. Articles can be hidden using the page builder or the Hide Articles action.
- Show Hidden Blocks: Shows all selected hidden blocks. Blocks can be hidden using the page builder or the Hide Blocks action.
- Show Hidden Components: Shows all selected hidden components. Components can be hidden using the page builder or the Hide Components action.
- Hide Pages: Hides all selected pages.
- Hide Articles: Hides all selected articles.
- Hide Blocks: Hides all selected blocks.
- Show Dialog: Displays a dialog pop-up. Dialogs can be created by going to the Course builder, clicking Edit Course Settings, and finding the Dialogs section.
- Hide Components: Hides all selected components.
- Navigate To Page: Navigates to the selected page.
- Navigate To Article: Navigates to the selected article.
- Navigate To Block: Navigates to the selected block.
- Navigate To Component: Navigates to the selected component.
- Increase Variable by Value: Increases the selected variables value by the provided numerical value. Only a number type variable can selected.
- Decrease Variable by Value: Decreases the selected variables value by the provided numerical value. Only a number type variable can selected.
- Set Variable Number: Sets the selected variables value by the provided numerical value. Only a number type variable can selected.
- Set Variable Text: Sets the selected variables value by the provided text value. Only a string type variable can selected.
- Set Variable True or False: Sets the selected variables value by the provided boolean value. Only a boolean type variable can selected.
- Enable Trigger: Enables a trigger. Once a trigger is enabled it will start “listening” to events. Triggers can be manually enabled in the logic section of the course editor.
- Disable Trigger: Disables a trigger. Once a trigger is disabled it will stop “listening” to events. Triggers can be manually disabled in the logic section of the course editor.
- Set Article Style: This can be used to change or set the article style applied to a specific article, as well as the theme a learner sees, for instance for accessibility or locale purposes.
Debug a trigger
You may need to debug a trigger if your course isn't behaving in the way you expect it to. The Live Preview tools can display how many times a trigger has been activated and its enabled/disabled state. A trigger can also be manually activated, this has no effect on the source of the event, only the actions are run. The log section also shows when a trigger was activated.
Use triggers and variables together
Triggers and variables, when used together, can provide advanced behaviors in a course that was previously only possible by adding new features to Evolve.
Below is an example of using 3 triggers with variables to create a quiz that has a pass mark. The course should only set as complete once all questions have been completed and the score is greater or equal to the pass mark.
- The first trigger listens to when components are completed. If all the selected components are complete the action sets the selected variable “Quiz complete” to true.
- The second trigger listens to when question components are marked as correct. If any of the selected components are marked as incorrect, the action increased the value of the selected variable “Score” by 1.
- The third trigger listens to when variables change. If any of the selected variables change and all the variable comparisons evaluate as true, then the actions are run.
Did this article help?
Let us know by leaving a star rating or review at the top of this article.