Help and support

Resources that will teach you everything about LiveChat.

Facebook Pixel: track LiveChat data

by Krzysztof Kraus

Use Facebook Pixel to track LiveChat-related data and see how many chats, surveys or tickets have your customers engaged in. Learn more about your visitors browsing habits and make use of all the valuable data you have gathered!

Add Facebook Pixel

Facebook pixel is a small analytics code for your website. With the use of it, you can track the visitor’s movement, along with custom events that your customers can engage in. Use this advantage to measure actions that people take on your website and create more effective Facebook advertising campaigns.

  1. To create your Facebook Pixel, log onto your Facebook Account and go to the Facebook Pixel tab in Ads Manager. There, click on the Create a Pixel button.
Create your Facebook Pixel
  1. In the next section, name your new Pixel and click Next button to continue.
Name your Facebook Pixel and click on Next to continue
  1. There are two ways to add Facebook Pixel to your website. You can use a software like Google Tag Manager, or you can copy the Pixel code and paste it into your website’s HTML manually.
Choose how would you like to add Facebook Pixel to your website
  1. After implementing the Facebook Pixel’s code on your website, Facebook Ads manager will start tracking the movement on your page.
Facebook Pixel: track LiveChat data

Done! Facebook Pixel is now added to your website, and you can integrate it with LiveChat! Use this opportunity to create better-targeted Facebook advertising campaigns!

Integrate LiveChat with Pixel

To integrate LiveChat with Facebook Pixel, all you have to do is to modify the LiveChat 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.
  1. To integrate LiveChat with Facebook Pixel, modify your LiveChat code by adding the additional code snippet to it. You can add the snippet just before the closing </script> tag of your LiveChat 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' });
};


  1. After adding the snippet, your LiveChat 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.livechatinc.com/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>
You can copy the LiveChat snippet from above and use it to replace the current code added to your website. When doing so, remember to replace the XXXXXX in the window.__lc.license = XXXXXX; line with your own license number!

Done! Now LiveChat is integrated with Facebook Pixel and you can track LiveChat-related events straight in your Facebook Ads manager.

View LiveChat events in Facebook Ads manager

  1. To view LiveChat-related events, log into your Facebook Ads Manager
  2. .
Facebook Pixel: track LiveChat data
  1. There you will find the list of events tracked by your Google Pixel. To view the LiveChat-related ones, click on the Click on the eye icon button available on the right
  2. .
Click on eye-button to see your LiveChat-related data
  1. And that’s it! The list of LiveChat events will appear in a new window.
List of LiveChat events

Hopefully, you have found this article helpful but if you have any additional questions, feel free to start a chat with us – we are available 24/7/365!

Did you find this helpful? Yes No
Thanks for your feedback.
100% of people found this helpful.