Force DriftLinks to Adhere to Online/Offline Hours
Some teams may have specific online and offline hours. We love a strong work/life balance, and this is one more way you can guarantee that your site visitors are getting the correct user experience for every time of day, even when they're using Driftlinks to get in touch with you.
If you're looking for a more custom JavaScript solution for your Driftlink's online and offline hours, keep reading. Otherwise, take a peek at our native conditional branching functionality within the playbook builder (zero coding required).
In the below example, our Driftlinks are forced to adhere to online and offline hours.
function onClick() {
drift.on('ready', function(api, event) {
if (event.data.isOnline) {
location.hash = "REPLACE_WITH_ONLINE_DRIFTLINK"
} else {
location.hash = "REPLACE_WITH_OFFLINE_DRIFTLINK"
}
});
};
Put simply, this code allows a different Driftlink to be used depending on if your team is online or offline. Use this code wherever you might want more control over which Driftlinks are shown to your site visitors. If the Driftlink is fired from a button, the button will need to be attached to the function above.
Updated 13 days ago