AppSuite:Metrics-Details: Difference between revisions

From Open-Xchange
No edit summary
No edit summary
 
Line 3: Line 3:
== Metrics: Details ==
== Metrics: Details ==


=== Component Overview ===
The content on this page has moved to https://documentation.open-xchange.com/latest/ui/features/metrics/01-details.html.


[[File:Metrics-01.jpg|300px|thumb|none|overview]]
Note: Open-Xchange is in the process of migrating all its technical documentation to a new and improved documentation system (documentation.open-xchange.com). Please note as the migration takes place more information will be available on the new system and less on this system. Thank you for your understanding during this period of transition.
 
=== Listeners ===
 
With metrics in mind listeners are waiting for special events to occur - usually a user action that manifests as a mouse click.
 
Common practice is to register listeners by using [http://api.jquery.com/delegate/ jQuerie’s delagate] function. For example this snippet would listen for any mousedown event on an action icon within the mail app toolbar.
 
<code javascript>
  $('.classic-toolbar-container').delegate('.io-ox-action-link', 'mousedown', yourHandler);
</code>
 
hint: please do not register these listeners when metrics is disabled to avoid unnecessary work for the client. Simply use the isEnabled function provided (see below).
 
=== Handlers ===
 
The Handler calls the public functions of the metrics module. To gain access to the metrics object simply require ‘io.ox/metrics/main’.
 
<code javascript>
  require(['io.ox/metrics/main'], function(metrics) {
    metrics.trackEvent({
        app: 'mail',
        target: 'detail/toolbar',
        type: 'click',
        action: $(e.currentTarget).attr('data-action')
    });
});
 
</code>
 
=== Metrics module ===
 
The metrics module provide some simple API that enables you to track events.
 
==== trackEvent() ====
 
''app''
 
  * application name
  * ''example: ‘mail’''
 
''target''
 
  * container/area
  * ''example: ‘detail/toolbar’''
 
''type''
 
  * type of event
  * ''example: ‘click’''
 
''action''
 
  * name/id of the action
  * ''example: ‘delete’''
 
==== trackPage() ====
 
''name''
 
  * name of the page. for OX Appsuite this is the name of the application
  * ''example: ‘mail’''
 
''id''
 
  * id of the page.
  * ''example: ‘io.ox/mail’''
 
''name''
 
  * name of the page
  * ''example: ‘Mail’''
 
==== trackVariable() ====
 
  * currently unused
 
==== watch(options, data) ====
 
Shortcut to register a trackEvent listener by using _.delegate on a container node
 
<code javascript>
  watch({
      node: $('#my-actions'),
      selector: '#my-button',
      event: 'click'
  }, dataToTrack)
 
</code>
==== getUserHash() ====
 
return unique user (based on cookie value)
 
==== isEnabled() ====
 
returns boolean that indicates status of the metrics module
 
<code javascript>
  require(['io.ox/metrics/main'], function (metrics) {
    var name = app.get('parent').get('name') || 'unknown',
        apptitle = _.last(name.split('/')),
        facet = model.get('facet').get('id').split(':')[0];
    // toolbar actions
    metrics.trackEvent({
        app: apptitle,
        target: apptitle + '/search/facet/' + facet,
        action: 'search',
        value: facet
    });
  });
</code>
 
 
=== Adapters ===
 
Please visit the [[AppSuite:Metrics-Adapters | Adapters Page ]]


[[Category:AppSuite]]
[[Category:AppSuite]]
[[Category:UI]]
[[Category:UI]]
[[Category:Metrics]]
[[Category:Metrics]]

Latest revision as of 10:21, 12 July 2016

This information is valid from 7.8.0

Metrics: Details

The content on this page has moved to https://documentation.open-xchange.com/latest/ui/features/metrics/01-details.html.

Note: Open-Xchange is in the process of migrating all its technical documentation to a new and improved documentation system (documentation.open-xchange.com). Please note as the migration takes place more information will be available on the new system and less on this system. Thank you for your understanding during this period of transition.