It's possible to automatically trigger a piece of content after end users have finished a certain step in their personal route. There are several types of content that can be triggered:

  • Diary
  • Template treatment
  • Template training
  • Template ROM
  • Template screening
  • Modules

Where to build in a trigger?

It's possible to add a trigger to a normal page as well as a review/reflection moment or a milestone.

When does the trigger go into effect?

A normal trigger goes into effect as soon as the end user continues past the page/submission moment/milestone containing the trigger. However, a conditional trigger goes into effect only after a reflection/submission moment.

Note: the following content types will appear on the client's home page when they are triggered: diary, template training, template treatment, template ROM and a template screening. However, if you trigger a module, this triggered module will automatically be placed behind the previous module. At the end of the module the client will automatically change to this triggered module. Are you triggering multiple modules? Then they are placed in the order in which you triggered them. However, it's possible to add the module to the homepage (in a new module list) by adding "new_modulelist": true. How this works is explained further on.


How to build an actual trigger

You can build a trigger in just a couple of steps.

First check whether you have the editor role assigned to you by clicking on your profile, then preferences and then by checking whether ‘Editor’ is listed under groups. If not, first contact your application manager to have this role assigned to you.


Step 1 

For now, building a trigger happens in the raw code. To get to the raw code of your module, you have to be in the edit mode. Once in edit mode, remove all the text in your URL after the word 'json':


After removing this text, add '/edit' to the URL:


Step 2

You've now entered the raw code of your module. If you look closely you can recognize the different elements of your module within the code. Scroll to the page that you want to add the trigger to. You can recognize the start of a new page by the text "type": "page".


Step 3

The right place for your trigger is after the text: "type": "page" . You do this by first adding a comma after "page" (,) and then entering the following code (of course replacing the content ID with the ID that you want to trigger). The page is then closed of by the }], "title" "TITLE OF CHAPTER" already in the raw code.



To copy you can use this code, in order to trigger the content in an already excisting module list:


"triggers": [
            {
                "tool": [
                {
                    "id":"ID OF TO BE TRIGGERED CONTENT"
                  }
                ]
              }
            ]


Would you like to trigger the content in a new module list, so it will appear on the homepage of the client? You can add "new_modulelist": true to your code:


"triggers": [
            {
                "tool": [
                {
                    "id":"ID OF TO BE TRIGGERED CONTENT",
                     "new_modulelist": true
                  }
                ]
              }
            ]

Step 4

All you have to do now is click 'save and view' and your trigger has been built. Once back in the regular edit mode, a small lightening bolt shows that the trigger has been successfully added. From now on you can directly navigate back to the raw code by clicking on the lightening bolt. You no longer have to edit the URL to get there.


 Conditional triggers 

You can also add a conditional trigger. This means that content is only triggered if an end user provides a specific response. By way of illustration: You can ask a client if he/she would like to do an extra module on relaxation. The client can choose 'yes' or 'no'. Only when the client answered 'yes', the module is made available to the client. Below is a snippet of code, which you can add according to the same (just described) step-by-step plan to build your trigger. So you only use a different piece of code at step 3.

Attention! the conditional trigger functionality only works for tools that are also available in the mobile app. Legacy modules, documents and ROM screenings are not suitable for a conditional trigger.


Triggering a mobile tool in a module list based on an answer:

The following piece of code allows you to trigger a mobile module based on a specific response from the end user. Use the piece of code below in step 3. It is important that when you are in the raw code of your content, you look for the ID of the question in the code and the ID of the answer that the end user must give to ensure that the new content is triggered. These are the conditions under which the new content is triggered. Next, you have to copy the IDs into the piece of code. Of course, add the ID of the new content that needs to be triggered.



"triggers": [
             {
                "condition": [
                  "ID of question",
                   "==",
                   "ID of answer"
                  ],
                 "tool": [
                 {
                     "id":"ID OF TO BE TRIGGERED CONTENT"
                   }
                 ]
               }
             ]


Triggering a (mobile) tool in a new module list, based on an answer:

This piece of code works the same way as the previous piece of code, except that the triggered module is placed in a new module list. This means that it is parallel ready for the end user instead of sequential. If the module is ready in parallel, then the end user can get started immediately. 

"triggers": [
             {
                "condition": [
                  "ID of question",
                   "==",
                   "ID of answer"
                  ],
                 "tool": [
                 {
                     "id":"ID OF TO BE TRIGGERED CONTENT",
                      "new_modulelist": true
                   }
                 ]
               }
             ]


Triggering a tool (module, diary, etc.) in a new module list, based on the score of a computation:

You can also trigger content based on the result of a calculation. Below is an example piece of code that you can use. Where in this example 'question1' is, comes the name of the computation you created. computation:question1= the total score of 'question1'. Where the number 2 is located, you can choose any value you want the new content to be triggered. The ">" is the operator, and in this case means that the total score of computation named 'question1' must be greater than 2. As soon as the value is greater than 2, the content will be triggered. At 'ID OF TO BE TRIGGERED CONTENT' enter the ID of the content you want to trigger. 


"triggers": [
                {
                  "condition": [
                    "computation:question1",
                    ">",
                    2
                  ],
                  "tool": [
                    {
                      "id": "ID OF TO BE TRIGGERED CONTENT",
                       "new_modulelist": true
                    }
                  ]
                }
          ]


You can choose between different operators for the conditional trigger:

Meaning
Code
Equals
==
Does not equal
!=
Is greater than
>
Is less than
<
Is greater than or equal to
>=
Is less than or equal to
<=

 How to build a delay in triggers 

In addition to defining an ID and a condition, it may be useful to activate content with a delay on the homepage (new module list). This means that the content is only triggered after a certain amount of time. Below is an example of code with a built-in delay of 8 weeks:


"triggers": [
              {
               "tools":[
                        {
                          "id": "ID od module",
                           "new_modulelist": true
                        }
                       ],
               		"delay": "8w"
               }                
           ]


This table provides several timestamp options that you can write in your code:

Meaning
Code
Second
s
Minute
min
Hour
h
Day
d
Weekw
Monthm
Yearj