Title

Adding Google Analytics Click Tracking to Buttons

You can monitor LiveEngage events that can occur on the visitor side by using the lpTag.events.bind() function.

 

If you want to send LiveEngage events to your Google Analytics dashboard you need to do the following:

 

  1. Make sure that you are using the embedded chat window. These events will not work with the pop out chat window.

  2. Make sure that your Google Analytics tracking code is loaded on the page *before* the LivePerson monitor tag. As long as the LivePersn Monitor tag is below your Google Analytics tracking code you should be good.

 

With the below code, every time a visitor accepts a LiveEngage engagement you can send that event data to Google Analytics. Place this event binding code in your source code beneath both the LP monitor tag and the Google Analytics code.

 

<script>

 

lpTag.events.bind("LP_OFFERS", "OFFER_CLICK", function(eventData,eventInfo){

 

// Log data to console for debugging

 

if(window.console && window.JSON){ console.log("Campaign ID: " + JSON.stringify(eventData.campaignId) + "\tEngagement ID: " + JSON.stringify(eventData.engagementId) + "\ntriggered by: " + JSON.stringify(eventInfo)); }

 

// Send data to GA

 

ga('send', 'event', 'OFFER_CLICK', 'LP_OFFERS', eventData.engagementId); });

 

</script>

 

 

Below is a similar example using some Omniture event sending.

 

<script>

 

lpTag.events.bind("LP_OFFERS", "OFFER_CLICK", function(eventData,eventInfo){

 

// Log data to console for debugging

 

if(window.console && window.JSON){ console.log("Campaign ID: " + JSON.stringify(eventData.campaignId) + "\tEngagement ID: " + JSON.stringify(eventData.engagementId) + "\ntriggered by: " + JSON.stringify(eventInfo)); }

 

// Send data to Omniture

 

s.eVar27 = s.pageName; alertOmniture(eventData,'Chat Initiated','events,eVar27','event20'); });

 

</script>

 

Was this article helpful?