You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flagon.apache.org by po...@apache.org on 2019/03/29 00:33:00 UTC

[incubator-flagon-useralejs] 01/03: added pageTitle, pageUrl, pageReferrer fields to UserALE.js

This is an automated email from the ASF dual-hosted git repository.

poorejc pushed a commit to branch FLAGON-336
in repository https://gitbox.apache.org/repos/asf/incubator-flagon-useralejs.git

commit 30144285ca82d69f24530885d7512a8c0b5959eb
Author: poorejc <po...@apache.org>
AuthorDate: Sun Feb 24 21:50:23 2019 -0500

    added pageTitle, pageUrl, pageReferrer fields to UserALE.js
---
 src/packageLogs.js | 58 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 32 insertions(+), 26 deletions(-)

diff --git a/src/packageLogs.js b/src/packageLogs.js
old mode 100644
new mode 100755
index 439e816..49684b1
--- a/src/packageLogs.js
+++ b/src/packageLogs.js
@@ -71,35 +71,38 @@ export function initPackager(newLogs, newConfig) {
  * @return {boolean}           Whether the event was logged.
  */
 export function packageLog(e, detailFcn) {
-  if (!config.on) {
-    return false;
-  }
+    var log;
+    if (!config.on) {
+        return false;
+    }
 
-  var details = null;
-  if (detailFcn) {
-    details = detailFcn(e);
-  }
+    var details = null;
+    if (detailFcn) {
+        details = detailFcn(e);
+    }
 
-  var timeFields = extractTimeFields(
-    (e.timeStamp && e.timeStamp > 0) ? config.time(e.timeStamp) : Date.now()
-  );
+    var timeFields = extractTimeFields(
+        (e.timeStamp && e.timeStamp > 0) ? config.time(e.timeStamp) : Date.now()
+    );
 
-  var log = {
-    'target' : getSelector(e.target),
-    'path' : buildPath(e),
-    'clientTime' : timeFields.milli,
-    'microTime' : timeFields.micro,
-    'location' : getLocation(e),
-    'type' : e.type,
-    'logType': 'raw',
-    'userAction' : true,
-    'details' : details,
-    'userId' : config.userId,
-    'toolVersion' : config.version,
-    'toolName' : config.toolName,
-    'useraleVersion': config.useraleVersion,
-    'sessionID': config.sessionID
-  };
+    log = {
+        'target': getSelector(e.target),
+        'path': buildPath(e),
+        'pageUrl': window.location.href,
+        'pageTitle': document.title,
+        'pageReferrer': document.referrer,
+        'clientTime': timeFields.milli,
+        'microTime': timeFields.micro,
+        'location': getLocation(e),
+        'type': e.type,
+        'logType': 'raw',
+        'details': details,
+        'userId': config.userId,
+        'toolVersion': config.version,
+        'toolName': config.toolName,
+        'useraleVersion': config.useraleVersion,
+        'sessionID': config.sessionID
+    };
 
   if ((typeof filterHandler === 'function') && !filterHandler(log)) {
     return false;
@@ -154,6 +157,9 @@ export function packageIntervalLog(e) {
         intervalLog = {
             'target': intervalID,
             'path': intervalPath,
+            'pageUrl' : window.location.href,
+            'pageTitle' : document.title,
+            'pageReferrer' : document.referrer,
             'count': intervalCounter,
             'duration': timestamp - intervalTimer,  // microseconds
             'startTime': intervalTimer,