npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@studyportals/datalake-event-tracker

v7.3.0

Published

The supporting package for the JS-Tracker

Downloads

5,051

Readme

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