Skip to content

Scoring

Scenario

Site visitors may exhibit different behavior levels when accessing pages, filling out forms or performing actions such as Login, or Form Submit, Video Play, etc ...

Depending upon the needs of the use case or KPI requirements it can be useful to score the interactions individually or as a total experience. A scoring can be valuable figure to align NBA, this may be a communication with the visitor via a marketing source or alignment of business resources / funding in a CX situation.

Example Event Script

Example Adv. Event
// Generated by Discover Event Manager
// NOTE: Do not change event name

function CUST$E_STRUGGLE_SCORE__637932321165998888()
{
    var struggleScore, struggleScoreString, 
    deadlinkCount = $F.factCount("CUST.F_E_STRUGGLE_DEADLINK__637927186151909050") || 0,
    rageclickCount = $F.factCount("CUST.F_E_STRUGGLE_RAGECLICK__637810693555747997") + $F.factCount("CUST.F_E_STRUGGLE_RAGECLICK_NEW__637927199870808650") || 0, 
    four04Count = $F.factCount("CUST.F_E_STRUGGLE_ERROR_404__637810412052653842") || 0, 
    five00Count = $F.factCount("CUST.F_E_STRUGGLE_ERROR_500__637807868012561624") || 0,
    validationCount = $F.factCount("CUST.F_E_STRUGGLE_ERROR_VALIDATION__637810533623270976") || 0,
    excessiveScrollCount = $F.factCount("CUST.F_E_EXCESSIVE_SCROLLING__638203632023764574") || 0;

    struggleScore = deadlinkCount + rageclickCount + four04Count + five00Count + validationCount + excessiveScrollCount;

    if (struggleScore < 10) {
        struggleScore = '0' + String(struggleScore);
    }

    $F.setFact("CUST.F_E_STRUGGLE_SCORE__637932321165998888", struggleScore);
}

Tips

  1. As with all advanced events, it is best practice to create the event using the UI as much as possible and only converting to Advanced Mode when additional scripting is required. This is particularly useful when several conditions are required.
  2. The function name and number/id is generated at creation time and should not be modified. Any modification without a full event re-creation will have undesired results.

This function calculates a struggle score based on various user interactions and sets this score as an output event value.

Key component variables in the script are set from other referenced events capturing specific values, e.g. four04Count = $F.factCount("CUST.F_E_STRUGGLE_ERROR_404__637810412052653842"), 500, dead link or other errors. If the value for a referenced value is empty, it is set to zero || 0,.

The struggleScore is a sum of all the individual struggle counts, if the struggleScore is less than 10 it is formatted as a two-digit string and prefixed with 0.

The calculated struggleScore is returned as the event CUST.F_E_STRUGGLE_SCORE__637932321165998888 value.