To add Google Analytics to Text Us button, please follow the below instructions.
Please choose one of the following options.
Option 1:
Add the below function to any JS file loaded by the Home Page, after the Google Analitics tracking code :
function textUsClickCallBack(){
if (typeof ga !== 'undefined') {
ga('send', 'event', 'TextUs', 'clicked', window.location.href);
}else if(typeof _gaq !== 'undefined') {
_gaq.push(['_trackEvent', 'TextUs', 'Clicked through to TextUs']);
}
}
function chatUsClickCallBack(){
if (typeof ga !== 'undefined') {
ga('send', 'event', 'ChatUs', 'clicked', window.location.href);
}else if(typeof _gaq !== 'undefined') {
_gaq.push(['_trackEvent', 'ChatUs', 'Clicked through to ChatUs']);
}
}
function emailUsClickCallBack(){
if (typeof ga !== 'undefined') {
ga('send', 'event', 'EmailUs', 'clicked', window.location.href);
}else if(typeof _gaq !== 'undefined') {
_gaq.push(['_trackEvent', 'EmailUs', 'Clicked through to EmailUs']);
}
}
Option 2:
Add the below code to the Home Page after the Google Analitics tracking code.
<script type="text/javascript">
function textUsClickCallBack(){
if (typeof ga !== 'undefined') {
ga('send', 'event', 'TextUs', 'clicked', window.location.href);
}else if(typeof _gaq !== 'undefined') {
_gaq.push(['_trackEvent', 'TextUs', 'Clicked through to TextUs']);
}
}
function chatUsClickCallBack(){
if (typeof ga !== 'undefined') {
ga('send', 'event', 'ChatUs', 'clicked', window.location.href);
}else if(typeof _gaq !== 'undefined') {
_gaq.push(['_trackEvent', 'ChatUs', 'Clicked through to ChatUs']);
}
}
function emailUsClickCallBack(){
if (typeof ga !== 'undefined') {
ga('send', 'event', 'EmailUs', 'clicked', window.location.href);
}else if(typeof _gaq !== 'undefined') {
_gaq.push(['_trackEvent', 'EmailUs', 'Clicked through to EmailUs']);
}
}
</script>