Facebook Pixel: track LiveChat data

4 min. readlast update: 10.17.2023

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.

undefined

2) In the next section, name your new Pixel and click Next button to continue.

3) 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.

undefined

4) After implementing the Facebook Pixel's code on your website, Facebook Ads manager will start tracking the movement on your page.

undefined

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' }); };

2) 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) 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.

3) And that's it! The list of LiveChat events will appear in a new window. 

undefined

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!

Was this article helpful?