poorejc opened a new issue #63:
URL: https://github.com/apache/incubator-flagon-useralejs/issues/63


   Users are interested in applying custom labels to their logs. 
   
   There is an easy way to do this through the .log .map and .packageCustomLog 
exports. 
   
   Some good examples in 
https://github.com/apache/incubator-flagon-useralejs/blob/master/example/index.js
   
   We should probably start with a new .md  to capture, contextualize, and 
decompose some of these examples.
   
   Here's one:
   
   ``
   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(),e.type));
           /**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
       }
   });
   ``
   
   Here' another
   ``
   `document.addEventListener('change', function(e) {
       if (e.target.value === 'packageCustomLog') {
           window.userale.packageCustomLog({
               customLabel: 'packageCustomLog Example',
               customField1: 'foo',
               customField2: 'bar'},
               function(){return {'foo': 'bar', 'bar': 'foo'}},
               true
               );
       } else {
           return false
       }
   });
   ``


----------------------------------------------------------------
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:
[email protected]


Reply via email to