Google Analytics and Instant Service Live Chat Integration


Web Analytics integrations are often the most challenging part of web analyst job. The benefits of analytics integration are huge but when the rubber hits the road things get messy. If done correctly, web analytics integrations can close the campaign attribution gap. You can get all the data you need to effectively optimize website and campaign performance.

In this post, we will discuss the end to end integration of Google Analytics (GA) with Instant Service (IS) live chat solution. Integrating a chat tool with an analytics solutions can provide you all the chat conversion data in the analytics reports.

ScreenHunter 03 Mar. 09 14

Instant service (IS) is one of the fastest growing live chat solution and their default setup does not capture on page data. You will not be able to identify the pages, campaigns or referral that lead to chat. Instant service reports will only provide you with the post chat start data. Interestingly, the chat solution is designed for quick and easy analytics integration.

Step#1. Requirements

GA provides three options for custom variables i.e. page-level, session-level and visitor level. We will be using three GA session-level custom variables and trackpageview function for the integration. Session-level custom variable will allow us to track chat metrics per visitor session. There are no special requirements as such on the IS software except you will need admin level access to your account.

ga custom variable


Step#2. Metrics / Events Setup

We will be tracking the following events & metrics inside of GA through this integration.

  • Invitation offered – Number of times the chat popup was offered to your site visitor.
  • Invitation accepted (proactive chat) – Number of time the chat was accepted by the visitor.
  • Invitation declined – Number of time the chat was declined by the visitor.
  • On page chat clicks (requested chat) – Number of time the chat was started by clicking a chat button on the website
  • Referring url (IS_referrer) – Referring url of the chat visitor
  • Page name (IS_pagename) – URL of the page where chat started.


Step#3. Code and scripts Installation

To begin with, you do not have to be a programmer to write the codes for this integration. Below is the list of all the codes you will need to capture the data.

a. URL parsing scripts – These are php scripts that allow you to capture the referring url and page name for any page on your website. The captured data is stored in variables and later copied into GA custom variables when chat events are triggered. These scripts should be added anywhere between the <body></body> area on each webpage or inside the include file.



$IS_referrer = getenv(“HTTP_REFERER”);

echo $IS_referrer;


(script to capture referring url)



function IS_pagename() {

return substr($_SERVER[“SCRIPT_NAME”],strrpos($_SERVER[“SCRIPT_NAME”],”/”)+1);


echo “The current page name is “.IS_pagename();


(script to capture page name)


b. Reactive Chat script (capture click based chat data) -The script below when added to the website will allow you to capture reactive (click based) chat data in GA. When a web visitor clicks the chat button the clicks will be registered as a page view in GA.

Notice how we are passing the page name (IS_pagename) and referring url (IS_referrer) to GA custom variable. This will allow us to link the web data to the chat metrics.

<script >

function track_chat_button()


var s=s_gi(s_account);


pageTracker._setCustomVar(1, IS_pagename, IS_pagename, 2);

pageTracker._setCustomVar(2, IS_referrer, IS_referrer, 2);


function agents_not_available()


document.getElementById(‘smartbutton’).innerHTML =

‘<a href= “” MsoNormal” style=”margin-bottom: 0.0001pt; line-height: normal;”>’return false;”><img src=””></a>’;

return true;


function agents_available()


document.getElementById(‘smartbutton’).innerHTML =

‘<img src=””>’;

return true;


document.write(‘<img src=”’ +

‘/YOUR ACCOUNT ID/DIVISION ID/available.gif?’ + Math.floor(Math.random()*10001) +

‘”style=”width:0;height:0;visibility:hidden;position:absolute;”‘ +

‘onLoad=”agents_available()” >’);



c. Proactive chat script (capture popup based chat data) – The proactive chat codes should be added in the custom java script section of IS admin console.

ScreenHunter 03 Mar. 23 11

Invitation offered – Number of times the chat popup was offered to your site visitor.

function ii_executeOfferedEvent(param1, param2, param3)

Invitation accepted (proactive chat) – Number of time the chat was accepted by the visitor.


function ii_executeAcceptedEvent(param1, param2, param3)

Invitation declined – Number of time the chat was declined by the visitor.

function ii_executeDeclinedEvent(param1, param2, param3)

Step#4. Reading Anlaytics Reports

Allow 24 hours for Google Analytics to populate the reports. You will be able to see the data in the following reports.

1. Top content Report

Apply filter page containing = chat to see how many times the invitations were offered, accepted and declined. Using page = page name
custom segment you will be able to see the chat performance for each page on your website.

ScreenHunter 04 Mar. 23 11

2. Custom Variables

Custom reports will provide you all the referring url data associated with each chat event. Using referring url and page name you can optimize the chat popup rules to maximize performance and improve the chat conversions.

ScreenHunter 09 Mar. 23 11

Please share your thoughts, insights and comments because it really helps me write more effectively.

Here is a list of other helpful blog posts on this blog-
Copy My Actionable Google Analytics Advanced Segments Troubleshooting Website Traffic drop with Web Analytics
Top 5 Coolest Web Analytics iPhone Apps

Leave a Reply

2 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
0 Comment authors
Edward JeanOffline Analytics: Measuring Success of Offline Campaigns Recent comment authors
newest oldest most voted
Notify of

[…] and campaigns? It is pretty easy to measure the success of online campaigns with analytics and analytics integrations but measuring offline conversion is […]

Edward Jean
Edward Jean

I have been using live2support and it sits very well with my GA account. The activities of my live chat software are imported to my Google analytics account on automated basis. One can know more on it at below URL:-