jcustomer jexperience troubleshooting unomi Jahia 7.3 Jahia 8

How to troubleshoot jExperience events sent to jCustomer/Unomi and which rules were triggered

Question

How can I see the content of events sent from jExperience to jCustomer/Unomi and check which rules were triggered for each profile/session?

Answer

An efficient way to view the events sent from jExperience to jCustomer/Unomi is using the karaf console.

The karaf console can be accessed through SSH. The relevant information can be checked in the following configuration files in your jCustomer/Unomi installation directory.

etc/custom.system.properties:

#######################################################################################################################
## SSH Server settings                                                                                               ##
#######################################################################################################################
# These properties are used to configure Karaf's ssh shell.
#
# Via sshPort and sshHost you define the address you can login into Karaf.
#
org.apache.unomi.shell.sshPort=${env:UNOMI_SHELL_SSHPORT:-8102}
org.apache.unomi.shell.sshHost=${env:UNOMI_SHELL_SSHHOST:-0.0.0.0}

#######################################################################################################################
## Security settings                                                                                                 ##
#######################################################################################################################
org.apache.unomi.security.root.password=${env:UNOMI_ROOT_PASSWORD:-karaf}

etc/system.properties:

#
# User name for the Karaf local console
#
karaf.local.user = karaf

In this example one can access karaf console by running the following command:

ssh -p 8102 karaf@localhost

Once you type your password, in this case karaf, you will be redirected to the command prompt. There, you can start monitoring the events reaching jCustomer by typing the following command (to exit this mode type Ctrl+C):

karaf@root()> unomi:event-tail
ID                                  |Type          |Session                             |Profile                             |Timestamp                    |Scope          |Persi|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2fea42df-dffc-4f24-a4ef-6efec6dfd2d5|sessionReassig|d8aaa2a7-38b7-49cc-b103-a76ac1c61212|fa987d27-9547-4e92-a35d-dfd17583b43f|Tue Dec 31 23:18:03 EST 2019 |digitall       |true |
cf482e15-aaa8-44bb-a130-ec2d645f33c2|login         |d8aaa2a7-38b7-49cc-b103-a76ac1c61212|fa987d27-9547-4e92-a35d-dfd17583b43f|Tue Dec 31 23:18:03 EST 2019 |digitall       |true |
38b5a45b-2db7-4cc5-afc7-d5f361eb25c8|view          |d8aaa2a7-38b7-49cc-b103-a76ac1c61212|fa987d27-9547-4e92-a35d-dfd17583b43f|Tue Dec 31 23:18:03 EST 2019 |digitall       |true |
^C~ 

 With the IDs provided in this command one can use the following commands to check the content of the respective session and profile:

karaf@root()> unomi:profile-view fa987d27-9547-4e92-a35d-dfd17583b43f
{
  "itemId" : "fa987d27-9547-4e92-a35d-dfd17583b43f",
  "itemType" : "profile",
  "version" : 11,
  "properties" : {
    "nbOfVisits" : 5,
    "pageViewCount" : {
      "digitall" : 7
    },
    "lastVisit" : "2020-01-01T04:18:03Z",
    "firstVisit" : "2019-12-31T02:21:55Z",
    "previousVisit" : "2019-12-31T04:18:01Z",
    "preferredLanguage" : "en",
    "j:title" : "madam",
    "j:liveProperties" : "cookieauth",
    "company" : "Acme Space",
    "firstName" : "Irina",
    "j:about" : "<p>\n Lorem Ipsum dolor sit amet,consectetur adipisicing elit, sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua. Ut enim adminim veniam, quis nostrudexercitation ullamco laboris nisi utaliquip ex ea commodo consequat.Duis aute irure dolor inreprehenderit in coluptate velit essecillum dolore eu fugiat nulla pariatur.Excepteur sint occaecat cupidatatnon proident, sunt in culpa quiofficia deserunt mollit anim id estlaborum.</p>\n",
    "jobTitle" : "Content validation Director",
    "emailNotificationsDisabled" : "true",
    "gender" : "female",
    "j:nodename" : "irina",
    "lastName" : "Pasteur",
    "j:publicProperties" : "j:about,j:firstName,j:function,j:gender,j:lastName,j:organization,j:picture,j:title"
  },
  "systemProperties" : {
    "lists" : [ "_6me5126rj" ],
    "mergeIdentifier" : "irina"
  },
  "segments" : [ ],
  "scores" : { },
  "mergedWith" : null,
  "consents" : { }
}
karaf@root()> unomi:session-view d8aaa2a7-38b7-49cc-b103-a76ac1c61212
{
  "itemId" : "d8aaa2a7-38b7-49cc-b103-a76ac1c61212",
  "itemType" : "session",
  "scope" : "digitall",
  "version" : 3,
  "profileId" : "fa987d27-9547-4e92-a35d-dfd17583b43f",
  "profile" : {
    "itemId" : "fa987d27-9547-4e92-a35d-dfd17583b43f",
    "itemType" : "profile",
    "version" : null,
    "properties" : {
      "nbOfVisits" : 5,
      "pageViewCount" : {
        "digitall" : 7
      },
      "lastVisit" : "2020-01-01T04:18:03Z",
      "firstVisit" : "2019-12-31T02:21:55Z",
      "previousVisit" : "2019-12-31T04:18:01Z",
      "preferredLanguage" : "en",
      "j:title" : "madam",
      "j:liveProperties" : "cookieauth",
      "company" : "Acme Space",
      "j:about" : "<p>\n Lorem Ipsum dolor sit amet,consectetur adipisicing elit, sed doeiusmod tempor incididunt ut laboreet dolore magna aliqua. Ut enim adminim veniam, quis nostrudexercitation ullamco laboris nisi utaliquip ex ea commodo consequat.Duis aute irure dolor inreprehenderit in coluptate velit essecillum dolore eu fugiat nulla pariatur.Excepteur sint occaecat cupidatatnon proident, sunt in culpa quiofficia deserunt mollit anim id estlaborum.</p>\n",
      "jobTitle" : "Content validation Director",
      "emailNotificationsDisabled" : "true",
      "gender" : "female",
      "j:publicProperties" : "j:about,j:firstName,j:function,j:gender,j:lastName,j:organization,j:picture,j:title"
    },
    "systemProperties" : {
      "lists" : [ "_6me5126rj" ],
      "mergeIdentifier" : "irina"
    },
    "segments" : [ ],
    "scores" : { },
    "mergedWith" : null,
    "consents" : { }
  },
  "properties" : {
    "sessionCity" : "Geneva",
    "operatingSystemFamily" : "Desktop",
    "userAgentNameAndVersion" : "Chrome@@79.0.3945.88",
    "countryAndCity" : "Switzerland@@Geneva@@2660645@@6458783",
    "userAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
    "userAgentName" : "Chrome",
    "sessionCountryCode" : "CH",
    "sessionCountryName" : "Switzerland",
    "referringURL" : "http://localhost:8080/sites/digitall/home.html",
    "deviceCategory" : "Desktop",
    "pageReferringURL" : "http://localhost:8080/sites/digitall/home.html",
    "userAgentVersion" : "79.0.3945.88",
    "sessionAdminSubDiv2" : "6458783",
    "sessionAdminSubDiv1" : "2660645",
    "location" : {
      "lon" : 6.1282508,
      "lat" : 46.1884341
    },
    "sessionIsp" : "Cablecom",
    "operatingSystemName" : "Mac OS X"
  },
  "systemProperties" : { },
  "timeStamp" : "2020-01-01T04:17:49Z",
  "lastEventDate" : "2020-01-01T04:18:03Z",
  "size" : 2,
  "duration" : 14669
}

