UncleGedd commented on a change in pull request #64:
URL: 
https://github.com/apache/incubator-flagon-useralejs/pull/64#discussion_r597198545



##########
File path: example/log-label-example/README.md
##########
@@ -0,0 +1,97 @@
+# Custom Log Label Examples
+
+Examples illustrating how to add custom labels to logs generated by `userale`.
+
+## Adding Custom Labels to Logs
+
+### Method 1
+
+Consider the following HTML:
+
+```html
+
+<div>
+    <button>New Feature</button>
+</div>
+```
+
+The following code snippet will add a custom field and send a log whenever the 
new feature button is clicked:
+
+```js
+document.addEventListener('click', function (e) {
+    if (e.target.innerHTML === 'New Feature') {
+        window.userale.map(log => ({...log, logType: 'custom', customLabel: 
'New Feature'}));
+        window.userale.packageLog(e, 
window.userale.details(window.userale.options(), e.type));
+        window.userale.map();
+    } else {
+        return false
+    }
+});

Review comment:
       Agreed Rob, I also prefer the idea of just using the `userale.map` 
function as opposed to adding more event listeners. I think we need a bit more 
context on what exactly the users are trying to accomplish and what they want 
to [decorate](https://github.com/apache/incubator-flagon-useralejs/issues/63).
   
   The examples that Rob linked are located at 
[example/index.js](https://github.com/apache/incubator-flagon-useralejs/blob/master/example/index.js).
 Do you have any idea why in that code the extra event listeners are added?
   
    EDIT: I saw the examples you mentioned over in the README but I'm not quite 
understanding their usage. Is the goal just to subvert the Userale logs and 
event handlers?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to