Help Center
Set up Attributer with LiveChat
Attributer is a little bit of code you add to your website. It tracks where your visitors are coming from (I.e. Paid Search, Paid Social, Organic Search, etc) and then passes the data into LiveChat with each new chat session.
In order for it to work, you need to follow the steps below:
Step 1: Copy the below code
The first step to setting Attributer up with LiveChat is to copy the below code to your clipboard. This snippet of code uses LiveChat’s built-in ‘Custom Variables’ feature to pass the data through.
<script>
function waitForData() {
// Wait for data to be ready
if (!document.FlareTrk || !document.FlareTrk.data) {
return window.requestAnimationFrame(waitForData);
}
var session_vars = {
"channel": document.FlareTrk.data.drillData.channel,
"drilldown1": document.FlareTrk.data.drillData.drillDown1,
"drilldown2": document.FlareTrk.data.drillData.drillDown2,
"drilldown3": document.FlareTrk.data.drillData.drillDown3,
"drilldown4": document.FlareTrk.data.drillData.drillDown4,
"fbclid": document.FlareTrk.data.fbclid,
"id": document.FlareTrk.data.id,
"gclid": document.FlareTrk.data.gclid,
"landing_page": document.FlareTrk.data.landing_url,
"landing_page_group": document.FlareTrk.data.landing_page_group,
}
for (var dp = 0; dp < document.FlareTrk.settings.customFields.length; dp++) {
var key = document.FlareTrk.settings.customFields[dp];
session_vars[key] = document.FlareTrk.data["customFields"][key];
}
LiveChatWidget.call("set_session_variables", session_vars);
}
waitForData();
</script>
Step 2: Add the code beneath your LiveChat embed code
The next step is to place this additional snippet of code directly beneath the embed code you got from your LiveChat account (the one that installs LiveChat on your website).
See screenshot below:
Step 3: Test it works
The final step is to test it works. You can do this by navigating to your website in a new incognito window and starting a new chat.
You should see the data come through in the chat window:
If the data is coming through and appearing in the chat window like the screenshot above, then you have set up Attributer with LiveChat correctly!
We would also recommend reading this article for further information on how to test different channels (I.e. Organic Search, Paid Search, etc).
Can't find the answer you need? Contact us!
Our team are available to answer any questions you have