Finally, the rules can be monitored as well by running the following command in a separate SSH terminal:

karaf@root()> unomi:rule-tail
Rule ID                             |Rule Name                           |Event Type    |Session                             |Profile                      |Timestamp      |Scope|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
_sa0znsmk5_login                    |Login                               |login         |4f051163-4b62-4a7d-8929-536fa6dbb3f1|c46cc244-8cf3-4132-a601-5af0d|Tue Dec 31 23:2|digit|
_ajhg9u2s5_sessionAssigned          |Session assigned to a profile       |sessionReassig|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_t7caz8npj_evaluateProfileSegments  |Evaluate segments                   |profileUpdated|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_ed2tvbd9p_evaluateProfileAge.json  |Evaluate profile age                |profileUpdated|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_t7caz8npj_evaluateProfileSegments  |Evaluate segments                   |profileUpdated|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_ed2tvbd9p_evaluateProfileAge.json  |Evaluate profile age                |profileUpdated|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_i6iqbc3x8_sessionPageReferrer      |Detect page referrer on page view   |view          |4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_ynqbd6g4t_incrementPageViewCount   |Increment page view count           |view          |4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_t7caz8npj_evaluateProfileSegments  |Evaluate segments                   |profileUpdated|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
_ed2tvbd9p_evaluateProfileAge.json  |Evaluate profile age                |profileUpdated|4f051163-4b62-4a7d-8929-536fa6dbb3f1|fa987d27-9547-4e92-a35d-dfd17|Tue Dec 31 23:2|digit|
^C~ 

Rules definitions can be viewed as well:

karaf@root()> unomi:rule-view _sa0znsmk5_login
{
  "itemId" : "_sa0znsmk5_login",
  "itemType" : "rule",
  "version" : 1,
  "condition" : {
    "parameterValues" : {
      "subConditions" : [ {
        "parameterValues" : { },
        "type" : "loginEventCondition"
      } ],
      "operator" : "and"
    },
    "type" : "booleanCondition"
  },
  "actions" : [ {
    "parameterValues" : {
      "mergeProfilePropertyValue" : "eventProperty::target.properties(j:nodename)",
      "mergeProfilePropertyName" : "mergeIdentifier"
    },
    "type" : "mergeProfilesOnPropertyAction"
  }, {
    "parameterValues" : { },
    "type" : "allEventToProfilePropertiesAction"
  } ],
  "linkedItems" : null,
  "raiseEventOnlyOnceForProfile" : false,
  "raiseEventOnlyOnceForSession" : false,
  "priority" : 0,
  "metadata" : {
    "id" : "_sa0znsmk5_login",
    "name" : "Login",
    "description" : "Copy event properties to profile properties on login",
    "scope" : "systemscope",
    "tags" : [ ],
    "systemTags" : [ ],
    "enabled" : true,
    "missingPlugins" : false,
    "hidden" : false,
    "readOnly" : false
  }
}