Skip to content

Commit cd7c4b3

Browse files
feat: add posthog telemetry for usage tracking
- add telemetry module with PostHog integration - track map initialization, layer operations, errors - respect Do Not Track (DNT) browser setting - provide opt-out via disableTelemetry() or localStorage - posthog-js is optional peer dependency - document telemetry in README with privacy info telemetry is opt-out by default but respects user privacy preferences. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 46438f5 commit cd7c4b3

7 files changed

Lines changed: 928 additions & 3 deletions

File tree

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,51 @@ Requires WebGL 2.0 support.
478478

479479
---
480480

481+
## Telemetry
482+
483+
This library collects anonymous usage data to help improve the product. We
484+
track:
485+
486+
- Library initialization and configuration
487+
- Layer types used (not layer data)
488+
- Errors and exceptions
489+
- General usage patterns
490+
491+
**What we DON'T collect:**
492+
493+
- Geographic coordinates or locations
494+
- User data or personally identifiable information
495+
- Layer content or GeoJSON data
496+
- IP addresses (PostHog anonymizes these)
497+
498+
### Opting Out
499+
500+
You can disable telemetry in several ways:
501+
502+
```typescript
503+
// Option 1: Disable globally
504+
import { disableTelemetry } from '@raphaeltorquat0/map-3d-deck'
505+
disableTelemetry()
506+
507+
// Option 2: Via localStorage (persists across sessions)
508+
localStorage.setItem('map3d_telemetry_optout', 'true')
509+
510+
// Option 3: Browser Do Not Track
511+
// Telemetry respects navigator.doNotTrack
512+
```
513+
514+
### Optional Dependency
515+
516+
Telemetry requires `posthog-js`. If not installed, telemetry is automatically
517+
disabled with no impact on library functionality.
518+
519+
```bash
520+
# To enable telemetry, install posthog-js
521+
npm install posthog-js
522+
```
523+
524+
---
525+
481526
## Contributing
482527

483528
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md)

0 commit comments

Comments
 (0)