Chatbot tracking in Adobe analytics

If you like to track chatbot activity into analytics what chatbot events should we considered. Each of the chat applications come with some set reporting. But those report can be exposed outside for platforms where you can see the customer journey and web/apps activity with chat activity. In this post I am going to talk about what chat event should expose via analytics.

Chat entry:

  • Initiation by customer: clicking buttons/links
  • Initiation by rules: proactively asking for chat

Chatbot:

  • Chat start: chatbot process initialize
  • Chat interactive: response from both party received
  • Chat intend changes: while chatting with customer chatbot is changing its intend to understand customer needs.
  • (pass it to assisted channel): when chat bot can’t process the request passing it to assisted channel
  • End Chat: end of the chat with chatbot

Assisted chat (if exist)

  • Assisted chat start: where chatbot is initiated a handover to assited
  • Assisted chat interactive: an agent is assigned and responses from both party received
  • Assisted chat end: end of the assisted chat

Leave feedback:

  • Feedback start: start of the feedback form
  • Feedback complete: feedback received

How the tracking function should look like?

chatbot

chatIdchatEventchatLocationchatIntend
Chat startYstartY
Chat interactiveYinteractiveY
Chat intend changedYintend-changedYIntend details
Chat endedYendedY

assisted

chatIdchatEventchatLocationchatAssistedIdchatAssistedDetails*
Chat assisted startyassisted-starty
Chat assisted interactiveyinteractiveyyy
Chat assisted endedyendedyyy

feedback

chatIdchatEventchatLocationchatAssistedId
Leave feedbackyfeedback-startyo
Feedback completeyfeedback-endyo

assisted channels additional information is called about the agent

"chatAssistedDetails":"chatbot:assisted-interactive:<session Id>:<assisted session Id>:<agent skill>:<agent id>:<agent name>"
"chatAssistedDetails":"chatbot:assisted-ended:      <session Id>:<assisted session Id>:<agent skill>:<agent id>:<agent name>"

example chatbot analytics function written for Adobe analytics

s.w_trackChatBot = function (evt, args) {
	// this function is called directly by chatbot api hook
	var eTarg = s.w_getEvtTrgt(evt),
		events ='',
		analyticsVar ='',
		argsObj = args || {},
		chatId = argsObj.chatId||'',
		chatAssistedId = argsObj.chatAssistedId||'',
		chatIntend =  argsObj.chatIntend ||'',
		chatAssistedDetails = argsObj.chatAssistedDetails ||'',
		//detail = util.lowerCase(argsObj.detail, 1),
		chatevent = util.lowerCase(argsObj.chatEvent, 1),
		chatLoc = util.lowerCase(argsObj.chatLocation, 1)
	; // details passed from chatbot api
	if (chatevent ==='start'){
		events = 'event88' + (chatId ? ':'+chatId:'');
	}else if (chatevent ==='interactive'){
		events = 'event89' + (chatId ? ':'+chatId:'');
	}else if (chatevent ==='intend-changed'){
		events = 'event90';
		analyticsVar = analyticsVar + (chatIntend ? ',prop73':'');
		s.prop73 = 'chatbot:intend:' + chatIntend;
	}else if (chatevent ==='ended'){
		events = 'event91' + (chatId ? ':'+chatId:'');
	}else if (chatevent ==='assisted-start'){
		events = 'event92' + (chatId ? ':'+chatId:'');
		analyticsVar = analyticsVar + (chatAssistedId ? ',prop72':'') + (chatAssistedDetails ? ',prop71':'');
		s.prop72 = 'chatbot:assisted-start:' + chatAssistedId;
		s.prop71 = 'chatbot:assisted-start:' + util.lowerCase(chatAssistedDetails,1);
	}else if (chatevent ==='assisted-interactive'){
		events = 'event93' + (chatId ? ':'+chatId:'');
		analyticsVar = analyticsVar + (chatAssistedId ? ',prop72':'') + (chatAssistedDetails ? ',prop71':'');
		s.prop72 = 'chatbot:assisted-interactive:' + chatAssistedId;
		s.prop71 = 'chatbot:assisted-interactive:' + util.lowerCase(chatAssistedDetails,1);
	}else if (chatevent ==='assisted-ended'){
		events = 'event94' + (chatId ? ':'+chatId :'');
		analyticsVar = analyticsVar + (chatAssistedId ? ',prop72':'') + (chatAssistedDetails ? ',prop71':'');
		s.prop72 = 'chatbot:assisted-ended:' + chatAssistedId;
		s.prop71 = 'chatbot:assisted-ended:' + util.lowerCase(chatAssistedDetails,1);
	}else if (chatevent ==='feedback-start'){
		events = 'event95' + (chatId ? ':'+chatId:'');
		analyticsVar = analyticsVar + (chatAssistedId ? ',prop72':'');
		s.prop72 = 'chatbot:feedback-start:' + chatAssistedId;
	}else if (chatevent ==='feedback-ended'){
		events = 'event96' + (chatId ? ':'+chatId:'');
		analyticsVar = analyticsVar + (chatAssistedId ? ',prop72':'');
		s.prop72 = 'chatbot:feedback-ended:' + chatAssistedId;
	}
	s = s_gi(s_account);
	s.events = 'event69,'+events;
	s.linkTrackEvents = 'event69,'+(events.replace(/\:.*/,''));
	s.linkTrackVars = s.w_ltv + analyticsVar +',eVar54,prop54,eVar74,events';
	s.eVar54 = 'chatbot:' + chatevent;
	s.prop54 = 'chatbot:' + chatLoc;
	s.eVar74 = util.lowerCase(chatId, 1);
	s.tl(eTarg || true, 'o', 'interaction:chatbot:' + chatLoc); 
};

Note

Some events are serialized with chat session id or assisted session id. This removes duplication of the events.