{"id":2914,"date":"2021-11-18T12:51:29","date_gmt":"2021-11-18T12:51:29","guid":{"rendered":"https:\/\/gaconnector.com\/docs\/?p=2914"},"modified":"2024-01-27T15:10:35","modified_gmt":"2024-01-27T15:10:35","slug":"integrating-ga-connector-livechat","status":"publish","type":"post","link":"https:\/\/gaconnector.com\/docs\/integrating-ga-connector-livechat\/","title":{"rendered":"Integrating GA Connector with LiveChat"},"content":{"rendered":"<h4><em>Add Google Analytics data to LiveChat with GA Connector\u2019s LiveChat integration.<\/em><\/h4>\n<p>To integrate LiveChat with GA Connector, you&#8217;ll need to add a custom script to your website depending on which GA Connector version you have. If you&#8217;re using Salesforce, Zoho CRM, Pipedrive CRM, Salesflare, or Close CRM you&#8217;re likely using our API-based integration. For all other CRMs&#8217; please use the Cookie-based integration script.<\/p>\n<p><strong>Cookie-based Integration<\/strong><\/p>\n<pre class=\"lang:default decode:true\">&lt;script type=\"text\/javascript\"&gt;\r\nvar LC_API = LC_API || {};\r\nLC_API.on_after_load = function() {\r\ncookieValues = gaconnector.getCookieValues();\r\nvar custom_variables = Object.keys(cookieValues).map( function(fieldName) {\r\nreturn { name: fieldName, value: cookieValues[fieldName] };\r\n});\r\nLC_API.set_custom_variables(custom_variables);\r\n};\r\n&lt;\/script&gt;<\/pre>\n<p><strong><br \/>\nAPI-based Integration<\/strong><\/p>\n<pre class=\"lang:default decode:true\">&lt;script&gt;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&amp;&amp;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);\r\n&lt;\/script&gt;\r\n<\/pre>\n<p><strong>Note:<\/strong> Make sure to\u00a0put it somewhere below GA Connector and Livechat script code.<\/p>\n<p>As a result of adding the script, your Livechat visitors (in the back-end) will contain GA Connector data.<\/p>\n<p>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).<\/p>\n<h2>FAQ<\/h2>\n<p><strong>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?<\/strong><\/p>\n<p><strong>Answer:<\/strong> Please use the <a href=\"https:\/\/support.google.com\/tagmanager\/answer\/6238868\">tag sequencing<\/a> functionality provided by Google Tag Manager:<\/p>\n<figure id=\"attachment_1114\" aria-describedby=\"caption-attachment-1114\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-large wp-image-1114\" src=\"https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9-700x392.png\" alt=\"Tag sequencing\" width=\"700\" height=\"392\" srcset=\"https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9-700x392.png 700w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9-300x168.png 300w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9-768x430.png 768w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9-60x34.png 60w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9-150x84.png 150w, https:\/\/gaconnector.com\/docs\/wp-content\/uploads\/2017\/05\/40cb318964cf6fe06446aa837c5bdda9.png 864w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption id=\"caption-attachment-1114\" class=\"wp-caption-text\">Tag sequencing<\/figcaption><\/figure>\n<p>It allows setting the script from the article to fire after GA Connector.<\/p>\n<p>Just configure it so that:<\/p>\n<ul>\n<li>Livechat\u00a0tag fires after GA Connector.<\/li>\n<li>This script fires after Livechat.<\/li>\n<\/ul>\n<h2>More than just UTM parameters<\/h2>\n<p>GA Connector adds UTM information, geolocation, referral information to your LiveChat leads.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add Google Analytics data to LiveChat with GA Connector\u2019s LiveChat integration. To integrate LiveChat with GA Connector, you&#8217;ll need to add a custom script to your website depending on which GA Connector version you have. If you&#8217;re using Salesforce, Zoho CRM, Pipedrive CRM, Salesflare, or Close CRM you&#8217;re likely using our API-based integration. For all [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,32,16],"tags":[],"_links":{"self":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/2914"}],"collection":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/comments?post=2914"}],"version-history":[{"count":11,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/2914\/revisions"}],"predecessor-version":[{"id":3178,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/posts\/2914\/revisions\/3178"}],"wp:attachment":[{"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/media?parent=2914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/categories?post=2914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gaconnector.com\/docs\/wp-json\/wp\/v2\/tags?post=2914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}