There’s nothing more frustrating when you can’t find what you’re looking for.

In a brick-and-mortar store, a salesperson can actively see the customer’s frustration and offer help. But what about online customers? How do you know when they need help? With Velaro’s Lifefluence system—designed around intelligent engagement — you can easily track visitors’ failed searches and offer assistance through live chat.

 

In fact, asking visitors if they need help is one of the most effective automated requests to chat. Why? Everyone grabs onto a lifeline in a moment of need!

 

To set up the failed search invite, all you have to do is set a cookie on the page and send a custom value to our Visitor Monitoring. The logic to complete this type of trigger can be different depending on the structure of your website, but the instructions below offer the most common and effective strategies for designing this trigger.

 

You’ll need some additional JavaScript and HTML on your website, so you can create an additional cookie on your visitor’s browser and pass the value of the cookie through Velaro’s real time Visitor Monitoring. Below is a template for two JavaScript functions that will create the desired cookie as well as set the expiration to just a single session (when the visitor exits your site).

 

<script language = “javascript”>

function setCookie(name,value,days)

{

if (days) {

var date = new Date();

date.setTime(date.getTime()+(days*24*60*60*1000));

var expires = “; expires=”+date.toGMTString();

}

else

var expires = “”;

document.cookie = name+”=”+value+expires+”; path=/”;

}

function vGetCookie(c_name)

{

var theCookie = “” + document.cookie;

var ind = theCookie.indexOf(c_name);

if (ind == -1 || c_name == “”)

return “”;

var ind1 = theCookie.indexOf(‘;’,ind);

if (ind1 == -1)

ind1 = theCookie.length;

return unescape(theCookie.substring(ind + c_name.length + 1, ind1));

}

var searchcount = vGetCookie(‘searchcount’);

if(isNaN(searchcount) || searchcount == 0){

searchcount = 1;

}else{

searchcount++;

}

setCookie(‘searchcount’, searchcount);

</script>

 

**For consistency, please note that my cookie is named “searchcount.” **

 

Of course this template can be modified to fit the exact structure of your site and is not meant to be the only solution for the design.

 

Now that we’ve created the searchcount cookie, we need to modify the visitor monitoring code. Below you’ll see the latest version of Velaro’s visitor monitoring code, which can be found by clicking your photo in the upper right hand corner of the Velaro application and selecting Account Setup. Then click on Deploy > Engagement Scripts:

 

<script src=”https://galleryuseastprod.blob.core.windows.net/velaroscripts/XXXX/globals.js”></script>

<script src=”https://cdn-us-east.velaro.com/bundles/velaro.inline.js”></script>

<script type=”text/javascript”>

Velaro.Globals.ActiveSite =XXXX; // Velaro Site ID

Velaro.Globals.ActiveGroup = 0; // Velaro Group ID leave it set to 0 if none

Velaro.Globals.InlineEnabled = true;

Velaro.Globals.VisitorMonitoringEnabled = true;

Velaro.Globals.InlinePosition = 0;

</script>

<noscript>

<a href=”https://www.velaro.com” title=”Contact us” target=”_blank”>Questions?</a>

powered by <a href=”http://www.velaro.com” title=”Velaro live chat”>velaro live chat</a>

</noscript>

1

 

We need to make two modifications here. First create a variable for the cookie itself:

var myCookie = getCookie(‘searchcount’);

 

Then adjust the extra parameters variable to include the variable and value:

Velaro.Globals.CustomChatValues = ‘&searchcount=’ + myCookie;

 

Our visitor monitoring code now looks like:

 

<script src=”https://galleryuseastprod.blob.core.windows.net/velaroscripts/XXXX/globals.js”></script>

<script src=”https://cdn-us-east.velaro.com/bundles/velaro.inline.js”></script>

<script type=”text/javascript”>

var myCookie = getCookie(‘searchcount’);

Velaro.Globals.ActiveSite =XXXX; // Velaro Site ID

Velaro.Globals.ActiveGroup = 0; // Velaro Group ID leave it set to 0 if none

Velaro.Globals.InlineEnabled = true;

Velaro.Globals.VisitorMonitoringEnabled = true;

Velaro.Globals.InlinePosition = 0;

Velaro.Globals.CustomChatValues = {searchcount: myCookie};

</script>

<noscript>

<a href=”https://www.velaro.com” title=”Contact us” target=”_blank”>Questions?</a>

powered by <a href=”http://www.velaro.com” title=”Velaro live chat”>velaro live chat</a>

</noscript>

 

Now that the code has been modified, we’re successfully creating a cookie and passing it into the real-time visitor monitoring. Important! This cookie should only be created and left on failed search pages. Depending on how your site is structured in terms of the code, you may want to have this modified JavaScript and Visitor Monitoring added to only those pages. Alternatively, you can add this code to your whole website, but create an additional function to delete the cookie on all pages EXCEPT the failed searches.

 

Next let’s design the trigger. Log into the Velaro application (app.velaro.com) with your administrative user, navigate to your photo in the upper right hand corner, and select Account Setup. Then go to Design > Invitations. Click on New Invitation. Add a condition under Create rules to display by clicking +Add condition. Select Query String in Name, enter searchcount in the second field, “is” in the third field, and 1 in the last field.

 

It’s important to consider other variables in your trigger such as agent availability. You don’t want the invite fired off if no one is online, so add the Is Chat Available parameter and set it to true. Finally, select the invite that will show by clicking Get from gallery and click on Save Invitation at bottom.

 

2