If Element Action
The ‘IfElement’ action allows you to handle multiple scenarios on your user journey. It is very similar to the ‘IfAssert’ but alot more equipped to deal with several scenarios rather than just two. This is particularly useful if you have active A/B testing on your site. You can easily add new scenarios as they are implemented.
To add an ‘IfElement’ first identify exactly where the elements change. It is also helpful to take note if there is a more likely scenario that the journey will reach. This will be the first element the script checks for.
Enter in the condition, selector and comment which will set the first scenario to check. The Timeout is how long the journey will check before moving on to the next condition. We recommend keeping this to the standard 5 seconds. If you have 5 scenarios each with a 5-second timeout it will take 20 seconds to reach the final scenario.
To add another condition click ‘Add ‘ELSE IF’ Condition’ and repeat the process.
Back in the script editor, you will now see the boxes which will house the actions for each scenario. You will notice that there is an extra box called ‘Else (All “if” Statements Return False), this is the scenario if everything else returns false. We would recommend using this for the least likely scenario/condition to reduce journey times.