Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
ac43e4f
Update google-analytics.md
wgwz Sep 26, 2022
bf30166
updating FullStory snippet and related bits.
rcmaples Sep 27, 2022
3557acf
Fixing some typos and adding back the _fs_debug var.
rcmaples Sep 27, 2022
362c729
Doc: replace deleteCookie for removeCookie
lucaju Oct 5, 2022
38d5850
Merge pull request #312 from wgwz/patch-2
DavidWells Oct 7, 2022
2ff3588
Update README.md
DavidWells Oct 7, 2022
b42614c
docs: update cookie docs
DavidWells Oct 7, 2022
6dad612
Merge pull request #320 from lucaju/patch-2
DavidWells Oct 7, 2022
b5b442e
pass additional user/company data to identify method
Oct 11, 2022
9024045
Merge branch 'add-custify-plugin' of github.com:realbisoye/analytics …
Oct 11, 2022
4332c8d
Warn about GA4 changes to event names
dobesv Nov 9, 2022
90e4260
Use other_event instead of app_event
dobesv Nov 9, 2022
05bbd03
Merge pull request #317 from realbisoye/add-custify-plugin
DavidWells Nov 9, 2022
429ec22
Merge pull request #303 from xanderberkein/customScriptSrc-customerio
DavidWells Nov 9, 2022
03b04e0
docs: customScriptSrc is optional
DavidWells Nov 9, 2022
3e3ed83
docs: update docs
DavidWells Nov 9, 2022
8151c61
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 9, 2022
40035c8
fix: missing loadPlugin #283
DavidWells Nov 9, 2022
47f1edd
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 9, 2022
f3f02cc
Merge pull request #299 from dobesv/patch-4
DavidWells Nov 9, 2022
ac3288d
Merge pull request #300 from dobesv/patch-5
DavidWells Nov 9, 2022
08dc56d
Merge pull request #302 from sliderule-analytics/pre-installed-gtag-c…
DavidWells Nov 9, 2022
43a3a65
Merge pull request #335 from dobesv/patch-7
DavidWells Nov 9, 2022
0eedce6
chore: update docs for GA4
DavidWells Nov 9, 2022
b4e3888
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 9, 2022
1133416
Merge pull request #307 from AdrienFery/master
DavidWells Nov 9, 2022
6aeed79
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 9, 2022
a0f628a
Merge pull request #313 from rcmaples/rcmaples/fullstory-updates
DavidWells Nov 9, 2022
3cc48e4
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 9, 2022
cfa313e
Merge pull request #269 from frknbasaran/master
DavidWells Nov 9, 2022
bc87e82
docs: add countly plugin
DavidWells Nov 9, 2022
fbcef08
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 9, 2022
a4ac4db
fix: readme typo and unnecessary duplication.
frknbasaran Nov 9, 2022
40e07b5
Mark analytics.plugins.disable callback as optional
dobesv Nov 9, 2022
0fb5860
Merge pull request #336 from frknbasaran/patch-2
DavidWells Nov 10, 2022
4f1b007
Update README.md
Scott-Fischer Nov 14, 2022
dc9b168
Don't assume gtag is setup if dataLayer is
dobesv Nov 17, 2022
947d02f
Fix log message in GTM track event method
dobesv Nov 17, 2022
09d6897
[chore] add note for future updates
DavidWells Dec 11, 2022
2d4ec7b
Add in user data to all events if there is some
clarkieryan Jan 7, 2023
6000fa7
Add in user data to all events if there is some
clarkieryan Jan 7, 2023
244ff1a
Add in user data to all events if there is some
clarkieryan Jan 7, 2023
2065080
Add in user data to all events if there is some
clarkieryan Jan 7, 2023
0a74d30
tweak checks to ensure they work on react native
Mar 15, 2023
b6d101e
add missing &&
Mar 15, 2023
89e1caf
feat: added support for PostHog
wlecki Mar 31, 2023
f4349ab
Merge pull request #373 from metro-fs/feat/add-posthog-external-plugin
DavidWells May 1, 2023
7390fba
docs: add posthog
DavidWells May 1, 2023
a2684a0
Merge pull request #374 from DavidWells/dw/update-readme
DavidWells May 1, 2023
14c84d2
Update google-analytics.md
pulkitsethi May 18, 2023
83e2131
feat: upgraded react version to v16 and removed mini-create-react-con…
prisis May 23, 2023
fe8e86f
fix: missing script src
DavidWells May 27, 2023
336f08a
chore: lock file
DavidWells May 27, 2023
e1bcd22
chore: fix pnpm commands
DavidWells May 27, 2023
587a2ec
chore(release): :tada: :rocket: [skip ci]
DavidWells May 27, 2023
616d761
Merge pull request #343 from dobesv/gtag-setup-fix
DavidWells May 27, 2023
47c1a78
Merge pull request #378 from pulkitsethi/patch-2
DavidWells May 27, 2023
9b55708
docs: update GA docs for new id formal
DavidWells May 27, 2023
cc3e7c4
chore(release): :tada: :rocket: [skip ci]
DavidWells May 27, 2023
9efe41e
Merge pull request #367 from oddnavy/david/react-native-support
DavidWells May 27, 2023
f483ad7
chore: lock file
DavidWells May 27, 2023
904e8bc
chore(release): :tada: :rocket: [skip ci]
DavidWells May 27, 2023
6ace4f4
chore: dummy commit
DavidWells May 27, 2023
95a4dfb
chore(release): :tada: :rocket: [skip ci]
DavidWells May 27, 2023
2d72376
Merge pull request #351 from clarkieryan/master
DavidWells May 27, 2023
e660491
refactor: attach user id if assigned
DavidWells May 27, 2023
56ce22c
chore(release): :tada: :rocket: [skip ci]
DavidWells May 27, 2023
a039e68
Merge pull request #379 from PrisisForks/update_react_version
DavidWells May 27, 2023
b9ce335
chore: lock file
DavidWells May 27, 2023
e33ddfd
chore: bump use-analytics for newer react versions
DavidWells May 27, 2023
14e1dce
chore: fix grammar #341
DavidWells May 27, 2023
98d6b05
Merge pull request #341 from Scott-Fischer/fix-typo
DavidWells May 27, 2023
83e1542
chore: update readmes
DavidWells May 27, 2023
bd05fbc
Merge pull request #344 from dobesv/gtm-debug-log-fix
DavidWells May 27, 2023
82216bf
docs: update site api docs
DavidWells May 28, 2023
32d1a97
Merge branch 'master' of github.com:DavidWells/analytics
DavidWells May 28, 2023
56787c6
Remove react global and fix jsx in build
grumpyoldman-io Jun 14, 2023
92379a6
Merge pull request #383 from grumpyoldman-io/381-fix-use-analytics
DavidWells Jun 15, 2023
8a7c41c
chore: update build for pnpm
DavidWells Jun 16, 2023
3f48f1d
chore: update build for pnpm
DavidWells Jun 16, 2023
698def1
chore(release): :tada: :rocket: [skip ci]
DavidWells Jun 16, 2023
e5ddc0e
chore: bump core for release
DavidWells Jun 16, 2023
935e9cb
chore(release): :tada: :rocket: [skip ci]
DavidWells Jun 16, 2023
028694f
feat: added support for Planhat
WarreH Jun 28, 2023
4658d3a
Merge pull request #386 from WarreH/feat/add-planhat-external-plugin
DavidWells Jul 18, 2023
f1ebe4e
docs: update versions and add planhat plugin
DavidWells Jul 18, 2023
ce94d94
Update README.md
lucas-av7 Jul 27, 2023
314254b
refactor: pinpoint check. fixes #372
DavidWells Jul 28, 2023
ba02d13
chore(release): :tada: :rocket: [skip ci]
DavidWells Jul 28, 2023
515f8c2
fix: crash in analytics.reset for aws pinpoint
renzil Aug 14, 2023
d5b7009
docs: update readme usage of Google Analytics plugin
gpoole Sep 6, 2023
bba84bd
add nextjs example
dylanmeivis Oct 17, 2023
855396f
Merge pull request #406 from dylanmeivis/add-nextjs-example
DavidWells Oct 26, 2023
844d2bc
feat: add allowParams to simple analytics
DavidWells Nov 2, 2023
3c662a1
Merge pull request #411 from DavidWells/simple-analytics-params
DavidWells Nov 2, 2023
8d8de03
chore(release): :tada: :rocket: [skip ci]
DavidWells Nov 2, 2023
0575641
docs: update simple analytics docs
DavidWells Nov 2, 2023
585dc33
Update README.md
DavidWells Nov 25, 2023
5338699
feat: update node segment package BREAKING
DavidWells Dec 6, 2023
757bed7
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Dec 6, 2023
287c5ac
chore: release breaking segment change for server implementation clos…
DavidWells Dec 6, 2023
6f1d7af
chore: update segment docs
DavidWells Dec 6, 2023
ab39bb5
feat: add support for comma separated values & dom arrays
DavidWells Dec 31, 2023
b90c141
docs: update demo
DavidWells Dec 31, 2023
95db3ea
chore(release): :tada: :rocket: [skip ci]
DavidWells Dec 31, 2023
545b372
docs: update docs
DavidWells Dec 31, 2023
dca32cb
docs: add posthog plugin
DavidWells Jan 17, 2024
3795f45
Fixed sample vanilla HTML code
rajnandan1 Feb 6, 2024
58b1849
fix: add abort to queue drain and make queue methods abortable. Fixes…
DavidWells Feb 12, 2024
3671ab3
chore: update demo
DavidWells Feb 12, 2024
a46c1ba
chore(release): :tada: :rocket: [skip ci]
DavidWells Feb 12, 2024
7e81ab5
chore: version
DavidWells Feb 12, 2024
33a5195
chore(release): :tada: :rocket: [skip ci]
DavidWells Feb 12, 2024
4922566
chore: deps
DavidWells Feb 12, 2024
46392ce
Merge pull request #396 from lucas-av7/patch-2
DavidWells Feb 12, 2024
03aef6d
Merge pull request #420 from rajnandan1/patch-4
DavidWells Feb 22, 2024
7859858
feat: add isExpired to session utils
DavidWells Feb 24, 2024
9547057
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Feb 24, 2024
0f538fe
chore(release): :tada: :rocket: [skip ci]
DavidWells Feb 24, 2024
d36ea4d
docs: update session demo
DavidWells Feb 24, 2024
635f196
chore: site update
DavidWells Apr 5, 2024
bbf96ab
chore: docs and add mailmoto plugin
DavidWells Apr 5, 2024
3b42f7b
chore: mailmoto docs
DavidWells Apr 5, 2024
6ebc98a
Fix missing comma in example code
jamesbeith May 16, 2024
91ebb28
Merge pull request #434 from jamesbeith/patch-2
DavidWells May 17, 2024
27cff33
docs: update netlify links
DavidWells May 29, 2024
ef80155
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells May 29, 2024
2c12762
chore: version as number or string
DavidWells May 30, 2024
7ef4992
docs: version as string or number
DavidWells May 30, 2024
c2c4169
chore(release): :tada: :rocket: [skip ci]
DavidWells May 30, 2024
3e15ba2
chore: bump
DavidWells May 30, 2024
30cf819
chore(release): :tada: :rocket: [skip ci]
DavidWells May 30, 2024
332dc2b
docs: add publishing note
DavidWells May 30, 2024
3eeba10
docs: hoist history out of react state
DavidWells May 30, 2024
27326a4
Update intercom.md typo
jorgearuv Jun 14, 2024
03c8e43
chore: demo update
DavidWells Jul 29, 2024
d58f70d
fix: fix typedef
DavidWells Jul 29, 2024
a6c46a3
chore(release): :tada: :rocket: [skip ci]
DavidWells Jul 29, 2024
cbdae89
Merge pull request #444 from jorgeruvalcaba/patch-2
DavidWells Aug 12, 2024
505f077
Update README.md
DavidWells Aug 12, 2024
abd2b28
feat: #235 add csp nonce for google tag and analytics packages
next0 Aug 14, 2024
fae8095
add @analytics/churn-zero plugin
aonawale Aug 28, 2024
10ede37
update provider name
aonawale Aug 29, 2024
393d346
temporarily including compiled lib files
aonawale Aug 30, 2024
f8b78d6
skip setting account name
aonawale Oct 21, 2024
dd5333e
build files
aonawale Oct 21, 2024
18c3671
fix: #453 param parser
DavidWells Dec 11, 2024
b5f16e8
test: add param parse test
DavidWells Dec 11, 2024
a9e0fdc
chore(release): :tada: :rocket: [skip ci]
DavidWells Dec 11, 2024
6241025
Merge pull request #451 from aonawale/add-churnzero-plugin
DavidWells Dec 11, 2024
ed7cb64
chore: remove built assets
DavidWells Dec 11, 2024
acd1609
Merge pull request #448 from next0/feature/csp-nonce-235
DavidWells Dec 11, 2024
8730d1b
chore(release): :tada: :rocket: [skip ci]
DavidWells Dec 11, 2024
236a27a
Merge pull request #400 from gpoole/patch-2
DavidWells Dec 11, 2024
910dc9b
Merge pull request #397 from renzil/renzil/aws-pinpoint-reset-crash-fix
DavidWells Dec 11, 2024
629ff09
chore(release): :tada: :rocket: [skip ci]
DavidWells Dec 11, 2024
a19aa50
Merge pull request #337 from dobesv/plugins-disable-cb-optional-fixup
DavidWells Dec 11, 2024
b693e2b
fix: #391 param parse
DavidWells Dec 12, 2024
80d7fd3
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Dec 12, 2024
52239ca
chore(release): :tada: :rocket: [skip ci]
DavidWells Dec 12, 2024
d1f0a01
Close #456
DavidWells Mar 19, 2025
5aed1ac
chore(release): :tada: :rocket: [skip ci]
DavidWells Mar 19, 2025
faa8996
fix(types): `AnalyticsPlugin` definition
amitbeck Apr 6, 2025
7744759
Update external-plugins.json
grozwalker Apr 17, 2025
02f7632
Merge pull request #459 from grozwalker/patch-2
DavidWells May 29, 2025
c5ef2b6
Add Claude Code GitHub Actions workflow
DavidWells Jun 19, 2025
39a862d
Merge pull request #233 from nougad/pinpoint-attribute-length
DavidWells Jun 19, 2025
1899d79
🤖 Claude Code: Automated fix for Issue #468
Jun 19, 2025
f28f7bc
Convert React demo files from .js to .jsx extension and update imports
DavidWells Jun 19, 2025
e3a0ac9
feat: update React to v19.1.0 in demo app
claude[bot] Jun 19, 2025
92401d2
Fix duplicate page view tracking on initial mount
DavidWells Jun 19, 2025
ea7d13f
Merge pull request #469 from DavidWells/claude-fix/issue-468-20250619…
DavidWells Jun 19, 2025
32d05e4
Simplify GitHub Actions PR creation logic
DavidWells Jun 19, 2025
029957b
set branch name again
DavidWells Jun 19, 2025
98aa237
Remove TypeScript files from nextjs-app-router example
claude Jun 19, 2025
8805556
🤖 Claude Code: Automated fix for Issue #470
claude Jun 19, 2025
885cbc2
Add JSDoc annotations to Next.js app router components
claude[bot] Jun 19, 2025
f81f948
Configure Next.js for static export and add logger plugin
DavidWells Jun 20, 2025
103ea71
Merge pull request #472 from DavidWells/claude-fix/issue-470-20250619…
DavidWells Jun 20, 2025
f9fb38d
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Jun 20, 2025
05c5e5f
what
DavidWells Jun 20, 2025
9cf3a86
Fix GitHub workflow variable reference from CLAUDE_BRANCH to claude_b…
DavidWells Jun 20, 2025
8d26543
Improve GitHub workflow change detection for branch-based comparison
DavidWells Jun 20, 2025
3df3841
delete artifact
DavidWells Jun 20, 2025
a9d4d34
Fix GitHub workflow to sync remote state and check for changes before…
DavidWells Jun 20, 2025
3573552
Optimize GitHub workflow to use selective branch fetching
DavidWells Jun 20, 2025
864f0c2
Improve GitHub workflow branch alignment to prevent inconsistent state
DavidWells Jun 20, 2025
fe109a4
Clean up GitHub workflow by removing comments and fixing branch check…
DavidWells Jun 20, 2025
557d78c
Enhance GitHub workflow debugging with git state tracking and branch …
DavidWells Jun 20, 2025
55c2e7a
Add GitHub sponsor link to README
claude[bot] Jun 20, 2025
021665f
Merge pull request #481 from DavidWells/claude/issue-480-20250620_212838
DavidWells Jun 20, 2025
691795c
Enhance GitHub workflow PR creation to handle existing pull requests …
DavidWells Jun 20, 2025
0a3f899
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Jun 20, 2025
d276354
yolo
DavidWells Jun 20, 2025
ac4f337
Add linked PR detection to GitHub workflow context
DavidWells Jun 21, 2025
0acbb7f
Add early exit for issues with existing linked PRs
DavidWells Jun 21, 2025
a312a1b
log
DavidWells Jun 21, 2025
cc48077
linked PRs
DavidWells Jun 21, 2025
1fc9b63
try smarter flow
DavidWells Jun 21, 2025
9b5e4c1
docs: add emoji and package manager install instructions
claude[bot] Jun 21, 2025
54e97c2
fix double outputs
DavidWells Jun 21, 2025
7b1c24a
fix git check
DavidWells Jun 21, 2025
2390113
try sticky
DavidWells Jun 21, 2025
c3fe44a
feat: enhance examples README with comprehensive documentation
claude[bot] Jun 21, 2025
d93bc01
update sticky
DavidWells Jun 21, 2025
1e21fa9
Merge pull request #487 from DavidWells/claude/issue-486-20250621_015540
DavidWells Jun 21, 2025
a680ca7
issue number
DavidWells Jun 21, 2025
5cefcaa
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Jun 21, 2025
feef886
fix: enhance GitHub workflow with consistent sticky comment updates a…
DavidWells Jun 21, 2025
e3c79ef
feat: update Node.js version requirement to 18+ in examples README
claude[bot] Jun 21, 2025
e802c3d
Merge pull request #491 from DavidWells/claude/issue-488-20250621_023722
DavidWells Jun 21, 2025
75ff454
messages
DavidWells Jun 21, 2025
5def260
fix body
DavidWells Jun 21, 2025
a4668bc
Merge branch 'master' of https://github.com/DavidWells/analytics
DavidWells Jun 21, 2025
d7c7477
docs: add pnpm installation and usage instructions to CONTRIBUTING.md
claude[bot] Jun 21, 2025
f71336d
Merge pull request #495 from DavidWells/claude/issue-494-20250621_031340
DavidWells Jun 23, 2025
64c6974
Merge pull request #458 from amitbeck/patch-2
DavidWells Jul 18, 2025
a2ee5c6
chore: update esm imports
DavidWells Jul 18, 2025
2e71a85
tests: change to uvu
DavidWells Jul 18, 2025
8dd45ad
chore: fix type output
DavidWells Jul 18, 2025
bac6f2e
chore: update ci
DavidWells Jul 18, 2025
79d7963
chore: update ci
DavidWells Jul 18, 2025
b89fb3a
feat: enable treeshakeable exports for analytics-utils
claude[bot] Jul 18, 2025
f11c814
fix: update uvu test scripts to match .test.js files consistently
claude[bot] Jul 18, 2025
57e1825
chore: update tests and build and add turbo repo
DavidWells Jul 18, 2025
441f76d
chore: add clear-dist script
DavidWells Jul 18, 2025
375e5f1
chore: add turbo
DavidWells Jul 18, 2025
0fa2d32
Merge pull request #498 from DavidWells/update-tests
DavidWells Jul 18, 2025
bc14ca8
chore: lock
DavidWells Jul 18, 2025
704ae93
feat: enhance analytics-util-activity with TypeScript support and imp…
DavidWells Aug 6, 2025
ddd8bc5
chore: update pnpm-lock.yaml to include TypeScript 5.9.2 and modify t…
DavidWells Aug 6, 2025
e99ddd2
chore: ignore
DavidWells Aug 6, 2025
4f3dad2
chore(release): :tada: :rocket: [skip ci]
DavidWells Aug 6, 2025
219df7b
fix: update TypeScript types and enhance JSDoc comments in analytics-…
DavidWells Aug 6, 2025
c69e93a
chore(release): :tada: :rocket: [skip ci]
DavidWells Aug 6, 2025
6e721e2
fix: update package.json main fields to use .cjs extension and add bu…
DavidWells Aug 7, 2025
daa78b6
chore: add type
DavidWells Aug 7, 2025
96a8643
chore(release): :tada: :rocket: [skip ci]
DavidWells Aug 7, 2025
76a12cc
Merge pull request #502 from DavidWells/claude/issue-478-20250621_005745
DavidWells Aug 7, 2025
2056d45
fix: utils demo
DavidWells Aug 9, 2025
07e38cb
chore: update package dependencies and configurations
DavidWells Aug 9, 2025
978a6ec
Merge branch 'master' of github.com:DavidWells/analytics
DavidWells Aug 9, 2025
50e8791
feat: add installation verification tests for CommonJS and ESM
DavidWells Aug 9, 2025
b926914
fix lerna
DavidWells Aug 9, 2025
796c1d3
fix lerna
DavidWells Aug 9, 2025
1aaf396
chore(release): :tada: :rocket: [skip ci]
DavidWells Aug 9, 2025
2c4ec9d
Added Pirsch Analytics to readme.
Kugelschieber Aug 27, 2025
f397d7b
Merge pull request #504 from pirsch-analytics/master
DavidWells Aug 28, 2025
af99ba6
Update external-plugins.json
DavidWells Sep 3, 2025
a03d6c2
chore(deps): bump lodash from 4.17.14 to 4.18.1 in /site
dependabot[bot] Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,335 changes: 1,335 additions & 0 deletions .github/workflows/claude.yml

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# node / npm
node_modules
.size-snapshot.json
package-lock.json
*.log
.netlify

