Finding out where your Drift chat users come from can be a challenge. Fortunately, Tend makes this incredibly easy.
This tutorial will show you how to capture contacts in Tend, who enter their email into the Drift chat. Allowing you to see exactly what drove that visitor to your site in the first place!
Note: This tutorial also requires a Zapier account.
The first step will be to send the Tend fingerprint (saved as an a_id
cookie), to Drift as a custom attribute.
To do so, add the following below the existing drift javascript:
<script>
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
var a_id = getCookie('a_id');
drift.identify(a_id, {
tend_fingerprint: a_id
});
</script>
The getCookie
function is used to pull the Tend fingerprint (ie a_id
) from the visitor's browser. Then we pass the fingerprint to Drift with the tend_fingerprint: getCookie('a_id')
line.
In Zapier, create a new Drift New Lead Trigger. When testing, you should see the fingerprint in Drift's response (as shown in the example below).
Then, create a Tend Create Contact action, passing both the visitor's email, as well as their fingerprint