The Experience Analytics JavaScript™ Event Engine is a Javascript-based language running in the Google V8 JavaScript Engine with extensions specific to the Experience Analytics data model.
- Google V8 - http://code.google.com/p/v8/
- ECMAScript (ECMA-262, third addition) - http://www.ecma-international.org/publications/standards/Ecma-262.htm
Object model
There are six Experience Analytics-specific objects in the Experience Analytics
Object Model. Four of the objects have a global variable that is assigned during the processing of a
hit and session, which is denoted by the $
character and a single letter.
TLSession
($S
) - session objectTLHit
($H
) - hit objectTLFactColl
($F
) - fact collection for sessionTLPatternColl
($P
) - pattern collection for current hitTLPattern
- pattern object in$P
collectionTLFact
- fact object in$F
collection
Event object internal identifiers
The TLFact
and TLPattern
objects are references by an
identifier in the following form:
NameSpace.InternalName
You have a unique assigned namespace that is included in your license file.
TL.*
. Typically, these objects are read-only.In advanced mode, these event object identifiers are inserted in the JavaScript code. Otherwise, the namespace identifier is invisible to the user.
Examples
The following examples are all in JavaScript and assume the object definitions (namely fact and pattern) exist in the database.
For all the examples below, the namespace is NS1
. This value identifies the
namespace that is associated with the customer and is consistent for all user-defined objects that
are created by Experience Analytics users within your enterprise. Your namespace value
cannot be changed.
Example | Trigger | JavaScript | Notes |
---|---|---|---|
Change session timeout | All except Session End |
In this example, the timeout for the current session is reset to 1800 seconds (30 minutes).
|
By default, each session is configured to timeout based on a predefined value in the Canister. You can override this setting by changing the timeout for individual sessions. |
Counting a session | SessionStart |
|
|
Counting a status code 404 hit | Page |
|
|
Discard session | Any |
Note: In Advanced Mode, the
TLDiscardSession(); function call discards the session.
However, you must manually configure to send the session to the Event Bus through the More Options
step. |
When a session is discarded, it is retained in the Short-Term Canister as long as the session is active and is then discarded before it is written to the Long-Term Canister. |
Immediate match | Start pattern has data, and End pattern is blank. $P returns
true for patternFound() . The {{matchCount()}}
reflects the number of times the start pattern is found and the Start pattern string for the
matching pattern text. |
||
Record search term in a fact (session temporary variable) | Page |
|
|
Record shopping cart value if abandoned session | SessionEnd |
|
|
Record the number of searches in a session | SessionEnd |
|
|
Store current value of shopping cart | Page |
|
TLEnv Object ($E
)
The $E
object contains information about the Processing Server environment. This
object is only available in Advanced mode.
Property | Description |
---|---|
ServerName |
Name of the Processing Server |
IP |
IP address of the Processing Server |
Version |
Version of the Event Engine on the Processing Server |
TLSession Object ($S
)
Property Name | Type | Description |
---|---|---|
ID |
Long |
Session ID in Canister |
TLTSID |
String(32) |
TLTSID hash value that is used for sessioning |
TTLUID |
String(32) |
TLTUID cookie value |
TLTVID |
String(32) |
Visitor ID |
IP |
String(32) |
Client IP address (first hit of session) |
DomainName |
String(256) |
Domain name (HTTP_HOST) |
UserAgent |
String(256) |
User agent |
BrowserOS |
String(256) |
Browser OS |
Browser Version |
String(256) |
Browser Version |
BrowserType |
String(256) |
Browser Type (BROWSER, BOT, Other) |
IsBot |
Boolean |
Bot traffic (True/False) |
StartTime Epoch |
Int |
Session Start time (microseconds) |
LastHit Epoch |
Int |
Last hit of Session (microseconds) |
EventCount |
Int |
Event count for session |
PageCount |
Int |
Page count for session |
Licensed PageCount |
Int |
Licensed page count for session |
ImgCount |
Int |
Image count for session |
CUICount |
Int |
Count of UISDK hits, as detected from the visitor's browser Note: This session
attribute requires UI Capture. |
OtherCount |
Int |
Non-Page/Image count for session |
NumberOf Hits |
Int |
Running count of the number of hits in the session |
First PageURL |
String(256) |
First URL of session |
LastPageURL |
String(256) |
Last hit of session URL |
TotalTime |
Long |
Length of session (microseconds) |
TotalREQ Bytes |
Int |
Total Request bytes in session |
TotalRSP Bytes |
Int |
Total Response bytes in session |
Referrer |
String(256) |
Referrer for session |
Referrer Domain |
String(256) |
Referrer domain for session |
Interesting |
Boolean |
Keep session for archive |
Expiration Time |
Int |
Epoch to expire session (seconds) |
Session CloseReason |
Int |
Reason why session was closed. |
Session TimeOut |
Int |
Session timeout (Seconds) |
SessionCloseReason property
The SessionCloseReason property indicates the reason why the session was closed.
Set this property to one of the following values, which closes the session:
Value | Description | JS Reference |
---|---|---|
1 |
Close session because of too many hits. The Canister limits each session to a predefined maximum number of hits. |
eSafetyHits |
2 |
Close session because of an excessive size. The Canister limits each session to a predefined maximum size. |
eSafetySize |
3 |
Close session because of excessive time. The Canister limits each session to a predefined session timeout. |
eSafetyTime |
4 |
Close session by event. | eSessionCloseEvent |
5 |
Close session by Canister event. | eSessionCloseCopyAttribEvent |
When the SessionCloseReason property is set, the Canister opens a new session to contain the subsequent hit with the same sessionizing key.
Except for eSessionCloseEvent
, the Canister transfers the session attributes to
the follow-on session, if it still exists in the Short-Term Canister when the new session is
created.
TLHit Object ($H
)
Property Name | Type | Description |
---|---|---|
TLTHID |
String(32) |
TLTHID unique hash for hit |
URL |
String(256) |
URL for hit (no query string) |
HitNumber |
Int |
Sequence number in session |
QueryString |
String(256) |
Query string for page |
StatusCode |
Int |
HTTP Status Code |
HitDuration |
Int |
Duration of hit in microseconds |
ReqSize |
Int |
Request size in bytes |
RspSize |
Int |
Response size in bytes |
Content Encoding |
String(256) |
Content encoding |
HitTime Epoch |
Int |
Hit time (microseconds) |
Referrer |
String(256) |
Hit referrer |
HitType |
Int |
Hit type from [iamie] section |
RoundTrip |
Int |
Round Trip (microseconds) |
NetworkTrip |
Int |
Network Trip (microseconds) |
GenTime |
Int |
Web server generation (microseconds) |
Req Cancelled |
Bool |
True if req canceled |
Req Discarded |
Bool |
True if req discarded |
Request TimeEx |
Int |
Request Time stamp (microseconds) |
Request Start TimeEx |
Int |
Request Start Time stamp (microseconds) |
Response TimeEx |
Int |
Response Time stamp (microseconds) |
Response AckTimeEx |
Int |
Response ACK time stamp (microseconds) |
TLapi Arrival TimeEx |
Int |
TL API Arrive Time (microseconds) |
ConnSpeed |
Int |
Connection Speed (bit / sec) |
ConnType |
String |
Connection Type |
isCUI |
Boolean |
Set to true if the hit is a client user interface event.
Note: This hit attribute requires UI Capture. |
TLFactColl Object ($F
)
Method Name | Return Value | Description |
---|---|---|
getFact(n, p) |
TLFact Object | Get a fact with a name N at position P in the
list. The P value is a zero-based counter of the instance number in the list. If
you want the second instance of the fact, for example, use 1 . |
getFirst Fact(n) |
TLFact Object | Get first occurrence of fact with name N |
getLast Fact(n) |
TLFact Object | Get last occurrence of fact with name N |
setFact(n, val) |
Void |
Set fact with name N and value VAL |
factCount (n) |
Integer |
Get count of occurrences of fact with name N . This value is
updated whenever a fact is added to the fact collection. |
TLPatternColl Object ($P
)
Method Name | Return Value | Description |
---|---|---|
$P ['<name>'] |
TLPattern | Get hit attribute object by name |
TLFact Object
When an undefined fact record is accessed from EventEngineScripting JavaScript, a Null fact is returned. The values that are returned in the null fact are listed as the default values in the following table.
Property Name | Type | Default | Description |
---|---|---|---|
ID |
String(256) |
UNKNOWN |
ID (string value) |
EventID |
Int |
-1 |
Event ID |
Value |
String(32) |
"" |
Text Found |
Numeric Value |
Double | 0 |
Numeric value of fact |
Dim Group |
String(256) |
"" |
Group ID |
Hit Number |
Long |
-1 |
Hit Number in sessions |
HitTime Epoch |
Long |
-1 |
Hit Time in Epoch |
Dim1 |
String(256) |
"" |
Text for dimension |
Dim2 |
String(256) |
"" |
Text for dimension |
Dim3 |
String(256) |
"" |
Text for dimension |
Dim4 |
String(256) |
"" |
Text for dimension |
TLPattern Object
When an undefined hit attribute is accessed from EventEngineScripting JavaScript, a null hit attribute is returned. The values that are returned in the null hit attribute are listed as the default values in the following table.
Method Name | Return Value | Default | Description |
---|---|---|---|
valueAt(x) |
String |
"" |
Return the Nth pattern that is found in buffer |
firstValue() |
String |
"" |
Return first pattern that is found in buffer |
lastValue() |
String |
"" |
Return last pattern that is found in buffer |
matchCount() |
Integer |
0 |
Return number of matches for pattern in buffer |
patternFound() |
Boolean |
false |
True - pattern(s) found in buffer |