{"id":13415497,"url":"https://github.com/philipwalton/analyticsjs-boilerplate","last_synced_at":"2025-04-04T06:08:46.005Z","repository":{"id":145704785,"uuid":"80646080","full_name":"philipwalton/analyticsjs-boilerplate","owner":"philipwalton","description":"Examples and best practices for using analytics.js","archived":false,"fork":false,"pushed_at":"2017-09-09T18:10:53.000Z","size":47,"stargazers_count":1128,"open_issues_count":6,"forks_count":58,"subscribers_count":52,"default_branch":"master","last_synced_at":"2025-03-28T05:12:04.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/philipwalton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-01T17:41:52.000Z","updated_at":"2025-02-26T15:39:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbc14362-f750-4f29-ba31-dc7de2e814eb","html_url":"https://github.com/philipwalton/analyticsjs-boilerplate","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipwalton%2Fanalyticsjs-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipwalton%2Fanalyticsjs-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipwalton%2Fanalyticsjs-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipwalton%2Fanalyticsjs-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philipwalton","download_url":"https://codeload.github.com/philipwalton/analyticsjs-boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128751,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T21:00:49.761Z","updated_at":"2025-04-04T06:08:45.982Z","avatar_url":"https://github.com/philipwalton.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"# analytics.js boilerplate\n\nBest practices for implementing analytics.js on modern websites.\n\nFor an in-depth explanation of all the features used in this boilerplate (as well as how to report on them), see my article:\n\n[**The Google Analytics Setup I Use on Every Site I Build**](https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/) \u0026#8594;\n\n## Boilerplate versions\n\n### [`analytics/base.js`](/src/analytics/base.js)\n\nThe base boilerplate extends the [default tracking snippet](https://developers.google.com/analytics/devguides/collection/analyticsjs/#alternative_async_tracking_snippet) and includes the following features:\n\n- Tracks uncaught errors.\n- Tracks custom user, session, and hit-level dimensions.\n- Sends an initial pageview.\n- Sends a pageload performance event.\n\n### [`analytics/autotrack.js`](/src/analytics/autotrack.js)\n\nThe autotrack boilerplate builds on top the base boilerplate and includes [select autotrack plugins](https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/#using-autotrack-plugins)\n\n### [`analytics/multiple-trackers.js`](/src/analytics/multiple-trackers.js)\n\nThe multiple-trackers boilerplate builds on the autotrack boilerplate and includes support for using [multiple trackers](https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/#testing-your-implementation).\n\n## Running the boilerplate locally\n\nanalytics.js boilerplate uses [webpack](https://webpack.js.org/) to compile the source and [webpack-dev-server](https://github.com/webpack/webpack-dev-server) to run it locally.\n\nTo install the dependencies and load the boilerplate in a browser, run the following commands:\n\n```sh\nnpm install\nnpm start\n```\n\nThen visit [localhost:8080](http://localhost:8080) in your browser and open the developer console to see the analytics.js debug output.\n\n### Running different boilerplate versions\n\nThe boilerplate [`index.js`](/src/index.js#L7) 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipwalton%2Fanalyticsjs-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilipwalton%2Fanalyticsjs-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipwalton%2Fanalyticsjs-boilerplate/lists"}