A package providing a base Analytics class to track events and page views
AvAnalytics requires Plugins and a Promise lib.
AvAnalytics also has an optional 3rd parameter, a boolean to determine if pageTracking is enabled.
For page tracking to be used,
stopPageTracking functions must be defined to create listeners and call
AvAnalytics also has an optional 4th parameter, "autoTrack", a boolean which default to
true, "autoTrack" will be enabled which will automatically log
- attributePrefix string. Overrides the default prefix for getting attributes.
- recursive boolean. If
true, will add on all attributes from the clicked/focused node up to the root element. It requires one attribute to have contain
Example using the
recursive option ( Will add all 3 attributes when the
anchor tag is clicked. If the container is clicked nothing will happen ):
Plugins can be one or an array of objects/classes:
A default class with functions defined and enabled logic is provided
The functions/properties used by
Determines if this plugin will be called at various points. If this is a function, the return value will be used. Otherwise will be checked as boolean.
if defined, will be called when
AvAnalytics is initialized.
if defined, called when
AvAnalytics receives a trackEvent call.
if defined, called when
AvAnalytics receives a trackPageView call.
AvSplunkAnalytics is a plugin to track events with the
It defaults the url and level before sending.
Initialize analytics pageTracking and plugins
use parameter to set turn page tracking on/off. Always checks that pageTracking has been set up or torn down as needed.
Send properties to each plugins
Send url or
location.href to each plugins
With "autoTrack" enabled (enabled by default) you can add special
data-analytics-* to any element which will be rendered to the DOM.
For native form elements (input, select, and textarea) with the special attribute,
blur events will trigger analytics to be logged.
For all other element with the special attribute,
click events will trigger analytics to be logged.
You can have as many of the
data-analytics-* attributes on an element as you which, all of the properties will be logged with the
data-analytics- prefix removed and the remaining camelcased as the key and the value of the attribute as the logged value.
This works with all libraries such as angular, react, jquery, and pure HTML.
Below are a list of special attributes that can be used to help correlate your application when querying for data in the specified service. Note the prefix may chnage if you have overwritten it in the options.
This ID can be set at the root of your project and should correspond to the ID of your application.
This is the ID of the Payer Space in which the application was navigated from. This generally will be in the query params at the time the user enters the application under