Integrating TrackJS with Common Build Configurations
This Build Integrations Repository has examples of integrating the tracker script into many common JS build tools.
Build Integration Examples
- Basic - Simplest example possible.
- AMD and RequireJS - Integrate TrackJS with a RequireJS/AMD workflow
- Bundling with Gulp - Adding TrackJS to a minified script bundle using Gulp
- Webpack and NPM - Uses exports-loader to make loading TrackJS via NPM seamless
- Browserify - Bundling TrackJS with your app bundle using Browserify
- Bower - Uses Gulp to bundle TrackJS, other bower components and your application
- JSPM and Babel - Shows how to use TrackJS with UMD and ES6
Other Build Tools
All build integrations should do two important things when loading the tracker:
- Configuration First - The
window._trackJsconfig object should exist before the tracker script is loaded. The tracker can’t determine where to send errors without it!
- Load Tracker First - The sooner you can get the tracker script on the page, the sooner you can catch errors! Many errors happen on script load. All those errors will be missed if TrackJS loads after your other scripts.