This package has been deprecated

Author message:

This package is no longer maintained. Please, use @openreplay/tracker and @openreplay/tracker-fetch instead

@asayerio/tracker-fetch

5.7.1 • Public • Published

Asayer Tracker Fetch plugin

Tracker plugin to support tracking of the fetch requests payload. Additionally it populates the requests with sessionID header for backend logging.

Installation

npm i @asayerio/tracker-fetch

Usage

Initialize the @asayerio/tracker package as usual and load the plugin into it. Then you can use the provided fetch method from the plugin instead of built-in.

import Tracker from '@asayerio/tracker';
import trackerFetch from '@asayerio/tracker-fetch';

const tracker = new Tracker({
  projectID: PROJECT_ID,
});
tracker.start();

export const fetch = tracker.use(trackerFetch({
  sessionTokenHeader: 'X-Session-ID', // optional
  failuresOnly: true //optional
}));

fetch('https://api.asayer.io/').then(response => console.log(response.json()));

In case you use Asayer integrations (sentry, bugsnag or others), you can use sessionTokenHeader option to specify the header name. This header will be appended automatically to the each fetch request and will contain Asayer session identificator value.

Set failuresOnly option to true if you want to record only requests with the status code >= 400.

Readme

Keywords

Package Sidebar

Install

npm i @asayerio/tracker-fetch

Weekly Downloads

2

Version

5.7.1

License

MIT

Unpacked Size

9.36 kB

Total Files

8

Last publish

Collaborators

  • estradino