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

fetch-track

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-track

Simple method to fire analytics events using window.fetch. Highly customizable, lightweight, no dependencies.

  • 0.1.0
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Fetch Track

Simple method to fire analytics events using window.fetch. Highly customizable, lightweight, no dependencies.

If window.fetch does not exist (e.g. old browser), this library does nothing.

Installation

NPM: npm install --save fetch-track

Yarn: yarn add fetch-track

Configuration

Can call this multiple times if needed.

Minimum options:

import {track} from 'fetch-track';

track.config({
  url: 'https://example.com/api/track'
});

All options:

import {track} from 'fetch-track';

// These are all the possible config options, only pass what you need
track.config({
  method: 'POST',
  url: 'https://example.com/api/track',
  headers: {},
  defaultProperties: {
    userId: 1
  },
  includeUserAgent: true,
  includeUrl: true
});

Usage

Event with optional properties:

import {track} from 'fetch-track';

track('Clicked Button', {
  color: 'blue'
})

FAQs

Package last updated on 05 May 2020

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