1.3.3 • Published 5 years ago

@melmacaluso/skadi v1.3.3

Weekly downloads
12
License
MIT
Repository
github
Last release
5 years ago

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
  • Void

Skadi.constructor(options)

Parameters
NameTypeDescription
optionsobjectSets the custom user defined arguments. 
Properties
NameTypeDescription
optionsobjectSets the custom user defined arguments. 
Returns
  • Void

Skadi.logDebug(logItems, message)

Simple logger for the debug mode.

Parameters
NameTypeDescription
logItemsarrayItems to be logged in the console 
messagestringArbitrary message that goes along the logItems 
Returns
  • Void

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
  • Void

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
NameTypeDescription
eventobjectEither the mousevent or keyevent event object. 
Returns
  • Void

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
  • string The label parsed.

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
NameTypeDescription
eventobjectThe click or keyboard event. 
Returns
  • Void

Skadi.sendToGa()

Sends the events to GA.

Returns
  • Void

Skadi.addClickListener()

Adds click and keyup listeners to the window global.

Returns
  • Void

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
NameTypeDescription
isCDNbooleanDisables errors in CDN versions of skadi. 
Returns
  • Void

Documentation generated with doxdox.

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago