This repo is a custom distribution of segmentio/analytics.js for use with NRI projects.
The following integrations (from segmentio/analytics.js-integration) are included:
- google-analytics-4
- customerio
- mixpanel
- optimizely
- pardot
Analytics.js 2 requires using segment's SAAS offering, and the official build of the legacy analytics.js for standalone use is no longer updated and does not include GA4. This repo is a fork of analytics.js that includes the community-supported GA4 integration.
This repo uses nix and direnv to provide build tooling.
direnv allow
npm install
npm run build
Install the integration via gitpkg:
npm install 'https://gitpkg.now.sh/segmentio/analytics.js-integrations/integrations/<my-integration>?2d65a8eb942c8ff45f29dad908a063b36d7648eb'
Add your new integration to lib/index.js:
const integrations = [
require("@segment/analytics.js-integration-<my-integration>"),
];
Build the custom distribution:
npm run build
Available integrations are in the segmentio/analytics.js-integrations monorepo.
Neither the monorepo nor the individual integrations are published to npm; for this reason gitpkg is used to install integrations via npm so that we don't have to muck with git submodules or install the entire integrations repo via npm.
- Commit your updated build and push it to Github
- Update
analytics
in NoRedInk/vendor-assets bower.json with the latest commit SHA that includes your updated build - Continue with the steps to update vendor-assets
For more information and usage, please see the upstream documentation.