Advanced Mode JavaScript example

In Advanced mode, this event looks like the following:


// Generated by Discover Event Manager
// NOTE: Do not change event name
function NS$E__ADVANCED_MODE_EVENT__634339708610416368()
{
if (!($S.IsBot))
    {
// Set fact for Report Group: No Dimension Report Group
$F.setFact("NS.F_E__ADVANCED_MODE_EVENT__634336419284199494", "TLT$NULL");
    }
}

Examine the components:


function NS$E__ADVANCED_MODE_EVENT__634339708610416368()
  • This statement defines the event as a function.
  • NS$E__ADVANCED_MODE_EVENT__634339708610416368 is the full name of the event.
    • NS is the namespace, which is a unique identifier for each Discover customer. This value cannot be changed within the Discover solution.
    • $ is a function name delimiter between the namespace and the internal function name.
    • E signifies that the function implements an event.
    • ADVANCED_MODE_EVENT is the user-selected name of the event.
      • After the event was created, this name does not change even if the name is changed in the GUI.
    • 634339708610416368 is a string that is added to the object name to guarantee uniqueness.
      • It is based on the created time epoch and other factors. This string value is used to enable multiple events that have the same name in the GUI.
    • Underscores (_) are used to separate individual words in the name.
    • Double underscores (__) are used to separate the parts of the internal name.

if (!($S.IsBot))
  • This string is the condition definition.
  • $S is the type of object that is used in the condition. In this case, it is a session attribute.
  • IsBot is the name of the session attribute. In this case, it is a system session attribute and not a custom session attribute, although that information is not indicated in the string.
  • ! is the NOT operator that is applied to the session attribute IsBot.

$F.setFact("NS.F_E__ADVANCED_MODE_EVENT__634336419284199494", "TLT$NULL");
  • This string writes the value of the event.
  • $F is the fact collection object. Write the value into the Fact for this event.
  • setFact is the method in the fact collection object that is used to set the value of the fact specified.
  • "NS.F_E__ADVANCED_MODE_EVENT__634336419284199494" is the name of the fact to which the value is written.
    • NS is the namespace, which is a unique for the customer.
    • F_E is the type of the object to which method is writing. In this case, it is the Fact for Event.
    • ADVANCED_MODE_EVENT__634339708610416368 is the internal name of the object.
  • "TLT$NULL" is the value to record. In this case, the dimension constant value for null values is recorded.
    • Within the Event Manager, you can define a standard value that is recorded for a dimension when a null value is detected. In the JavaScript, this value is referenced using TLT$NULL.