_misc

# turbo cache
.turbo
# nx cache
.nx
# IDE stuff
**/.idea

Expand All @@ -16,4 +22,7 @@ misc
queues
TODO.md
types/
misc.js
misc.js

### VisualStudioCode ###
.vscode/*
45 changes: 32 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,27 @@ please read the [code of conduct](CODE_OF_CONDUCT.md).

> Install node & npm on your system: [https://nodejs.org/en/download/](https://nodejs.org/en/download/)

### Package Manager

This project uses **pnpm** as the package manager. If you don't have pnpm installed, you can install it globally:

```sh
# Install pnpm globally
npm install -g pnpm

# Or using other methods:
# curl -fsSL https://get.pnpm.io/install.sh | sh -
# brew install pnpm (on macOS)
```

### Install dependencies

> Only required when setting up the project

```sh
$ git clone https://github.com/davidwells/analytics
$ cd analytics
$ npm run setup
$ pnpm run setup
```

Because analytics has a large number of packages, we need to also [install watchman](https://facebook.github.io/watchman/docs/install.html) for better watching.
Expand All @@ -28,11 +41,11 @@ brew install watchman

To run analytics locally follow these steps:

1. Make sure you have run `npm run setup` to install all packages
2. Run `npm run build` to ensure analytics packages are built
3. Run watch mode `npm run watch` to have changes reflected live in the demo app.
4. In a new terminal window, change directories into the [`/examples/demo`](https://github.com/DavidWells/analytics/tree/master/examples/demo) folder & install the demo apps dependencies `npm install`
5. Finally, you can start the demo app with `npm start`
1. Make sure you have run `pnpm run setup` to install all packages
2. Run `pnpm run build` to ensure analytics packages are built
3. Run watch mode `pnpm run watch` to have changes reflected live in the demo app.
4. In a new terminal window, change directories into the [`/examples/demo`](https://github.com/DavidWells/analytics/tree/master/examples/demo) folder & install the demo apps dependencies `pnpm install`
5. Finally, you can start the demo app with `pnpm start`

If you have any questions please ping [@DavidWells](https://twitter.com/davidwells) on Twitter.

Expand All @@ -45,7 +58,7 @@ Installs and sets up all analytics package dependencies.
#### Usage

```sh
$ npm run setup
$ pnpm run setup
```

### `watch`
Expand All @@ -55,7 +68,7 @@ Watches all `analytics` packages and builds them on change.
#### Usage

```sh
$ npm run watch
$ pnpm run watch
```

### `clean`
Expand All @@ -65,7 +78,7 @@ Removes all of the `analytics` packages `dist` directories.
#### Usage

```sh
npm run clean
pnpm run clean
```

### `reset`
Expand All @@ -75,7 +88,7 @@ Runs the `clean` script and removes all the `node_modules` from the `analytics`
#### Usage

```sh
npm run reset
pnpm run reset
```

### `build`
Expand All @@ -85,7 +98,7 @@ Runs the `clean` script and builds the `analytics` packages.
#### Usage

```sh
npm run build
pnpm run build
```

### `test`
Expand All @@ -95,7 +108,7 @@ Runs all the `analytics` packages tests.
#### Usage

```sh
npm run test
pnpm run test
```

## Pull Requests
Expand All @@ -110,10 +123,16 @@ Analytics uses the [Forking Workflow](https://www.atlassian.com/git/tutorials/co
2. Create a branch from `master`. If you're addressing a specific issue, prefix your branch name with the issue number.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Run `npm run test` and ensure the test suite passes.
4. Run `pnpm run test` and ensure the test suite passes.
6. PR's must be rebased before merge (feel free to ask for help).
7. PR should be reviewed by two maintainers prior to merging.

## Troubleshooting

`Publishing error`

`Hard link is not allowed` means the node_modules folder is in the npm package. Delete those from /analytics-core/{client|server} dirs.

## License

By contributing to `analytics`, you agree that your contributions will be licensed
Expand Down
101 changes: 65 additions & 36 deletions README.md

Large diffs are not rendered by default.

121 changes: 114 additions & 7 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,116 @@
# Analytics Examples

- [Kitchen sink demo](./demo)
- [React example](./react)
- [use-analytics react hooks with React Router v6](https://github.com/DavidWells/use-analytics-with-react-router-demo)
- [HTML example](./vanilla-html)
- [Preact example](./preact)
- [Vue example](./vue)
- [Track performance metrics example](./using-perfumejs)
This directory contains comprehensive examples demonstrating how to use the Analytics library across different frameworks and scenarios. Each example includes complete setup instructions, live demos (where available), and detailed implementation guides.

## 🚀 Framework Examples

### [Kitchen Sink Demo](./demo)
**Full-featured demo application with comprehensive analytics setup**
- **Framework**: React with Vite
- **Features**: Complete analytics implementation with multiple plugins, event tracking, user identification, and real-time analytics debugging
- **Live Demo**: Available locally
- **Best For**: Understanding all analytics features, testing plugin configurations, and development workflows
- **Key Files**: `./src/utils/analytics/` contains various configuration examples
- **Setup**: Requires building local packages first (`npm run setup && npm run build` from repo root)

### [React Example](./react)
**Production-ready React application with analytics integration**
- **Framework**: React with routing
- **Features**: Page view tracking, component-level analytics, React Router integration
- **Live Demo**: [https://analytics-react-example.netlify.app/](https://analytics-react-example.netlify.app/)
- **Best For**: React applications with client-side routing
- **Key Files**: `./src/components/Layout` for analytics setup
- **Setup**: Standard React app setup with `npm install && npm start`

### [Next.js App Router Example](./nextjs-app-router)
**Modern Next.js 13+ app router implementation**
- **Framework**: Next.js with App Router
- **Features**: Server-side rendering compatibility, automatic page tracking, React hooks integration
- **Best For**: Next.js applications using the new app router pattern
- **Key Files**: `/src/app/analytics.tsx` and `/src/app/layout.tsx`
- **Setup**: `npm install && npm run dev`

### [HTML/Vanilla JavaScript Example](./vanilla-html)
**Simple browser-based implementation using CDN**
- **Framework**: Plain HTML/JavaScript
- **Features**: CDN-based loading, minimal setup, browser compatibility
- **Live Demo**: [https://analytics-html-example.netlify.app/](https://analytics-html-example.netlify.app/)
- **Best For**: Static websites, simple integrations, quick prototyping
- **Key Features**: No build process required, works with any website
- **Setup**: Open `index.html` in browser or serve statically

### [Preact Example](./preact)
**Lightweight Preact application with routing**
- **Framework**: Preact with Preact Router
- **Features**: Small bundle size, React-like development experience, automatic page tracking
- **Live Demo**: [https://analytics-preact-example.netlify.app/](https://analytics-preact-example.netlify.app/)
- **Best For**: Performance-conscious applications, smaller bundle requirements
- **Key Files**: `/src/analytics.js` for setup
- **Setup**: `npm install && npm run dev`

### [Vue Example](./vue)
**Vue.js application with Vue Router integration**
- **Framework**: Vue.js with Vue Router
- **Features**: Vue ecosystem integration, automatic page view tracking via router hooks
- **Best For**: Vue.js applications with client-side routing
- **Key Files**: `./src/main.js` & `./src/analytics.js`
- **Router Integration**: Page views fired from `router.afterEach` events
- **Setup**: `npm install && npm run serve`

## 🔧 Specialized Examples

### [Performance Tracking with Perfume.js](./using-perfumejs)
**Advanced performance monitoring integration**
- **Framework**: React with Perfume.js
- **Features**: Core Web Vitals tracking, performance metrics, automatic performance event sending
- **Live Demo**: [https://analytics-perfumejs-example.netlify.app/](https://analytics-perfumejs-example.netlify.app/)
- **Best For**: Applications requiring detailed performance monitoring and optimization
- **Video Tutorial**: [Watch the implementation video](https://www.youtube.com/watch?v=9DZAVpAubtQ)
- **Key Integration**: Automatic performance metrics sent to analytics providers

## 🌐 External Examples

### [React Router v6 Hooks Example](https://github.com/DavidWells/use-analytics-with-react-router-demo)
**Advanced React Router integration with analytics hooks**
- **Framework**: React with React Router v6
- **Features**: `use-analytics` React hooks, advanced routing patterns, hook-based analytics
- **Best For**: Modern React applications using hooks pattern with React Router v6

## 📋 Getting Started

### Prerequisites
- Node.js 18+ for framework examples
- Modern browser for HTML example
- For demo example: Build local packages first

### Quick Start Guide

1. **Choose your framework** from the examples above
2. **Navigate to the example directory**: `cd examples/{example-name}`
3. **Install dependencies**: `npm install` (except for HTML example)
4. **Start development server**: `npm start` or `npm run dev`
5. **Open browser** and start exploring analytics features

### Development Workflow

For the **demo example** specifically:
1. Build all packages: `npm run setup && npm run build` (from repo root)
2. Install demo dependencies: `cd examples/demo && npm install`
3. For live plugin development: `npm run watch` (from repo root)
4. Start demo: `npm start` (from demo directory)

## 🎯 Use Cases

- **Learning**: Start with the HTML example for simplicity
- **React Development**: Use React or Next.js examples based on your setup
- **Performance Monitoring**: Use the Perfume.js example for Core Web Vitals
- **Production Setup**: The demo example shows comprehensive configuration options
- **Small Bundles**: Preact example for size-conscious applications
- **Vue Ecosystem**: Vue example for Vue.js applications

## 📚 Additional Resources

- [Analytics Documentation](../README.md)
- [Plugin Documentation](../packages/)
- [API Reference](../site/main/source/api.md)
- [Writing Custom Plugins](../site/main/source/plugins/writing-plugins.md)
27 changes: 27 additions & 0 deletions examples/demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#000000" />

<link rel="manifest" href="/manifest.json" />
<!-- <script src="/custom-ga.js" crossorigin="anonymous"></script>-->

<title>Analytics Demo</title>
<script src="https://browser.sentry-cdn.com/5.1.3/bundle.min.js" crossorigin="anonymous"></script>
<script>
if (window.location.origin !== 'http://localhost:3000') {
Sentry.init({
dsn: 'https://d455294009a14ff0bbe66516b96e65d6@sentry.io/1455338'
});
}
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>
26 changes: 15 additions & 11 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
"name": "demo",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"serve": "cd build && http-server",
"deploy": "netlify deploy --dir build --prod"
"dev": "vite",
"start": "vite",
"build": "vite build",
"preview": "vite preview",
"serve": "vite preview",
"deploy": "netlify deploy --dir dist --prod --site b5accf61-3856-49a1-ac48-86bb06b57d4b"
},
"dependencies": {
"@analytics/core": "file:../../packages/analytics-core",
Expand All @@ -24,7 +26,6 @@
"@analytics/simple-analytics": "file:../../packages/analytics-plugin-simple-analytics",
"@analytics/snowplow": "file:../../packages/analytics-plugin-snowplow",
"@analytics/storage-utils": "file:../../packages/analytics-util-storage",
"@reach/router": "^1.2.1",
"analytics": "file:../../packages/analytics",
"analytics-plugin-do-not-track": "file:../../packages/analytics-plugin-do-not-track",
"analytics-plugin-event-validation": "file:../../packages/analytics-plugin-event-validation",
Expand All @@ -35,13 +36,16 @@
"analytics-utils": "file:../../packages/analytics-utils",
"outdent": "^0.7.0",
"perfume.js": "^5.0.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "2.1.3",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^6.28.0",
"use-analytics": "file:../../packages/use-analytics"
},
"eslintConfig": {
"extends": "react-app"
"devDependencies": {
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"@vitejs/plugin-react": "^4.3.4",
"vite": "^5.4.11"
},
"browserslist": [
">0.2%",
Expand Down
7 changes: 4 additions & 3 deletions examples/demo/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#000000" />

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!-- <script src="%PUBLIC_URL%/custom-ga.js" crossorigin="anonymous"></script>-->
<link rel="manifest" href="/manifest.json" />
<!-- <script src="/custom-ga.js" crossorigin="anonymous"></script>-->

<title>Analytics Demo</title>
<script src="https://browser.sentry-cdn.com/5.1.3/bundle.min.js" crossorigin="anonymous"></script>
Expand All @@ -22,5 +22,6 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.js"></script>
</body>
</html>
Loading