Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@studyportals/datalake-event-tracker

Package Overview
Dependencies
Maintainers
0
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@studyportals/datalake-event-tracker

The supporting package for the JS-Tracker

  • 7.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
increased by192.03%
Maintainers
0
Weekly downloads
 
Created
Source

Datalake Event Tracker

The datalake event tracker is a package which uses the JS-Tracker to track data to Redshift. The goal of this package is to have a uniform way of tracking events. The tracker enforces naming conventions that will make it possible to automate the creation of dashboards, procedures, and further analytics.

Table of Contents

Setup & commands

The following commands can be used to setup and run a local environment for developing the modal component. Also, we're using husky to run unit tests before a git push is done. This could be by-passed (if absolutely necessary) by running git push --no-verify.

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm start

# build for production with minification
npm run build

# run unit tests
npm run unit

Usages

The "datalake event tracker"(hereby further referred to as "tracker") needs to be constructed with a valid Product as argument. Valid options are available in @studyportals/datalake-event-tracker/src/enums/product .

After constructing a new instance of the datalake event tracker the tracker will collect the JS-Datatracker from the window. After collecting the JS-Datatracker the event 'DatalakeEventTrackerLoaded' is dispatched and window['DatalakeEventTrackerLoaded'] = true; is set. This way you will be able to collect or wait for the tracker.

After initiating the tracker you will be able to track events by using the tracker.TrackStructuredEvents method:

import { Product, Action, Tracker } from "@studyportals/datalake-event-tracker";

const category = Product.BESTFIT_OVERVIEW;
const tracker = new Tracker(category);

const trackingData: object = {
	action: Action.CLICK,
	label: 'label_example',
	property: 'property_example',
	value: 420
}

tracker.trackStructuredEvent(trackingData);

Product & Action

The category(product) and action need to exist as an enum. This way we won't have conflicting names or variations. Additions to these enumerations might be done within this repository.

You can import the available product and action enumerations like so:

import { Product } from "@studyportals/datalake-event-tracker";
import { Action } from "@studyportals/datalake-event-tracker";

naming convention

The following naming convention will be enforced. An error will be thrown when an event is not valid according to the agreed upon convention. category(product): PascalCase action: snake_case label: snake_case property: snake_case value: decimal

how to name

The following rule-set can be applied to all the events to track:

  • Category: Define the product associated to the tracking
  • Action: Define the global action for this event. The action doesn't contain any specific information about the action itself. e.g. click, impressions, non_interactive, popup_open
  • Label: Define a label associated to the action e.g. If you track a 'click' event you should specify the target clicked as the label: 'button_x'. To specify more information, for example, the location of the button you use the '@' symbol: 'button_x@location_y'
  • Property: Define a detail which has context to the event. e.g. study_id, premium_level, wishlisted
  • Value: Define a number associated to the event. e.g. Bestfit score, Search position, recommendation precision

FAQs

Package last updated on 14 Oct 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc