Chapter 6. Sample Code. IBM Android SDK
Tealeaf Android SDK is a software development kit that enables you to capture user interface and application events from your Android-enabled devices. The SDK allows you to collect data on how users interact with your application and use this information to improve your user experience, optimize your app performance, and troubleshoot any issues that may arise.
Advertisement
Advertisement
Chapter 6. Sample Code
This chapter contains sample code for IBM Tealeaf Android SDK.
How to instrument TextView based controls
Because TextView based controls are used for text fields, to get dwell time and other data you instrument the OnFocusChangeListener to know when a user starts and completes typing.
// Get TextView based control final EditText nameEditText = (EditText) findViewById(R.id.nameEditText);
// Create a OnFocusChangeListener
OnFocusChangeListener focusListen = new OnFocusChangeListener () { public void onFocusChange(View view, boolean hasFocus){ if(hasFocus == false){
Tealeaf.logEvent(view, Tealeaf.TLF_ON_FOCUS_CHANGE_OUT);
} else{
Tealeaf.logEvent(view, Tealeaf.TLF_ON_FOCUS_CHANGE_IN);
}
}
});
// Set OnFocusChangeListener on TextView based control nameEditText.setOnFocusChangeListener(focusListen);
// Register TextView based control
Tealeaf.registerFormField(nameEditText, this);
How to instrument ExpandableListView based controls
For ExpandableListView controls, in order to know when a user expands or collapses a control you instrument the OnGroupCollapseListener and
OnGroupExpandListener.
// Get ExpandableListView based control final ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv); elv.setOnChildClickListener(new OnChildClickListener() { public boolean onChildClick(ExpandableListView parent, View view,
int groupPosition, int childPosition, long id) {
Tealeaf.logEvent(view); return true;
}
}); elv.setOnGroupCollapseListener(new OnGroupCollapseListener() { public void onGroupCollapse(int groupPosition) {
Tealeaf.logEvent(elv, Tealeaf.TLF_ON_GROUP_COLLAPSE);
}
}); elv.setOnGroupExpandListener(new OnGroupExpandListener(){ public void onGroupExpand(int groupPosition) {
Tealeaf.logEvent(elv, Tealeaf.TLF_ON_GROUP_EXPAND);
}
});
© Copyright IBM Corp. 1999, 2015
125
How to instrument SlidingDrawer based controls
For SlidingDrawer controls, to know when a user opens or closes a control you instrument the OnDrawerOpenListener and OnDrawerCloseListener.
// Get SlidingDrawer based control final SlidingDrawer sd = (SlidingDrawer) findViewById(R.id.sd); sd.setOnDrawerOpenListener(new OnDrawerOpenListener() { public void onDrawerOpened(){
Tealeaf.logEvent(slidingDrawer_c5, Tealeaf.TLF_ON_DRAWER_OPENED);
}
}); sd.setOnDrawerCloseListener(new OnDrawerCloseListener(){ public void onDrawerClosed(){
Tealeaf.logEvent(slidingDrawer_c5, Tealeaf.TLF_ON_DRAWER_CLOSED);
}
});
How to mask controls
Custom masking is a feature that matches specified IDs and regular expressions and then does character substitutions. In the example that follows, custom masking converts actual values to the letters that are supplied as replacements. If custom masking is set to false, it returns an empty string. You specify masking in the
TLFConfigurableItem.properties
file that is in the assets folder of the Android application.
#Masking settings
HasMasking=true
#It can be a series of ids and regular expressions comma delimited
MaskIdList=com.tealeaf.sp:id\/EditText*,com.tealeaf.sp:id\/login.password
#If set to false it will return an empty string
HasCustomMask=true
#It will turn small letters to value given
SensitiveSmallCaseAlphabet=x
#It will turn capital letters to value given
SensitiveCapitalCaseAlphabet=X
#It will turn symbols to value given
SensitiveSymbol=#
#It will turn digits to value given
SensitiveNumber=9
Server-Side KillSwitch Sampling Function
When the KillSwitch feature is enabled in the client configuration, the Framework queries the KillSwitch URL to determine whether to enable or disable the framework for that session. The KillSwitch URL can be .aspx, .jsp or .php.
If the Android logging framework is disabled, then the session is not captured and is excluded from the sampled data.
The KillSwitch URL returns 1 to enable the Framework and 0 to disable the
Framework. Each KillSwitch URL has a corresponding web.config configuration file.
Sampling function examples for ASPX
These examples show the killswitch.aspx and web.config configuration file for
ASPX
126
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
Example killswitch.aspx
This example shows the killswitch.aspx:
<%@ Page Language="C#" AutoEventWireup="true"%>
<script runat="server"> public int Sampler()
{
Random rand = new Random(); int nextRandom = rand.Next(1,100); int samplepercent = Convert.ToInt32(ConfigurationManager.AppSettings
["rate"]); if(nextRandom <= samplepercent){ return 1;
} else{ return0;
}
}
</script>
<% if (ConfigurationManager.AppSettings["killswitchtype"].Equals
("percentagesample")) {
%>
<%= Sampler() %>
<% } else { } %>
Example web.config configuration file for ASPX
This example shows the web.config configuration file for the killswitch.aspx:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="killswitchtype" value="percentagesample"/>
<add key="rate" value="50"/>
</appSettings>
</configuration>
Sampling Function for JSP
These examples show the killswitch.jsp and web.config configuration file for JSP.
For the JSP, if the: v request does not have parameters, then the client framework is always disabled.
v id request parameter exists, it is used to check the whitelist.
v randomsample parameter exists, the percentage rate from the config.properties
file is used to determine how the server responds.
Example killswitch.jsp
This example shows the killswitch.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.Properties"%>
<%@page import="java.util.Date" %>
<%@ page import="java.net.*"%>
<%@ page import="java.io.*" errorPage=""%>
Chapter 6. Sample Code
127
<%
InputStream stream = application
.getResourceAsStream("/config.properties");
Properties props = new Properties(); props.load(stream);
Boolean DEBUG = false;
DEBUG = ("true").equals(props.getProperty("debug"));
String id = request.getParameter("id");
String randomsample = request.getParameter("randomsample");
String killSwitchResponse = "";
String debugstr = "";
// white list if (id != null && !id.isEmpty()) {
InputStream whitestream = application.getResourceAsStream(props
.getProperty("WhiteListFile"));
BufferedReader input = new BufferedReader( new InputStreamReader(whitestream));
String line = "";
Boolean match = false; while ((line = input.readLine()) != null) { line = line.trim(); if (line.equals(id)) { killSwitchResponse = "1"; match = true; break;
}
} input.close(); if (!match) { killSwitchResponse = "0";
}
}
// If kill switch is by sample rate else if (randomsample != null) { int rand = (int) (Math.random() * 100); int sampleRate = Integer.parseInt(props
.getProperty("samplerate")); if (rand <= sampleRate) { killSwitchResponse = "1";
} else { killSwitchResponse = "0";
}
} else { killSwitchResponse = "0";
} out.print(killSwitchResponse);
//always give the path from root. This way it almost always works.
String nameOfTextFile = props.getProperty("logfile");
PrintWriter pw; if (DEBUG) { try { pw = new PrintWriter(new FileOutputStream(nameOfTextFile, true));
Date date = new java.util.Date(); debugstr = date.toString() + "\t"; if (request.getQueryString() != null) { debugstr += request.getQueryString();
} if("0".equals(killSwitchResponse)) else pw.println(debugstr + "\tDisable");
128
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
pw.println(debugstr + "\tEnable");
//clean up pw.close();
} catch (IOException e) { out.println(e.getMessage());
}
%>
}
Example web.config
configuration file
This example shows the web.config configuration file for the killswitch.jsp:
WhiteListFile=whitelist.txt
samplerate =50 debug=true logfile=/killswitchlog.txt
Sampling Function for PHP
These examples show the killswitch.php and web.config configuration file for
PHP.
Example killswitch.php
This example shows the killswitch.php:
<?php
$ini_array = parse_ini_file("config.ini", true);
//print_r($ini_array);
// if sample by percent if($ini_array[’configtype’][’killswitchtype’] === ’percentagesample’){
$sampleRate = intval($ini_array[’percentagesample’][’rate’]); killbysamplerate($sampleRate);
}
// if sample by whitelist else {
}
?>
} function killbysamplerate($sampleRate){
$randomnumber = rand(1,100); if($randomnumber <= $sampleRate){ echo ’1’;
} else { echo ’0’;
}
} function killbywhitelist($whitelistpath){
Example web.config
configuration file
This example shows the web.config configuration file for the killswitch.php:
; This is a sample configuration file
; Comments start with ’;’, as in php.ini
[configtype] killswitchtype=percentagesample
Chapter 6. Sample Code
129
[percentagesample] rate = 50 y z
[whitelist] x
JSON message type schemas and examples
JSON messages are categorized by type for processing. Tealeaf supports 12 JSON message types.
Message header properties
All messages contain message header properties consisting of two properties that contain the message type and the time that is offset from the start of the session in milliseconds. All time measurements in the JSON object schema are in milliseconds.
Message list
This table lists and describes the supported JSON message types:
Table 31. Schema by Message Type
Type
1
2
3
4
5
6
7
8
9
10
11
Message Type
“Overstat Hover Event (Type 9) messages” on page 144
“Layout (Type 10) messages” on page 144
“Gesture (Type 11) messages” on page 147
Description
“Client state (Type 1) messages” on page 132
“ScreenView (Type 2) messages” on page 134
“Connections (Type 3) messages” on page 136
Any object that shows the current state of client.
Any message that indicates changes in view on the "screen". The "screen" is the page, view, or activity where the visitor is in the application.
Any request or response that the application performs during capture.
“Control (Type 4) messages” on page
User interface control that fires an event to which Tealeaf listens for capture.
“Custom Event (Type 5) messages” on page 140
“Exception (Type 6) messages” on page 141
“Performance (Type 7) messages” on page 142
Any custom log event from any location in application.
Any exception that the application can throw.
Performance data from a browser.
“Web Storage (Type 8) messages” on page 143
Any object that contains information about local storage information on the browser.
Any object that contains information about mouse hover and hover-to-click activity.
Any message that shows the current display layout of a native page.
Any message that shows a gesture that fires a higher touch event that
Tealeaf listens to for capture.
130
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
Table 31. Schema by Message Type (continued)
Type
12
13
Message Type
“DOM Capture (Type 12) message example” on page 159
“GeoLocation (Type 13) messages” on page 161
Description
Any object that contains serialized
HTML data (DOM snapshot) of the page.
Messages that contain the geolocation information about the device.
Message header properties
All messages contain message header properties consisting of two properties that contain the message type and the time that is offset from the start of the session in milliseconds.
All time measurements in the JSON object schema are in milliseconds.
Message header properties schema
This example shows the schema for the JSON message headers.
"offset": {
"title": "Milliseconds offset from start of stream",
"type": "integer",
"required": true
},"screenViewOffset": {
"title": "Milliseconds offset from start of ScreenView",
"type": "integer",
"required": true
},"count": {
"title": "The number of the message being sent",
"type": "integer",
"required": only used for UIC
},"fromWeb": {
"title": "Used to identify if it came from Web or Native application",
"type": "boolean",
"required": true
},"webviewId": {
"title": "Used to identify which webview it came from. This is only used when fromWeb is true and it is a hybrid application ",
"type":"string",
"required": true only when fromWeb is true and it is a hybrid application
},"type": {
"title": "Message header type",
"type": [ {
"enum": [1], description: "CLIENT_STATE"
},
"enum": [2], description: "APPLICATION_CONTEXT"
}],
"enum": [3], description: "CONNECTION"
},
"enum": [4], description: "CONTROL"
},
"enum": [5], description: "CUSTOM_EVENT"
}],
"enum": [6],
Chapter 6. Sample Code
131
}, description: "EXCEPTION"
}],
"required": true
Client state (Type 1) messages
Client state messages are delivered on a schedule basis or on changes to the environment state on the client. These are Type 1 JSON messages.
Note:
Replay of client state messages is not supported, except for scroll events.
Replay of scroll events that are captured from the client is supported for mobile sessions only in BBR only. See Search and Replay for Mobile Web.
Client State (Type 1) message schema
This is the schema for the Client State (Type 1) messages.
{
"$ref" : "MessageHeader",
"mobileState": {
"description": "Logical page being loaded for iOS and Android",
"type": "object",
"properties": {
"orientation": {
"title": "Current orientation of the device",
"type": "integer",
"required": true
},
"freeStorage": {
"title": "Amount of available storage in Mbytes",
"type": "number",
"required": true
},
"androidState": {
"description": "Current state in an Android device",
"type": "object",
"properties": {
"keyboardState": {
"title": "Current keyboard state",
"type": [ {
"enum": [0], description: "Keyboard not hidden"
},
"enum": [1],
},
}
},
"battery": { description: "Keyboard hidden"
},
"enum": [2], description: "Undefined"
}],
"required": true
"title": "Battery level from 0 to 100",
"type": "number",
"required": true
},
"freeMemory": {
"title": "Amount of available memory in Mbytes",
"type": "number",
"required": true
},
"connectionType": {
"title": "Current connection type",
"type": "string",
132
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
"required": true
},
"carrier": {
"title": "Carrier of device",
"type": "string",
"required": true
},
"networkReachability": {
"title": "Current network reachability",
"type": [ {
"enum": [0], description: "Unknown"
},
"enum": [1], description: "NotReachable"
},
"enum": [2], description: "ReachableViaWIFI"
},
"enum": [3], description: "ReachableViaWWAN"
}],
"required": true
},
"ip": {
"title": "Ip address of device",
"type": "string",
"required": true
}
},
"additionalProperties" : false
"clientState": {
"description": "Logical web page being loaded for UIC",
"type": "object",
"properties": {
"pageWidth": {
"title": "Width of the document of the web page",
"type": "integer",
"required": true
},
"pageHeight": {
"title": "Height of the document of the web page",
"type": "integer",
"required": true
},
"viewPortWidth": {
"title": "Width of viewport",
"type": "integer",
"required": true
},
"viewPortHeight": {
"title": "Height of viewport",
"type": "integer",
"required": true
},
"viewPortX": {
"title": "x position of scrollbar on viewport",
"type": "integer",
"required": true
},
"viewPortY": {
"title": "y position of scrollbar on viewport",
"type": "integer",
"required": true
},
"event": {
"title": "event that triggered the client state",
Chapter 6. Sample Code
133
}
"type": "string",
"required": true
},
"deviceScale": {
"title": "scaling factor for fitting page into window for replay",
"type": "integer",
"required": true
},
"viewTime": {
"title": "time in milliseconds user was on the event triggered",
"type": "integer",
"required": true
},
"viewPortXStart": {
"title": "initial start x position of scrollbar on viewport",
"type": "integer",
"required": only used in scroll events
},
"viewPortYStart": {
"title": "initial start y position of scrollbar on viewport",
"type": "integer",
"required": only used in scroll events
},
},
"additionalProperties" : false
}
Client State (Type 1) message example
This is an example of a Client State (Type 1) message. This example comes from an
Android native application.
{
"offset": 667,
"screenViewOffset": 4556,
"type": 1,
"mobileState": {
"orientation": 0,
"freeStorage": 33972224,
"androidState": {
"keyboardState": 0
},
"battery": 50,
"freeMemory": 64630784,
"connectionType": "UMTS",
"carrier": "Android",
"networkReachability": "ReachableViaWWAN",
"ip": "0.0.0.0"
}
}
ScreenView (Type 2) messages
ScreenView messages indicate steps in a visitor's experience with your application.
These steps can be logical page views in a web application, screen changes in a mobile application, or steps in a business process. ScreenView messages are Type 2
JSON messages.
In Release 8.5 and earlier, these messages were called Application Context messages.
ScreenView (Type 2) message schema
This is the schema for the ScreenView (Type 2) JSON messages.
134
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
{
"$ref" : "MessageHeader",
"dcid": {
"title": "Unique identifier that is used to match the corresponding
DOM Capture message associated with this message.",
"type": "string",
"required": false
},
"screenview/context": {
"description": "Logical page being loaded or unloaded",
"type": "object",
"properties": {
"type": {
"title": "Type of application context - LOAD or UNLOAD",
"type": "string",
"required": true
},
"name": {
"title": "Name of the logical page. This is given by customer or it uses name of the class used by the page.",
"type": "string",
"required": true
},
"url": {
"title": "URL path of the logical page",
"type": "string",
"required": false only used in UIC
},
"host": {
"title": "URL Host of the logical page",
"type": "string",
"required": false only used in UIC
},
"referrer": {
"title": "Previous logical page loaded, only used in LOAD",
"type": "string",
"required": false
},
"referrerUrl": {
"title": "Url of the previous logical page loaded",
"type": "string",
"required": false, not used in UIC
}
},
"additionalProperties" : false,
"required": false
}
}
ScreenView (Type 2) message example
This is an example of a ScreenView (Type 2) message. This example contains three
ScreenView messages, indicating page load and page unload events.
{
"offset": 124,
"contextOffset": 4556,
"type": 2,
"context": {
"type": "LOAD",
"name": "PAGE 2",
"referrer": "PAGE 1"
}
}
{
Chapter 6. Sample Code
135
"type": 2,
"offset": 19216
"context": {
"type": "UNLOAD",
"name": "PAGE 2"
}
}
{
"type": 2,
"offset": 2144,
"contextOffset": 0,
"count": 9,
"fromWeb": true,
"webviewId": "webview1",
"screenview": {
"type": "LOAD",
"name": "Ford",
"url": "/dynamic/ford.aspx",
"host": "http://www.cartest.com",
"referrer": "BMW",
"referrerUrl": "/dynamic/bmw.aspx"
}
}
Connections (Type 3) messages
Connection messages provide information about how requests or responses are managed by the client application. Connections messages are Type 3 JSON messages.
Connections (Type 3) messages schema
This is the schema for Connections (Type 3) JSON messages.
{
"$ref" : "MessageHeader",
"connection": {
"description": "Connection in application",
"type": "object",
"properties": {
"statusCode": {
"title": "Status code of connection",
"type": "integer",
"required": true
},
"responseDataSize": {
"title": "Response data size",
"type": "number",
"required": true
},
"initTime": {
"title": "Initial time of connection",
"type": "number",
"required": true
},
"responseTime": {
"title": "Response time of connection",
"type": "number",
"required": true
},
"url": {
"title": "Url of connection",
"type": "string",
"required": true
136
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
},
"loadTime": {
"title": "Load time from connection",
"type": "number",
"required": true
}
},
"additionalProperties" : false
}
}
Connections (Type 3) message example
This example shows the Connections (Type 3) JSON message.
{
"offset": 03829,
"type": 3,
"screenViewOffset": 45560,
"type": 3,
"connection": {
"statusCode": 200,
"responseDataSize": 0272,
"initTime": 01333669478556,
"responseTime": 02237,
"url": "http://google.com",
"url": "/store/js/tealeaf/
TeaLeafTarget.php??width=540&height=960&orientation=0",
"loadTime": 0
}
}
Control (Type 4) messages
Control messages are used to log user action and behavior. These messages consist of a control identifier and a value that is returned by the identified control. Control messages are Type 4 JSON messages.
The control identifiers are mapped to specific controls for the submitting client framework. The value can be a number, a text string, or structured data.
Control (Type 4) message schema
This is the schema for Control (Type 4) messages.
The X and Y properties are not present in the UI Capture frameworks.
{
"$ref" : "MessageHeader",
"offset": {
"title": "Milliseconds offset from offset for when focusIn of text fields occur",
"type": "integer",
"required": true
},
"target": {
"description": "Control being logged",
"type": "object",
"properties": {
"position": {
"description": "Position of control being logged",
"type": "object",
"properties": {
"x": {
"title": "X of the control",
"type": "integer",
"required": true
},
Chapter 6. Sample Code
137
"y": {
"title": "Y of the control",
"type": "integer",
"required": true
},
"height": {
"title": "height of control",
"type": "integer",
"required": true
},
"width": {
"title": "width of control",
"type": "integer",
"required": true
},
"relXY": {
"title": "relative X & Y ratio that can be from 0 to 1 with a default value of 0.5",
"type": "string",
"required": true for click events
},
},
"additionalProperties" : false
}
"id": {
"title": "Id/Name/Tag of control",
"type": "string",
"required": true
}, idType": { attribute): -1,
"title": "Indicates what id is based on: Native id (e.g. HTML ’id’ xPath: -2, or Custom attribute for UIC and
Hashcode value for Native: -3, or xPath for Native iOS/Android: -4",
"type": "integer",
"required": true
},
"dwell": {
"title": "Dwell time of control",
"type": "integer value that is in milliseconds",
"required": false
},
"visitedCount": {
"title": "Number of times a form control has been visited to be filled by user.",
"type": "integer",
"required": false
},
"isParentLink": {
"title": "To indicate if control a A type tag",
"type": "boolean",
"required": false only in UIC for usability
},
"name": {
"title": "Name of control",
"type": "string",
"required": true in UIC
},
"type": {
"title": "Type of control",
"type": "string",
"required": true
},
"subType": {
"title": "SubType of control",
"type": "string",
138
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
"required": true
},
"tlType": {
"title": "tlType of control that normalizes the control type for eventing",
"type": "string",
"required": true
},
"prevState": {
"title": "Previous state of control",
"type": "object",
"required": true,
"properties": {
"?": { // Could be any variable name given by developer
"title": "Additional data in string format",
"type": "string",
"required": false
}
},
"currState": {
"title": "Current state of control",
"type": "object",
"required": true,
"properties": {
"?": { // Could be any variable name given by developer
"title": "Additional data in string format",
"type": "string",
"required": false
}
}
},
"additionalProperties" : false
}
"event": {
"description": "Event from control",
"type": "object",
"properties": {
"tlEvent": {
"title": "Tealeaf type of event",
"type": "string",
"required": true
},
"type": {
"title": "Type of event",
"type": "string",
"required": true
},
"subType": {
"title": "Subtype of event",
"type": "string",
"required": true
}
},
"additionalProperties" : false
}
}
Control (Type 4) message example
This is an example of a Control (Type 4) message.
This example shows a control with an idType of XPATH, which means no id was assigned to the control in the application so Tealeaf traversed the layout and created an XPATH id for the control:,
Chapter 6. Sample Code
139
{
},
"screenviewOffset":380,
"target":{
"id":"[KV,0]",
"position":{
"y":331,
"x":0,
"width":320,
"height":202
},
"idType":"-4",
"currState":{
"y":"0",
"x":"0"
},
"style":{
"paddingTop":2,
"textBGAlphaColor":255,
"bgAlphaColor":255,
"paddingBottom":0,
"paddingLeft":0,
"hidden":false,
"paddingRight":0
},
"subType":"View",
"type":"KeyboardView",
"tlType":"keyboard"
},
"type":4,
"offset":728,
"count":3,
"fromWeb":false,
"event":{
"type":"UIKeyboardDidShowNotification",
"tlEvent": "kbDisplayed"
}
Custom Event (Type 5) messages
The Custom Event messages are used to custom log any event from any place in the application. Custom Event messages are Type 5 JSON messages.
Custom Event (Type 5) message schema
This is the schema for the Custom Event (Type 5) messages.
The only required field is the name of the custom event (name value).
Application-specific code must be created to process this logged message type.
{
"$ref" : "MessageHeader",
"customEvent": {
"description": "Custom event message",
"type": "object",
"properties": {
"name": {
"title": "Exception name/type",
"type": "string",
"required": true
},
"data": "Additional properties given by developer",
"type": "object",
"required": truefalse,
"properties": {
"?": { // Could be any variable name given by developer
"title": "Additional data in string format",
140
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
"type": "string",
"required": false
}
},
},
"additionalProperties" : false
}
}
Custom Event (Type 5) message example
This is an example of a Custom Event (Type 5) message. This custom event message provides the name of the custom event (MyEvent_1) and several custom properties in the data section.
{
"type": 5,
"offset": 17981,
"screenViewOffset": 4556,
"customEvent": {
"name": "MyEvent_1",
"data": {
"Foo": "Bar",
"validationError": "Invalid zipcode.",
"ajaxPerformance": 56734
}
}
}
Exception (Type 6) messages
The exceptions messages type records the name and description of an exception occurring on the client application. Exception messages are Type 6 JSON messages.
Exception (Type 6) message schema
This is the schema for the Exception (Type 6) messages.
{
"$ref" : "MessageHeader",
"exception": {
"description": "Exception description message",
"type": "object",
"properties": {
"description": {
"title": "Exception message from api call",
"type": "string",
"required": true
},
"name": {
"title": "Exception name/type",
"type": "string",
"required": true, not for UIC
},
"stackTrace": {
"title": "Exception stacktrace given by framework",
"type": "string",
"required": true, not for UIC
},
"url": {
"title": "Url where exception ocurred",
"type": "string",
"required": true for UIC
},
"fileName": {
"title": "File name where exception ocurred",
"type": "string",
"required": true for iOS, not for UIC
},
Chapter 6. Sample Code
141
"line": {
"title": "Line number where eception occurred.",
"type": "string",
"required": true for UIC and iOS
},
"unhandled": {
"title": "Whether exception had a try catch around it.",
"type": "boolean",
"required": true, not for UIC
},
"data": {
"title": "User defined data being passed with user info from system",
"type": "object",
"required": true for iOS, not for UIC
"properties": {
"userInfo": {
"type": "object",
"title": "OS information from error or exception",
"required": iOS optional (data is JSON serializable or not)
},
"message": {
"type": "string",
"title":"User supplied message on error event",
"required":iOS optional (not on exceptions required on error)
}
},
},
},
"additionalProperties" : false
}
}
Exception (Type 6) message example
This is an example of an Exception (Type 6) message. This example exception indicates an attempt to read a property named 'type' of a variable or value which is undefined.
{
"type" : 6,
"offset" : 4606,
"screenviewOffset" : 4603,
"count" : 3,
"fromWeb" : true,
"exception" : {
"description" : "Uncaught TypeError: Cannot read property ’type’ of undefined",
"url" : "http://www.xyz.com/js/badscript.js",
"line" : 258
}
}
Performance (Type 7) messages
Performance messages show performance data from a browser. Performance messages are Type 7 JSON messages.
Performance (Type 7) message schema
This is the schema for Performance (Type 7) messages.
142
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
{
"$ref" : "MessageHeader",
"performance": {
"description": "Performance message",
"type": "object",
"properties": {
},
"additionalProperties" : false
}
}
Performance (Type 7) message example
This is an example of a Performance (Type 7) message.
{
"type": 7,
"offset": 9182,
"screenviewOffset": 9181,
"count": 3,
"fromWeb": true,
"performance": {
"timing": {
"redirectEnd": 0,
"secureConnectionStart": 0,
"domainLookupStart": 159,
"domContentLoadedEventStart": 2531,
"domainLookupEnd": 159,
"domContentLoadedEventEnd": 2551,
"fetchStart": 159,
"connectEnd": 166,
"responseEnd": 1774,
"domComplete": 2760,
"responseStart": 728,
"requestStart": 166,
"redirectStart": 0,
"unloadEventEnd": 0,
"domInteractive": 2531,
"connectStart": 165,
"unloadEventStart": 0,
"domLoading": 1769,
"loadEventStart": 2760,
"navigationStart": 0,
"loadEventEnd": 2780,
"renderTime": 986
}
},
"navigation": {
"type": "NAVIGATE",
"redirectCount": 0
}
}
Web Storage (Type 8) messages
Web Storage messages are any objects that contain information about local storage information on the browser. Web Storage messages are Type 8 JSON messages.
Web Storage (Type 8) message schema
This is the schema for the Web Storage (Type 8) messages.
"$ref" : "MessageHeader", webStorage: { key : “string”, value: “string”,
}
Chapter 6. Sample Code
143
Web Storage (Type 8) message example
This is an example of a Web Storage (Type 8) message.
{ type: 8, offset: 25, screenviewOffset: 23, count: 2, fromWeb: true, webStorage: { key: "vistCount" value: "5"
}
}
Overstat Hover Event (Type 9) messages
Overstat
®
Hover Event messages are any object containing information about mouse hover and hover-to-click activity. Overstat Hover Event messages are Type 9
JSON messages.
Overstat Hover Event (Type 9) message schema
This is the schema for Overstat Hover Event (Type 9) messages
"$ref" : "MessageHeader", event: { xPath: "string", hoverDuration: int, hoverToClick: boolean, gridPosition: { x: int, y: int
}
}
Overstat Hover Event (Type 9) message example
This is an example of a Overstat Hover Event (Type 9) message.
{ type: 9, offset: 25, screenviewOffset: 23, count: 2, fromWeb: true, event: { xPath: "[\"ii\"]", hoverDuration: 5457, hoverToClick: false, gridPosition: { x: 3, y: 2
}
}
Layout (Type 10) messages
Layout messages show the current display layout of a native page. Layout messages are Type 10 JSON messages.
Layout (Type 10) message schema
This is the schema for Layout (Type 10) messages.
"$ref" : "MessageHeader",
"version": {
"description": "Message Version, must be in x.x format",
"type": "string",
"required": true
144
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
},
"layoutControl": {
"description": "Control on application page",
"type": "object",
"properties": {
"position": {
"description": "Position of control",
"type": "object",
"properties": {
"x": {
"title": "X of the control",
"type": "integer",
"required": true
},
"y": {
"title": "Y of the control",
"type": "integer",
"required": true
},
"height": {
"title": "height of control",
"type": "integer",
"required": true
},
"width": {
"title": "width of control",
"type": "integer",
"required": true
},
}
"additionalProperties" : false
}
"id": {
"title": "Id/Name/Tag of control",
"type": "string",
"required": true
},
"type": {
"title": "Type of control",
"type": "string",
"required": true
},
"subType": {
"title": "SubType of control",
"type": "string",
"required": true
},
"tlType": {
"title": "tlType of control that normalizes the control type for eventing",
"type": "string",
"required": true
},
"currState": {
"title": "Current state of control",
"type": "object",
"required": true,
"properties": {
"?": { // Could be any variable name given by developer
"title": "Additional data in string format",
"type": "string",
"required": false
}
}
},
"style" : {
"title": "Style of the control",
"type": "object",
Chapter 6. Sample Code
145
}
"required": true,
"properties": {
"textColor": {
"title": "Text color",
"type": "string",
"required": true
},
"textAlphaColor": {
"title": "Text alpha color",
"type": "string",
},
"required": true
"textBGColor": {
"title": "Text background color",
"type": "string",
"required": true
},
"textBGAlphaColor": {
"title": "Text background alpha color",
"type": "string",
"required": true
},
"bgColor": {
"title": "Background color",
"type": "string",
"required": true
},
"bgAlphaColor": {
"title": "Background alpha color",
"type": "string",
"required": true
}
}
},
}
"additionalProperties" : false
Layout (Type 10) message example
This is an example of a Layout (Type 10 ) message.
{
"offset": 27004,
"screenviewOffset": 4706,
"count": 16,
"fromWeb": false,
"type": 10,
"version" : "1.0",
"orientation" : 0,
"deviceHeight": 592,
"deviceWidth": 360,
"layout": {
"name": "loginPage",
"class": "loginPageActivty",
"controls": [
{
"position": {
"y": 38,
"height": 96,
"width": 720,
"x": 0
},
"id": "com.tl.uiwidget:id\/userNameLabel",
"idType": -1,
"type": "UILabel",
"subType": "UIView",
146
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
}
},
{...},
{...}
"tlType": "label",
"currState": {
"text": "User name*"
},
"style": {
"textColor": 16777215,
"textAlphaColor": 1,
"textBGColor": 0,
"textBGAlphaColor": 0,
"bgColor": 0,
"bgAlphaColor": 0
]
}
}
Gesture (Type 11) messages
Gesture messages are used to log user action and behavior. A Gesture message consists of a control identifier and a the value returned by that control. The control identifiers are mapped to specific controls on the client logging platform. The value can be a number, a text string or structured data. Gesture messages are Type 12
JSON messages.
Gesture (Type 11) message schema
This is the schema for Gesture (Type 11) messages.
Touch events
This is a JSON object that represents a gesture finger that is linked to control underneath the finger. It is reused in targets property of gesture type 11.This is the schema for touch events:
{
"$ref" : "MessageHeader",
"focusInOffset": {
"title": "Milliseconds offset from offset for when focusIn of text fields occur",
"type": "integer",
"required": false
},
"target": {
"description": "Control being logged",
"type": "object",
"properties": {
"position": {
"description": "Position of control being logged",
"type": "object",
"properties": {
"x": {
"title": "X of the control",
"type": "integer",
"required": true
},
"y": {
"title": "Y of the control",
"type": "integer",
"required": true
},
"height": {
"title": "height of control",
"type": "integer",
Chapter 6. Sample Code
147
"required": true
},
"width": {
"title": "width of control",
"type": "integer",
"required": true
},
"relXY": {
"title": "relative X & Y ratio that can be from 0 to 1 with a default value of 0.5",
"type": "string",
"required": true for click events
},
"scrollX": {
"title": "scroll X of the page",
"type": "integer",
"required": true
},
"scrollY": {
"title": "scroll Y of the page",
"type": "integer",
"required": true
},
},
"additionalProperties" : false
}
"id": {
"title": "Id/Name/Tag of control",
"type": "string",
"required": true
},
"idType":{
"title": "Indicates what id is based on: Native id (e.g. HTML
’id’ attribute): -1, xPath: -2, or Custom attribute for
UIC and Hashcode value for Native: -3, or xPath for Native iOS/Android: -4",
"type": "integer",
"required": true
},
"dwell": {
"title": "Dwell time of control",
"type": "integer value that is in milliseconds",
"required": false
},
"focusInOffset": {
"title": "Offset when control got focus",
"type": "integer value that is in milliseconds",
"required": true in UIC
},
"visitedCount": {
"title": "Number of times a form control has been visited to be filled by user.",
"type": "integer",
"required": false
},
"isParentLink": {
"title": "To indicate if control a A type tag",
"type": "boolean",
"required": false only in UIC for usability
},
"name": {
"title": "Name of control",
"type": "string",
"required": true in UIC
},
148
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
"type": {
"title": "Type of control",
"type": "string",
"required": true
},
"subType": {
"title": "SubType of control",
"type": "string",
"required": true
},
"tlType": {
"title": "tlType of control that normalizes the control type for eventing",
"type": "string",
"required": true
},
"prevState": {
"title": "Previous state of control",
"type": "object",
"required": false,
"properties": {
"?": { // Could be any variable name given by developer
"title": "Additional data in string format",
"type": "string",
"required": false
}
}
},
"currState": {
"title": "Current state of control",
"type": "object",
"required": true,
"properties": {
"?": { // Could be any variable name given by developer
"title": "Additional data in string format",
"type": "string",
"required": false
}
}
}
},
"additionalProperties" : false
}
"event": {
"description": "Event from control",
"type": "object",
"properties": {
"tlEvent": {
"title": "Tealeaf type of event",
"type": "string",
"required": true
},
"type": {
"title": "Type of event",
"type": "string",
"required": false
},
"subType": {
"title": "Subtype of event",
"type": "string",
"required": false
}
},
"additionalProperties" : false
}}
Chapter 6. Sample Code
149
Tap event schema
This contains only one touch object. This is the schema for tap events:
{ and ends with last object when finger is lifted from device.",
"type": "array",
"required": true,
"$ref": "Touch"
}
}
}
}
"$ref" : "MessageHeader",
"event": {
"description": "Event from control",
"type": "object",
"properties": {
"tlEvent": {
"title": "Tealeaf type of event",
"type": "string",
"required": true
},
"type": {
"title": "Type of event framework reports",
"type": "string",
"required": false
}
}
},
"touches": {
"description": "Gestures touch objects per finger.",
"type": "array",
"required": true
"items": {
"description": "Touch objects per finger starting with intial
Swipe event schema
The swipe event contains only one touch object which will be the initial location with its corresponding direction and velocity. This is the schema for swipe events:
{
"$ref" : "MessageHeader",
"event": {
"description": "Event from control",
"type": "object",
"properties": {
"tlEvent": {
"title": "Tealeaf type of event",
"type": "string",
"required": true
},
"type": {
"title": "Type of event framework reports",
"type": "string",
"required": false
}
}
},
"touches": {
"description": "Gestures touch objects per finger.",
"type": "array",
"required": true
"items": {
"description": "Touch objects per finger starting with intial and ends with last object when finger is lifted from device.",
150
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
right.",
"title": "The direction of the swipe which can be up, down. left or
"type": "string",
"required": true
},
"velocityX": { x axis",
"title": "The velocity of this measured in pixels per second along the
"type": "float",
"required": true
},
"velocityY": { y axis",
"title": "The velocity of this measured in pixels per second along the
"type": "float",
"required": false
}
}
"type": "array",
"required": true,
"$ref": "Touch"
}
}
},
"direction": {
Pinch events
The pinch event contains only an initial touch object per finger and the last touch object per finger, with the corresponding direction. This is the schema for pinch events:
{
"$ref" : "MessageHeader",
"event": {
"description": "Event from control",
"type": "object",
"properties": {
"tlEvent": {
"title": "Tealeaf type of event",
"type": "string",
"required": true
},
"type": {
"title": "Type of event framework reports",
"type": "string",
"required": false
}
}
},
"touches": {
"description": "Gestures touch objects per finger.",
"type": "array",
"required": true
"items": {
"description": "Touch objects per finger starting with intial and ends with last object when finger is lifted from device.",
"type": "array",
"required": true,
"$ref": "Touch"
}
}
},
"direction": {
"title": "Direction of pinch which can be open or close",
Chapter 6. Sample Code
151
"type": "string",
"required": true
}
}
Gesture (Type 11) message example
These are examples of UIC SDK Gesture (Type 11) messages.
Tap events
This example is a gesture message for a tap event:
{
"fromWeb": false,
"type": 11,
"offset": 46788,
"screenviewOffset": 42208,
"count": 14,
"event": {
"type": "ACTION_DOWN",
"tlEvent": "tap"
},
"touches": [
[
{
"position": {
"x": 179,
"y": 543
},
"control": {
"position": {
"height": 184,
"width": 1080,
"relXY": "0.17,0.93"
"scrollX": 10
"scrollY": 15
},
"id": "[RL,0]",
"idType": -4,
"type": "RelativeLayout",
"subType": "ViewGroup",
"tlType": "canvas"
}
}
]
]
}
Double tap events
This example is a gesture message for a double tap event:
{
"fromWeb": false,
"type": 11,
"offset": 49585,
"screenviewOffset": 45005,
"count": 15,
"event": {
"type": "ACTION_DOWN",
"tlEvent": "doubleTap"
},
"touches": [
[
{
"position": {
152
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
}
]
]
}
"x": 182,
"y": 520
},
"control": {
"position": {
"height": 184,
"width": 1080,
"relXY": "0.17,0.8"
"scrollX": 10
"scrollY": 15
},
"id": "[RL,0]",
"idType": -4,
"type": "RelativeLayout",
"subType": "ViewGroup",
"tlType": "canvas"
}
Tap hold events
This example is a gesture message for a tap hold event:
{
"fromWeb": false,
"type": 11,
"offset": 52389,
"screenviewOffset": 47809,
"count": 16,
"event": {
"type": "ACTION_DOWN",
"tlEvent": "tapHold"
},
"touches": [
[
{
"position": {
"x": 182,
"y": 536
},
"control": {
"position": {
"height": 184,
"width": 1080,
"relXY": "0.17,0.89"
"scrollX": 10
"scrollY": 15
},
"id": "[RL,0]",
"idType": -4,
"type": "RelativeLayout",
"subType": "ViewGroup",
"tlType": "canvas"
}
}
]
]
}
Chapter 6. Sample Code
153
Swipe event example
The swipe event contains only one touch object which will be the initial location with its corresponding direction and velocity. This example is a message for a swipe event:
{
"fromWeb": false,
"type": 11,
"offset": 54409,
"screenviewOffset": 49829,
"count": 17,
"event": {
"type": "ACTION_DOWN",
"tlEvent": "swipe"
},
"direction": "right",
"velocityX": 7762.8466796875,
"velocityY": 127.47991943359375,
"touches": [
[
{
"position": {
"x": 75,
"y": 538
},
"control": {
"position": {
"height": 184,
"width": 1080,
"relXY": "0.07,0.9"
"scrollX": 10
"scrollY": 15
},
"id": "[RL,0]",
"type": "RelativeLayout",
"subType": "ViewGroup",
"tlType": "canvas"
},
}
{
"position": {
"x": 212,
"y": 526
},
"control": {
"position": {
"height": 184,
"width": 1080,
"relXY": "0.2,0.84"
"scrollX": 10
"scrollY": 15
},
"id": "[RL,0]",
"idType": -4,
"type": "RelativeLayout",
"subType": "ViewGroup",
"tlType": "canvas"
}
}
]
]
}
154
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
Pinch events
The pinch event contains only an initial touch object per finger and the last touch object per finger, with the corresponding direction. This example is a message for a pinch event:
{
"type": 11,
"offset": 2220,
"screenviewOffset": 2022,
"count": 6,
"fromWeb": false,
"event": {
"tlEvent": "pinch",
"type": "onScale"
},
"touches": [
[
{
"position": {
"y": 388,
"x": 0
},
"control": {
"position": {
"height": 100,
"width": 100,
"relXY": "0.6,0.8"
"scrollX": 10
"scrollY": 15
},
"id": "com.tl.uic.appDarkHolo:id/imageView1",
"idType": -1,
"type": "ImageView",
"subType": "View",
"tlType": "image"
}
},
{
"position": {
"y": 388,
"x": 400
},
"control": {
"position": {
"height": 100,
"width": 100,
"relXY": "0.4,0.7"
"scrollX": 10
"scrollY": 15
},
"id": "com.tl.uic.appDarkHolo:id/imageView1",
"idType": -1,
"type": "ImageView",
"subType": "View",
"tlType": "image"
}
}
],
[
{
"position": {
"y": 388,
"x": 800
},
"control": {
"position": {
Chapter 6. Sample Code
155
}
"height": 100,
"width": 100,
"relXY": "0.6,0.8"
"scrollX": 10
"scrollY": 15
},
"id": "com.tl.uic.appDarkHolo:id/imageView1",
"idType": -1,
"type": "ImageView",
"subType": "View",
"tlType": "image"
}
},
{
"position": {
"y": 388,
"x": 500
},
"control": {
"position": {
"height": 100,
"width": 100,
"relXY": "0.4,0.7"
"scrollX": 10
"scrollY": 15
},
}
}
]
],
"direction": "close"
"id": "com.tl.uic.appDarkHolo:id/imageView1",
"idType": -1,
"type": "ImageView",
"subType": "View",
"tlType": "image"
DOM Capture (Type 12) messages
DOM Capture messages are objects that contain serialized HTML data (DOM snapshot) of the page. DOM Capture Messages are Type 12 JSON messages.
DOM Capture (Type 12) message schema
This is the schema for the DOM Capture (Type 12) messages.
"$ref" : "MessageHeader",
"domCapture": {
"description": "Serialized HTML snapshot of the document.",
"type": "object",
"properties": {
"dcid": {
"title": "Unique identifier of this DOM snapshot.",
"type": "string",
"required": true
} a full DOM or a DOM diff.",
"type": "boolean",
"required": false
},
"fullDOM": {
"title": "Flag indicating if the contents of this message contain
"charset": {
"title": "Browser reported charset of the document.",
"type": "string",
"required": false
},
156
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
"root": {
"title": "Serialized HTML of the document.",
"type": "string",
"required": false
},
"diffs": {
"title": "List of DOM diff entries. Each entry can contain a HTML Diff or an attribute diff.",
"type": "array",
"required": false,
"Item": {
"title": "An object containing the DOM diff. The diff can be a HTML diff or an attribute diff.",
"type": "object",
"required": false,
"properties": {
"xpath": {
"title": "The xpath of the node.",
"type": "string",
"required": true
},
"root": {
"title": "Serialized HTML of the node referred by the xpath. Presence of this property constitutes a HTML diff.",
"type": "string",
"required": false
},
"attributes": {
"title": "List of attribute diff entries. Each entry contains a single attribute diff corresponding to the node referred by the xpath. Presence of this property constitutes an attribute diff.",
"type": "array",
"required": false,
"Item": {
"title": "An object containing the attribute diff.",
"type": "object",
"required": true,
"properties": {
"name": {
"title": "The attribute name.",
"type": "string",
"required": true
},
"value": {
"title": "The attribute value.",
"type": "string",
"required": true
}
}
}
}
}
},
"eventOn": {
}
"title": "Flag indicating if Tealeaf eventing should be enabled for this DOM Capture snapshot.",
"type": "boolean",
"required": false
},
"url": {
"title": "URL path of the snapshot document",
"type": "string",
"required": false
},
Chapter 6. Sample Code
157
"host": {
"title": "URL Host of the snapshot document",
"type": "string",
"required": false
},
"error": {
"title": "Error message",
"type": "string",
"required": false
},
"errorCode": {
"title": "Error code corresponding to the error message.",
"type": "integer",
"required": false
},
"frames": {
"title": "Serialized HTML of any child frames of the document",
"type": "array",
"required": false,
"Item": {
"title": "An object containing serialized HTML of the frame",
"type": "object",
"required": false,
"properties": {
"tltid": {
"title": "Unique identifier for this frame. Same tltid is added to the serialized HTML source of the parent."
"type": "string",
"required": true
},
"charset": {
"title": "Browser reported charset of the document.",
"type": "string",
"required": true
},
"url": {
"title": "URL path of the snapshot document",
"type": "string",
"required": true
},
"host": {
"title": "URL Host of the snapshot document",
"type": "string",
"required": true
},
}
}
},
"canvas" : {
"root": {
"title": "Serialized HTML of the document.",
"type": "string",
"required": true
}
"title": "Serialized data of the canvas snapshot.",
"type": "array",
"required": false,
}
},
"additionalProperties" : false
}
158
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
DOM Capture (Type 12) message example
This is an example of a DOM Capture (Type 12) message.
This example shows a DOM message with full DOM capture enabled:
{
// DOM Capture messages use type 12
"type": 12,
// The standard UIC message properties
"offset": 16821,
"screenviewOffset": 16817,
"count": 5,
"fromWeb": true,
"domCapture": {
"dcid": "dcid-3"
"fullDOM":true
"charset": "ISO-8859-1",
"root": "<html><body><iframe id="greeting.html" tltid="tlt-4"/>
</body></html>",
"host": "http://www.uictest.com",
"url": "/h4/dcTest.html",
"eventOn": true,
"frames": [
{
"tltid": "tlt-4",
"root": "<html><body>Hello, World!</body></html>",
"charset": "ISO-8859-1",
"host": "http://www.uictest.com",
"url": "/h4/greeting.html"
}
],
"canvas": []
}
}
This example shows a DOM capture message with DOM diff enabled:
{
"type": 12,
"offset": 13874,
"screenviewOffset": 13861,
"count": 6,
"fromWeb": true,
"domCapture": {
"fullDOM": false,
"diffs": [
{
"xpath": "[[\"html\",0],[\"body\",0],[\"div\",1]]",
"root": "<div class=\"bluebg\"><div><div>Input 1<input type=\"text\" name=\"ip-x-1\" value=\"\"></div></div></div>"
}
],
"dcid": "dcid-3.1437256358764",
"eventOn": false
}
}
DOM Diff (with HTML and attribute diff):
{
"type": 12,
"offset": 5794,
"screenviewOffset": 5777,
Chapter 6. Sample Code
159
"count": 8,
"fromWeb": true,
"domCapture": {
"fullDOM": false,
"diffs": [
{
"xpath": "[[\"html\",0],[\"body\",0],[\"div\",2],[\"div\",1]]",
"root": "<div>Select List:<select name=\"select.pvt\"><option value=\"O1\" selected=\"selected\">1</option><option value=\"O2\">2</option>
<option value=\"O3\">3</option></select></div>"
},
{
"xpath": "[[\"cb1\"]]",
"attributes": [
{
"name": "style",
"value": "height: 13px; width: 13px; visibility: hidden;"
}
]
},
{
"xpath": "[[\"container_1\"],[\"table\",0],[\"tbody\",0],
[\"tr\",2],[\"td\",1],[\"select\",0]]",
"attributes": [
{
"name": "style",
"value": "visibility: hidden;"
}
]
}
],
"dcid": "dcid-3.1437256879815",
"eventOn": false
}
}
This example shows the error message when the captured DOM message length exceeds the configured threshold:
{
// DOM Capture messages use type 12
"type": 12,
// The standard UIC message properties
"offset": 16821,
"screenviewOffset": 16817,
"count": 5,
"fromWeb": true,
// The DOM Capture data is namespaced in the domCapture object
"domCapture": {
// The "error" contains the verbose error message explaining why the
DOM Capture couldn’t be performed.
"error": "Captured length (18045) exceeded limit (10000).",
// The "errorCode" contains the numeric code for this error message.
Currently, there is only 1 error message.
"errorCode": 101,
// The "dcid" property contains the unique string identifying this
DOM Capture within the page instance.
"dcid": "dcid-1.1414088027401"
}
}
160
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
GeoLocation (Type 13) messages
A GeoLocation message logs a user's location information. The message consists of a control identifier and a GeoLocation value. If the user has given the permission to use location data, GeoLocation returns latitude, longitude, accuracy values. If the user has not given permission to use location data, GeoLocation returns an error code and error string.
GeoLocation (Type 13) message schemas
This is the schema for the GeoLocation (Type 13) JSON messages:
This is the schema for messages from a device that the user has given permission to use location data:
"$ref" : "MessageHeader",
"geolocation": {
"lat": double,
"long": double,
"accuracy": float
}
This is the schema for messages from a device that the user has not given permission to use location data:
"$ref" : "MessageHeader",
"geolocation": {
"errorCode": int,
"error": "string",
}
GeoLocation (Type 13) message examples
This is an example of the GeoLocation (Type 13) JSON message.
This is an example of a message from a device that the user has given permission to use location data:
{ "type": 13,
"geolocation": {
"lat": 37.5680,
"long": -122.3292,
"accuracy": 65
}
}
This is an example of a message from a device that the user has not given permission to use location data:
{ "type": 13,
"geolocation": {
"errorCode": 201,
"error": "permission denied",
}
}
Chapter 6. Sample Code
161
162
IBM Tealeaf Android SDK: IBM Tealeaf Android SDK Guide
Advertisement
Key features
- Capture user interface and application events
- Collect data on how users interact with your application
- Improve user experience
- Optimize app performance
- Troubleshoot issues