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

cryptid

v0.5.0

Published

javascript client to cryptid analytics

Downloads

5

Readme

cryptid-js

Javascript client for Cryptid Analytics

This library should be used to integrate Cryptid Analytics into web-based javascript applications (React, Vue, etc. or a simple script tag at the bottome of a static page.)

For React Native javascript projects, use cryptid-react-native, which will gather device information rather than browser information.

Install

To install into a project:

npm install cryptid --save

To install for CLI usage only:

npm install cryptid --global

Configure

Create a new Tracker using the trackerId of the property you're tracking.

import Tracker from 'cryptid';

const tracker = new Tracker('web|AB5A928D-7244-4A07-9653-E4557C500C53')

You may also supply additional options as a second argument. They will be passed through to the reqwest ajax call.

import Tracker from 'cryptid';

const tracker = new Tracker('web|AB5A928D-7244-4A07-9653-E4557C500C53', {
  success: (response) => console.log(response),
  error: (err) => console.error(err),
});

React/Redux

In a react+redux application, you may want to consider intializing a Tracker instance in your store, and then tracking events when actions are fired or when reducers commit changes to the store.

Use

Tracker has one method: send, which is used to send an event to the cryptid service. When you call send the library gathers browser metadata to include with the event data you supply. All of this metadata may be overridden by fields you include on the event object (see the Events section below.)

Simple example:

tracker.send({eventValue: 'button-clicked'});

More complex:

tracker.send({
  eventCategory: 'eCommerce',
  eventAction: 'checkout',
  eventValue: 'checkout-initiated',
  customField1: 'abc123456789', // user id
  customField2: 5, // items in cart
  customField3: 'email', // referral code
});

Events

List of fields that can be included in the event object:

| Field | Description | Required? | Example | |-------|-------------|-----------|---------| | eventCategory | Category of the event | No | Authentication | | eventAction | Action or workflow the event occured during | No | Login | | eventLabel | Label of the event | No | form-submission | | eventValue | Value of the event | Yes | button-click or enter-key | | customField_1 | Custom data | No | | | customField_2 | Custom data | No | | | customField_3 | Custom data | No | | | customField_4 | Custom data | No | | | customField_5 | Custom data | No | |

You may use the Category, Action, Label and Value event fields any way that you'd like in your application; they exist merely to allow for an event taxonomy that works for you. The simplest way to use them is to only supply an event value such as login-successful. If you don't need anything more complicated, you may omit the rest of the fields.

Likewise, the customField values are there to log supplemental application information that may bes useful to you, but are not required by the send event or the service.

List of browser metadata fields that are automatically collected and may be overridden by including them in the event object:

| Field | Description | Example | |-------|-------------|---------| | documentLocationUrl | URL of the page | http://example.org/foo.html | | documentReferer | Referrer (if any) of the page | http://google.com | | documentEncoding | The character set used on the page | UTF-8 | | documentTitle | The title of the page | My Cool Application > Login | | documentHostname | The hostname the page was served from | example.org | | documentPath | The document path of the page | /foo.html | | userLanguage | The configured language of the browser | en-US | | screenResolution | The resolution of the display | 2560x1417 | | viewportSize | The viewable size of the browser at the time of the event | 2560x1440 | | screenColors | The screen color depth | 24 |

CLI Client

Installing the cryptid module also gives you access to a command-line admin client to the cryptid analytics service.

Login to the service with:

$(npm bin)/cryptid login

And then all functionality should be available. View available commands with:

$(npm bin)/cryptid -h