Constructor
new Analytics()
- Since:
- Source:
Extends
Members
track :function
The main function for sending analytics events to the service.
Type:
- Source:
trackMethods :Array.<string>
The name of methods that will be wrapped to ensure they are called
after the analytics service is ready.
Type:
- Since:
- Source:
type :string
The name of this Model
Type:
- 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. Any overwritten versions of this function
should make sure to set the track method on the model, and also call
this.trigger("ready") when the service is ready to use, and
this.trigger("setupError", error) if there is an error during setup.
- Source:
trackCustomEvent(eventName, paramsopt)
Track a custom event.
Parameters:
Name |
Type |
Attributes |
Description |
eventName |
string
|
|
The name of the event to track |
params |
Object
|
<optional>
|
The parameters to send with the event. |
- Since:
- 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:
whenReady() → {Promise}
Wait for the analytics service to be ready before sending events.
Depends on the setupAnalytics triggering a "ready" event as well as a
"setupError" event if there is an error during setup.
- Since:
- Source:
Returns:
A promise that resolves when the analytics service
is ready to use.
-
Type
-
Promise