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

cryptid

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cryptid

javascript client to cryptid analytics

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
2
Weekly downloads
 
Created
Source

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:

FieldDescriptionRequired?Example
eventCategoryCategory of the eventNoAuthentication
eventActionAction or workflow the event occured duringNoLogin
eventLabelLabel of the eventNoform-submission
eventValueValue of the eventYesbutton-click or enter-key
customField_1Custom dataNo
customField_2Custom dataNo
customField_3Custom dataNo
customField_4Custom dataNo
customField_5Custom dataNo

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:

FieldDescriptionExample
documentLocationUrlURL of the pagehttp://example.org/foo.html
documentRefererReferrer (if any) of the pagehttp://google.com
documentEncodingThe character set used on the pageUTF-8
documentTitleThe title of the pageMy Cool Application > Login
documentHostnameThe hostname the page was served fromexample.org
documentPathThe document path of the page/foo.html
userLanguageThe configured language of the browseren-US
screenResolutionThe resolution of the display2560x1417
viewportSizeThe viewable size of the browser at the time of the event2560x1440
screenColorsThe screen color depth24

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

FAQs

Package last updated on 30 Oct 2017

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