By default, when you enable Butterflive Incite, the slider is displayed when the score reaches the threshold you defined.
The threshold parameter and all the texts in the slider are configured in the "Butterflive Incite" menu in your account:
If you are looking for a deeper integration of Butterflive Incite in the design of your website, or if you want to perform special actions when the score reaches the threshold, you can customize the Butterflive Incite behaviour using a Javascript hook.
With Butterflive, you can trigger any Javascript function when the score reaches the threshold.
Let's start by disabling the default Butterflive Incite behaviour.
Connect to your account, and in the "Butterflive Incite" menu, tick the "Custom contact area" checkbox. This will disable the slider, but keep the score threshold detection that we need.
Then, let's head for the Javascript code in yoru web page. We will use the onThresholdReached event handled that is triggered each time the threshold is reached.
If you are using Butterflive in asynchronous mode:
You can add this code just below the declaration of the "bflOptions" variable.
bflOptions.onThresholdReached = function(nbPages, nbSessions) {
alert("You reached the threshold "+nbPages+" times on this "\
+"page, and "+nbSessions+" times in this session.");
}
If you are using Butterflive in synchronous mode:
Butterflive.onChatRequest(function(nbPages, nbSessions) {
alert("You reached the threshold "+nbPages+" times on this "\
+"page, and "+nbSessions+" times in this session.");
});
This sample code will just display a Javascript alert each time the visitor reaches the threshold. You can see the Javascript callback accepts 2 arguments: the number of times the threshold was reached on the page, and the number of times the threshold was reached for this session. These parameters are useful if you don't want to sollicit your visitor too much. For instance, you could you them to trigger the display of a popup only once per visit.