To push GA Connector data to Intercom, all you need to do is to add this line of JavaScript code to GA Connector tracking code:
1 |
Intercom('update', gaFields); |
You need to add it right after “var gaFields = gaconnector.getCookieValues();” like shown below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<script type="text/javascript" src="https://tracker.gaconnector.com/gaconnector.js"></script> <script> function setGaconnectorHiddenFields() { var gaFields = gaconnector.getCookieValues(); Intercom('update', gaFields); for (var fieldName in gaFields) { var selectors = 'form input[name="' + fieldName + '"], form input#' + fieldName + ', form input#field_' + fieldName + ', form input[name="' + fieldName.toLowerCase() + '"], form input#' + fieldName.toLowerCase() + ', form input#field_' + fieldName.toLowerCase() + ', input[value="gaconnector_' + fieldName +'"]'; var inputs = document.querySelector(selectors); if (inputs === null) { continue; } else if (typeof inputs.length === 'undefined') { inputs.value = gaFields[fieldName]; jQuery(document).ready(function() { jQuery(inputs).trigger('change'); }); } else { for (var i = 0; i < inputs.length; i++) { inputs[i].value = gaFields[fieldName]; jQuery(document).ready(function() { jQuery(inputs).trigger('change'); }); } } } } setGaconnectorHiddenFields(); gaconnector.setCallback(setGaconnectorHiddenFields); setInterval(setGaconnectorHiddenFields, 1000); </script> |
As a result, you’ll see GA Connector data in the right section of […]