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/12/14 03:59:56 UTC
[incubator-flagon-useralejs] branch FLAGON-469 updated:
[FLAGON-468] minor fix in example API script
This is an automated email from the ASF dual-hosted git repository.
poorejc pushed a commit to branch FLAGON-469
in repository https://gitbox.apache.org/repos/asf/incubator-flagon-useralejs.git
The following commit(s) were added to refs/heads/FLAGON-469 by this push:
new 5d106da [FLAGON-468] minor fix in example API script
5d106da is described below
commit 5d106dac68cc404a6d85e7f7c51809f9c99b19d2
Author: poorejc <po...@apache.org>
AuthorDate: Fri Dec 13 22:59:42 2019 -0500
[FLAGON-468] minor fix in example API script
---
build/UserAleWebExtension/content.js | 1 -
build/userale-2.0.2.js | 1 -
example/aleAPI.js | 18 ++++++++++++------
src/attachHandlers.js | 1 -
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/build/UserAleWebExtension/content.js b/build/UserAleWebExtension/content.js
index b6c4a13..24fd407 100644
--- a/build/UserAleWebExtension/content.js
+++ b/build/UserAleWebExtension/content.js
@@ -630,7 +630,6 @@ var windowEvents = ['load', 'blur', 'focus'];
* Maps an event to an object containing useful information.
* @param {Object} e Event to extract data from
*/
-// @todo add extract text (inner, by event class) to mouse events
function extractMouseEvent(e) {
return {
'clicks' : e.detail,
diff --git a/build/userale-2.0.2.js b/build/userale-2.0.2.js
index 60bc5bc..033412a 100644
--- a/build/userale-2.0.2.js
+++ b/build/userale-2.0.2.js
@@ -659,7 +659,6 @@ var userale = (function (exports) {
* Maps an event to an object containing useful information.
* @param {Object} e Event to extract data from
*/
- // @todo add extract text (inner, by event class) to mouse events
function extractMouseEvent(e) {
return {
'clicks' : e.detail,
diff --git a/example/aleAPI.js b/example/aleAPI.js
index 354e93f..b46d930 100644
--- a/example/aleAPI.js
+++ b/example/aleAPI.js
@@ -14,24 +14,26 @@
/** Options API
*
* the 'options' API allows you to dynamically change UserALE.js params and set meta data values
- *pass in variables or properties into the options object, such as sessionStorage or localStorage
+ * pass in variables or properties into the options object, such as from sessionStorage or localStorage
*/
const changeMe = "me";
window.userale.options({
"userId": changeMe,
"version": "next",
- "logDetails": "true",
+ "logDetails": false,
"sessionID": "this one"
});
/**Filter API
/**the 'filter' API allows you to eliminate logs you don't want
- *use as a global filter and add classes of events or log types to eliminate
- *or use in block scope to surgically eliminate logs from specific elements from an event handler
+ * use as a global filter and add classes of events or log types to eliminate
+ * or use in block scope to surgically eliminate logs from specific elements from an event handler
+ * Note that for surgical filters, you may need to clear or reset back to a global filter callback
+ * the same is true for the 'map' API. See examples below:
*/
window.userale.filter(function (log) {
- var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 'dblclick', 'blur', 'focus'];
+ var type_array = ['mouseup', 'mouseover', 'mousedown', 'keydown', 'dblclick', 'blur', 'focus', 'input'];
var logType_array = ['interval'];
return !type_array.includes(log.type) && !logType_array.includes(log.logType);
});
@@ -41,12 +43,15 @@ window.userale.filter(function (log) {
* the 'map' API allows you to add or modify new fields to your logs
* this example works with the "Click Me!" button at the top of index.html
*/
- document.addEventListener('click', function(e){
+document.addEventListener('click', function(e){
if (e.target.innerHTML === 'Click Me!') {
window.userale.map(function (log) {
return Object.assign({}, log, { logType: 'custom', customLabel: 'map & packageLog Example' });
});
window.userale.packageLog(e, window.userale.details(window.userale.options(),'click'));
+ /**you'll want to reset the map callback function, or set a conditional (e.g., return log), else
+ * the callback may be applied to other events of the same class (e.g., click) */
+ window.userale.map();
} else {
return false
}
@@ -55,6 +60,7 @@ window.userale.filter(function (log) {
/** Alternate Log Mapping API Example
* Build a global mapping function with conditional logic to modify logs for similar events
* this example works with the "Click Me!" button at the top of index.html
+ * Also, note that specifying log as a return will keep the scope of this callback limited to only the events you want
*/
//window.userale.map(function (log, e) {
// var targetsForLabels = ["button#test_button"];
diff --git a/src/attachHandlers.js b/src/attachHandlers.js
index e3f3b81..0d6967a 100644
--- a/src/attachHandlers.js
+++ b/src/attachHandlers.js
@@ -33,7 +33,6 @@ var windowEvents = ['load', 'blur', 'focus'];
* Maps an event to an object containing useful information.
* @param {Object} e Event to extract data from
*/
-// @todo add extract text (inner, by event class) to mouse events
export function extractMouseEvent(e) {
return {
'clicks' : e.detail,