Skadi.js 0.0.0-semantically-released
A simple js class to send tracking events to your google analytics account
skadi.js
new Skadi()
Main Skadi.js class
Returns
Skadi.constructor(options)
Parameters
Name | Type | Description | |
---|
options | object | Sets the custom user defined arguments. | |
Properties
Name | Type | Description | |
---|
options | object | Sets the custom user defined arguments. | |
Returns
Skadi.logDebug(logItems, message)
Simple logger for the debug mode.
Parameters
Name | Type | Description | |
---|
logItems | array | Items to be logged in the console | |
message | string | Arbitrary message that goes along the logItems | |
Returns
Skadi.updatePropsOnLoad()
Updates the class propreties with user defined ones after the page has
loaded and if there's a window.Skadi object in place.
Returns
Skadi.getEventType(event)
Filters the event types and gets the DOM node element clicked/focused.
It also sets the class constructor's proprieties accordingly and filters out
event types that are not allowed updating elementAllowed property accordingly.
It also prevents registering continous events when the target is a input
or textarea on keyup events that are not key === 'Tab'
Parameters
Name | Type | Description | |
---|
event | object | Either the mousevent or keyevent event object. | |
Returns
Skadi.parseElementClickedTag()
Translates event types to human readable events.
Returns
string
The layman's terms event type.
Skadi.getElementClickedAction()
Parses the the GA action to be human readable.
Returns
string
The action's type and target.
Skadi.getElementClickedContext()
Gets the nearest data-skadi-context bubbling up until finding a context or
to the user defined maxBubbling value.
Returns
string
The nearest context or "Default context" if nothing found.
Skadi.getElementClickedLabel()
Gets and parses the the GA Label to be human readable assuming canonical html is being used for
label tags.
Returns
Skadi.parseToGaEvent(event)
Updates Skadi's constructor properties with the relevant parsed action,
category and label and triggers GA function to send the GA event.
Parameters
Name | Type | Description | |
---|
event | object | The click or keyboard event. | |
Returns
Skadi.sendToGa()
Sends the events to GA.
Returns
Skadi.addClickListener()
Adds click and keyup listeners to the window global.
Returns
Skadi.init(isCDN)
Initialises Skadi bootstrapping the listeners.
It prevents es module version of skadi to work if there's a CDN version
embedded.
Parameters
Name | Type | Description | |
---|
isCDN | boolean | Disables errors in CDN versions of skadi. | |
Returns
Documentation generated with doxdox.