Integrating GA Connector with LiveChat

Add Google Analytics data to LiveChat with GA Connector’s LiveChat integration.

To integrate LiveChat with GA Connector, you'll need to add a custom script to your website depending on which GA Connector version you have. If you're using Salesforce, Zoho CRM, Pipedrive CRM, Salesflare, or Close CRM you're likely using our API-based integration. For all other CRMs' please use the Cookie-based integration script.

Cookie-based Integration

HTML
<script type="text/javascript">
var LC_API = LC_API || {};
LC_API.on_after_load = function() {
cookieValues = gaconnector.getCookieValues();
var custom_variables = Object.keys(cookieValues).map( function(fieldName) {
return { name: fieldName, value: cookieValues[fieldName] };
});
LC_API.set_custom_variables(custom_variables);
};
</script>

API-based Integration

HTML
<script>function trackEmail(email){var target=document.getElementById('gaconnector_input_id');var event=new Event('change');target.value=email,target.dispatchEvent(event);}function onFormSubmitted(data){var customerData=LiveChatWidget.get('customer_data');customerData&&trackEmail(customerData.email);}var gaconnector_input=document.createElement('INPUT');gaconnector_input.setAttribute('type','hidden'),gaconnector_input.setAttribute('id','gaconnector_input_id'),document.body.appendChild(gaconnector_input),LiveChatWidget.on('form_submitted',onFormSubmitted);
</script>

Note: Make sure to put it somewhere below GA Connector and Livechat script code.

As a result of adding the script, your Livechat visitors (in the back-end) will contain GA Connector data.

To send Livechat leads to your CRM, you can use a tool like Zapier. Just make sure to map GA Connector fields in Livechat to CRM fields (you may need to wait until Zapier downloads these new fields).

FAQ

Q: I use Google Tag Manager instead of inserting script to the website directly. So both GA Connector and Livechat script have different tags. Where should I put this code?

Answer: Please use the tag sequencing functionality provided by Google Tag Manager:

Tag sequencing

Tag sequencing

It allows setting the script from the article to fire after GA Connector.

Just configure it so that:

  • Livechat tag fires after GA Connector.
  • This script fires after Livechat.

More than just UTM parameters

GA Connector adds UTM information, geolocation, referral information to your LiveChat leads.