green-analytics-js
TypeScript icon, indicating that this package has built-in type declarations

1.1.14 • Public • Published

Green Analytics JS

Green Analytics javascript framework for working with the Green Analytics Project.

This framework has two main methods logEvent and setPerson.

Installation

yarn add green-analytics-js
# or
npm i --save green-analytics-js

Documentation

Get Started

To get started with this framework, you will need an account on the Green Analytics Website

Once you have the framework installed and you have an account you can initialize this framework.

initGA('<api-token>')

To get your api-token you have to go to the following page, while being signed in.

Methods

The logEvent method is made to accept various information. It takes the type of event and the event properties. It also accepts userProperties, which will be connected to the user. This can be information like the u

logEvent(
  event: {
    name: string
    type: string
    website?: {
      url: string
    }
    properties?: { [key: string]: any }
  }, 
  userProperties?: {[key:string]: any}
)

The setPerson method is used to determine what user is performing the following events that will be logged.

setPerson({
  id: string
  name?: string
  email?: string
  properties?: { [key: string]: any }
})

Constributing

This framework was built using typescript and yarn as the package manager. In addition to this the project uses biome.js to lint, and uses commitlint to lint commit messages.

The recommended IDE for developing in this project is VSCode as it supports both biome.js & commitlint as extensions. It is however still possible to use all other IDEs as the project relies on CLI to check on commit.

Readme

Keywords

none

Package Sidebar

Install

npm i green-analytics-js

Weekly Downloads

44

Version

1.1.14

License

MPL-2.0

Unpacked Size

689 kB

Total Files

13

Last publish

Collaborators

  • makakwastaken