Centralized and agnostic way of tracking data with built-in integrations.
The current version (1.x) requires at least Node 14.
yarn
yarn add @farfetch/blackout-analytics
npm
npm i @farfetch/blackout-analytics
Make sure that you have installed the correct peer dependencies of this package:
yarn
yarn add @farfetch/blackout-client lodash-es
npm
npm i add @farfetch/blackout-client lodash-es
Note: You might also need to install the peer dependencies of @farfetch/blackout-client package if you do not have them installed yet.
IMPORTANT This package is a Pure ESM package which means it cannot be require()
'd from CommonJS. If you cannot change to ESM or want to keep using Commonjs, consider using the import()
function to load the modules from this package asynchronously.
-
If it is necessary to transpile the package, add a specific loader for it:
// Webpack example config.module.rules.push({ test: /\.jsx?$/, // This will add all @farfetch packages, lodash-es and crypto-es packages which are ESM only include: [/node_modules\/(@farfetch|lodash-es|crypto-es)/], use: [ { loader: 'babel-loader', options: myBabelConfig, }, ], // If using webpack 5, you might need this depending on the transformations used resolve: { fullySpecified: false }, });
- In order to support unit tests via jest, it is necessary to transpile the package to Commonjs by adding the following value to the
transformIgnorePatterns
option in Jest configuration:
// jest.config.js
transformIgnorePatterns: [
'/node_modules/(?!(@farfetch|lodash-es|crypto-es)).+\\.js$',
];
You just need to import and use what you need. All imports should be done from the root of the package like in the following example:
import { FromParameterTypes } from '@farfetch/blackout-analytics';
console.log(FromParameterTypes.BAG);
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Please read the CONTRIBUTING file to know what we expect from your contribution and the guidelines you should follow.
MIT @ Farfetch