Fetch

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 --save

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 asayer = new Asayer({
projectID: PROJECT_ID,
});
asayer.start();
export const fetch = asayer.use(trackerFetch());
fetch('https://api.asayer.io/').then(response => console.log(response.json()));