Class: Analytics

Analytics()

A model that connects with an analytics service to record user interactions with the app. This is a generic model that is meant to be extended for a specific analytics service.

Constructor

new Analytics()

Since:
  • 2.25.0
Source:

Extends

  • Backbone.Model

Members

track :function

The main function for sending analytics events to the service.
Type:
  • function
Source:

type :string

The name of this Model
Type:
  • string
Source:

Methods

createExceptionDescription(message, id) → {string}

Given a message and an optional ID, create a description of an exception event that can be sent to an analytics service.
Parameters:
Name Type Description
message string A description of the exception
id string The ID for the associated package or object
Source:
Returns:
A description of the exception event
Type
string

defaults() → {object}

Default attributes for this model
Source:
Returns:
Type
object

getKey() → {string}

Get the key for the analytics service. This is the ID that is used to initialize the analytics service.
Source:
Returns:
The key for the analytics service
Type
string

getVersion() → {string}

Get the version number of the MetacatUI app.
Source:
Returns:
The version number of the MetacatUI app
Type
string

initialize()

Creates a new Analytics model
Source:

ready() → {boolean}

Check if analytics service is enabled and ready to use.
Source:
Returns:
True if the service is enabled in the app and the track method is available.
Type
boolean

setupAnalytics()

Set up the analytics service.
Source:

trackEvent(category, action, label, value)

Send the details of an event to an analytics service. The function will do nothing if an analytics service is not enabled.
Parameters:
Name Type Description
category string The category of the event
action string The action of the event
label string The label of the event
value string The value of the event
Source:

trackException(message, id, fatal)

Send the details of an exception event to an analytics service. This will automatically include the MetacatUI version number in the event details. The function will do nothing if an analytics service is not enabled.
Parameters:
Name Type Description
message string A description of the exception
id string The ID for the associated package or object
fatal boolean Whether the exception was fatal
Source:

trackPageView(path, title)

Send the details of a page view to an analytics service. The function will do nothing if an analytics service is not enabled.
Parameters:
Name Type Description
path string The path of the page
title string The title of the page
Source: