These instructions are intended for people with a basic understanding of web programming languages: HTML and JavaScript. If this does not apply to you, we recommend that you contact your developers and provide them with these instructions. The installation will be very easy for them.
Oct8ne triggers allow you to interact with visitors when specific conditions—previously defined in the “Triggers” section of the Oct8ne dashboard—are met (for example: time spent on the page or a specific URL).
But sometimes these conditions aren’t enough to cover very specific scenarios that can occur on certain websites, which is why Oct8ne’s custom triggers were created. Thanks to them, there will no longer be any obstacles when defining the conditions for triggering the chat. We’ll have complete freedom to choose the ideal moment to start a conversation with the visitor.
But what does it take to create a custom trigger?
Follow the steps below to get everything up and running in just a few minutes. We recommend that the implementation be carried out by your IT team:
1. Generate dynamic code tailored to your needs:
First, you need to clearly define the conditions that, when met, will open the Oct8ne chat, and control them using JavaScript variables on the different pages of the website where you want the trigger to fire, assigning values to each variable based on how they should respond to user interactions.
Let’s assume we want the Oct8ne chat to open when a visitor’s cart total exceeds €100 and they are in the “Men” product category.
This would involve creating a variable that holds the numerical value corresponding to the sum of the prices of all the products the user has in their cart, and another text variable that holds the name of the product category the user is currently in.
The ultimate goal is for the variables we’re working with to appear as another parameter in the Oct8ne code embedded on our website, within the oct8ne.customData property:
2. Create a trigger in the Oct8ne Dashboard based on the desired values of our variables:
Once we have finished configuring the variables, we need to go to the Oct8ne dashboard and create a new trigger that includes at least one custom condition (as shown in the dropdown menu in the image).
We must populate these conditions with the same name we assigned to the object's property and the comparison with the desired value, but it is very important that this matches the data type; in other words, you cannot declare that one string is greater than another because it will not work.
Nested properties or sub-objects cannot be evaluated. For example, if the conditions specify that the “cart.value” property must be greater than 100, the system will evaluate the property oct8ne.customData[“cart.value”], NOT the property “value” within “cart”: oct8ne.customData.cart.value.
Some examples of custom conditions, including the case from the previous step:
To compare text values (such as category names), you can use the comparators ‘Contains’, ‘Does not contain’, ‘Starts with’, ‘Ends with’, ‘Does not start with’, and ‘Does not end with’; while for numerical values, you can use ‘Equals’, ‘Greater than’, and ‘Less than’.
You can also check whether the parameter has been added at all, regardless of its value, using ‘Exists’ and ‘Does not exist’.
How to update variable values in real time.
The values of properties defined as conditions are typically evaluated when the page loads and do not change until the page is updated or reloaded.
If you want to update a value based on an event that has occurred on the page and evaluate it to determine whether a trigger should be fired, you can call the following method:
- oct8ne.updateTriggerValue (propertyName, newValue)
For example, if we have defined the variable 'oct8ne.customData.cartValue=0', and the visitor adds a product to the cart using Ajax, we can call the above method as follows:
oct8ne.updateTriggerValue ("cartValue", 150).
This call will update its value to 'oct8ne.customData.cartValue=150' and re-evaluate the triggers to see if any need to be fired, since the value has been modified.