analyticsjs-boilerplate

Examples and best practices for using analytics.js

  • Owner: philipwalton/analyticsjs-boilerplate
  • Platform:
  • License:: ISC License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

analytics.js boilerplate

Best practices for implementing analytics.js on modern websites.

For an in-depth explanation of all the features used in this boilerplate (as well as how to report on them), see my article:

The Google Analytics Setup I Use on Every Site I Build

Boilerplate versions

analytics/base.js

The base boilerplate extends the default tracking snippet and includes the following features:

  • Tracks uncaught errors.
  • Tracks custom user, session, and hit-level dimensions.
  • Sends an initial pageview.
  • Sends a pageload performance event.

analytics/autotrack.js

The autotrack boilerplate builds on top the base boilerplate and includes select autotrack plugins

analytics/multiple-trackers.js

The multiple-trackers boilerplate builds on the autotrack boilerplate and includes support for using multiple trackers.

Running the boilerplate locally

analytics.js boilerplate uses webpack to compile the source and webpack-dev-server to run it locally.

To install the dependencies and load the boilerplate in a browser, run the following commands:

npm install
npm start

Then visit localhost:8080 in your browser and open the developer console to see the analytics.js debug output.

Running different boilerplate versions

The boilerplate index.js JavaScript file imports the base boilerplate by default. To run a different version, replace the URL imported via import('./analytics/base.js') with the version you want to load.

Main metrics

Overview
Name With Ownerphilipwalton/analyticsjs-boilerplate
Primary LanguageJavaScript
Program languageHTML (Language Count: 2)
Platform
License:ISC License
所有者活动
Created At2017-02-01 17:41:52
Pushed At2017-09-09 18:10:53
Last Commit At2017-09-09 11:10:20
Release Count3
Last Release Name0.2.1 (Posted on )
First Release Name0.1.0 (Posted on )
用户参与
Stargazers Count1.1k
Watchers Count52
Fork Count58
Commits Count46
Has Issues Enabled
Issues Count17
Issue Open Count5
Pull Requests Count4
Pull Requests Open Count1
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private