Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@availity/analytics-core
Advanced tools
A package providing a base Analytics class to track events and page views
npm install @availity/analytics-core
AvAnalytics
requires Plugins and a Promise lib.
new AvAnalytics(plugins, promise);
AvAnalytics
also has an optional 3rd parameter, a boolean to determine if pageTracking is enabled.
For page tracking to be used, startPageTracking
and stopPageTracking
functions must be defined to create listeners and call trackPageView
.
AvAnalytics
also has an optional 4th parameter, "autoTrack", a boolean which default to true
.
When true
, "autoTrack" will be enabled which will automatically log
new AvAnalytics(plugins, promise, pageTracking, autoTrack, options);
true
, will add on all attributes from the clicke/focused node up to the root element. It requires one attribute to have contain action
.Example using the recursive
option ( Will add all 3 attributes when the anchor
tag is clicked. If the container is clicked nothing will happen ):
<div class="container" data-analytics-app-name="app">
<a href="#" data-analytics-action="click" data-analytics-event-name="linking">Click me!</a>
</div>
Plugins can be one or an array of objects/classes:
A default class with functions defined and enabled logic is provided AvAnalyticsPlugin
.
import {AvAnalyticsPlugin} from '@availity/analytics-core';
the functions/properties used by AvAnalytics
are:
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 AvLogMessages
api.
It defaults the url and level before sending.
import {AvSplunkAnalytics} from '@availity/analytics-core';
const exmpleSplunkAnalytics = new AvSplunkAnalytics(AvLogMessages, isEnabled);
init()
Initialize analytics pageTracking and plugins
setPageTracking(value)
use parameter to set turn page tracking on/off. Always checks that pageTracking has been set up or torn down as needed.
trackEvent(properties)
Send properties to each plugins trackEvent
function.
trackPageView(url)
Send url or location.href
to each plugins trackEvent
function.
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, focus
and 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.
<a
href="/some-place-cool"
data-analytics-variation="b"
data-analytics-organization-id={orgId}
data-analytics-page-num={currentPage}>
Go there now!
</a>
import { Input } from 'reactstrap';
//...
<Input
data-analytics-variation="b"
data-analytics-organization-id={orgId} />
Kasey Powers
FAQs
Analytics base configuration for sdk-js
The npm package @availity/analytics-core receives a total of 206 weekly downloads. As such, @availity/analytics-core popularity was classified as not popular.
We found that @availity/analytics-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.