1.4.0 • Published 4 years ago

@mutantlove/next v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

next

Official browser tracking library for the Mutant Workspace.

Install

npm install @mutantlove/next

Use

set

Attach data to every track call. Find the productId from your profile page, in the install section of your product.

import { set } from "@mutantlove/next"

set({
  productId: "123",
})

You can run set multiple times.

Ex. userId after a successful login.

import { set } from "@mutantlove/next"

const login = ({ email, password }) =>
  POST("/login", { body: { email, password } }).then(({ id }) => {
    set({
      userId: id,
    })
  })

track

Record an event your application.

  • name is required - Name of the event that you'll use to plot inside a card. An error will be thrown if not passed.
  • productId - You can either set productId once via set or explicitly add it to the track call.

We're using BEM for event naming, it's working fine till now. Also, when plotting an event in a card, the legend label will only show the M (modifier) part of BEM.

import { track } from "@mutantlove/next"

track("page__section--action-name", {
  context: "data such as",
  userId: "can be added to",
  events: "by putting it here",
})

API

Make a POST at https://api.mutant.love/track with the same requirements as before, name and productId required.

Ex. Tracking CI deployment success and failure.

curl \
  --header "Content-Type: application/json" \
  --data '{"name": "terminal-test", "productId": "uuid"}' \
  https://api.mutant.love/track

Cookies

  • mutant - Unique client id. Changes only if manually deleted.

Collected data

We automatically collect the following data with every event.

  • Screen size: width and height of viewport and screen
  • User agent
  • URL
  • Referrer
  • IP
  • Timestamp

Develop

git clone git@github.com:mutantlove/next.git && \
  cd next && \
  npm run setup

# run tests (any `*.test.js`) once
npm test

# watch `src` folder for changes and run test automatically
npm run tdd

Commit messages

Using Angular's conventions.

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

Changelog

See the releases section for details.

1.4.0

4 years ago

1.3.0

4 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago