Help And Support
Facebook Pixel: track Live Chat Agent data
This article will help you with:
- Integrate Live Chat Agent with Pixel - learn how to integrate Live Chat Agent with Facebook Pixel.
- View Live Chat Agent events in Facebook Ads Manager - learn how to view Live Chat Agent events stored in your Facebook Ads Manager.
Integrate Live Chat Agent with Pixel
To integrate Live Chat Agent with Facebook Pixel, all you have to do is to modify the Live Chat Agent tracking code added to your website. After doing so, you will be able to track the following events:
- Pre-chat submitted - this event will be stored every time your website visitor will submit a pre-chat survey;
- Chat Started - this event will be stored every time your visitor will start a chat with you;
- Post-chat submitted - this event will be stored every time your website visitor will submit a post-chat survey;
- Ticket created - this event will be stored every time your website visitor will leave you an offline message.
To integrate Live Chat Agent with Facebook Pixel, modify your Live Chat Agent code by adding the additional code snippet to it. You can add the snippet just before the closing tag of your Live Chat Agent code.
var LC_API = LC_API || {};
LC_API.on_prechat_survey_submitted = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Pre-chat submitted' });
};
LC_API.on_chat_started = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Chat Started' });
};
LC_API.on_postchat_survey_submitted = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Post-chat submitted' });
};
LC_API.on_ticket_created = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Ticket created' });
};
After adding the snippet, your Live Chat Agent code will look like on the following example:
<script type="text/javascript">
window.__lc = window.__lc || {};
window.__lc.license = XXXXXX;
(function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatagent.com.au/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
var LC_API = LC_API || {};
LC_API.on_prechat_survey_submitted = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Pre-chat submitted' });
};
LC_API.on_chat_started = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Chat Started' });
};
LC_API.on_postchat_survey_submitted = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Post-chat submitted' });
};
LC_API.on_ticket_created = function(data)
{
fbq('trackCustom', 'LiveChat', { event: 'Ticket created' });
};
</script>
Done! Now Live Chat Agent is integrated with Facebook Pixel and you can track Live Chat Agent-related events straight in your Facebook Ads manager.
View Live Chat Agent events in Facebook Ads manager
To view Live Chat Agent-related events, log into your Facebook Ads Manager.
There you will find the list of events tracked by your Google Pixel. To view the LiveChat-related ones, click on the eye button available on the right
And that's it! The list of Live Chat Agent events will appear in a new window.