user-analytics-tracker 4.1.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [4.3.0](https://github.com/Switch-org/analytics-tracker/compare/v4.2.0...v4.3.0) (2026-01-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * updated api_key flow for consumers ([#35](https://github.com/Switch-org/analytics-tracker/issues/35)) ([b5ce7de](https://github.com/Switch-org/analytics-tracker/commit/b5ce7de0201b69f085faf0c003427a961a4ec471))
7
+
8
+ # [4.2.0](https://github.com/Switch-org/analytics-tracker/compare/v4.1.2...v4.2.0) (2026-01-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * update geo-location , essential data ([#28](https://github.com/Switch-org/analytics-tracker/issues/28)) ([fc63298](https://github.com/Switch-org/analytics-tracker/commit/fc63298f1ccfdeea36348d85ff9fc6a2b95c6211))
14
+ * update geo-location , essential dataa ([#29](https://github.com/Switch-org/analytics-tracker/issues/29)) ([0f9c493](https://github.com/Switch-org/analytics-tracker/commit/0f9c49329c2e638688ffca8be5819107ff657a28))
15
+ * updated essential logs ([bdb718a](https://github.com/Switch-org/analytics-tracker/commit/bdb718a3944a2399f9461f96edb589ffa40d5b07))
16
+ * updated geo-locations, event validator for essential tracking + custom ip conf ([ec84f67](https://github.com/Switch-org/analytics-tracker/commit/ec84f67e2891df1d78fd99939a793cefdf0885ad))
17
+ * updated logs for essential case ([553da62](https://github.com/Switch-org/analytics-tracker/commit/553da62ee45aad416e912fe76cc7436b3c15a456))
18
+ * updated security ([7502d6e](https://github.com/Switch-org/analytics-tracker/commit/7502d6e3b45b26912cf48b83ab843a56b50373e5))
19
+
1
20
  ## [4.1.2](https://github.com/Switch-org/analytics-tracker/compare/v4.1.1...v4.1.2) (2025-12-31)
2
21
 
3
22
 
package/README.md CHANGED
@@ -95,6 +95,12 @@ const analytics = useAnalytics({
95
95
  // Metrics configuration
96
96
  enableMetrics: false, // Enable metrics collection (default: false)
97
97
 
98
+ // IP Geolocation (ipwho.is) - optional; use your own API key for higher rate limits
99
+ ipGeolocation: {
100
+ apiKey: import.meta.env.VITE_IPWHOIS_API_KEY, // Use env var; omit for free tier
101
+ timeout: 5000,
102
+ },
103
+
98
104
  // Field storage configuration (optional) - control which fields are stored
99
105
  fieldStorage: {
100
106
  ipLocation: { mode: 'essential' }, // IP location fields (includes connection data)
@@ -156,13 +162,20 @@ Use environment variables for different environments:
156
162
  ```tsx
157
163
  // .env.local (development)
158
164
  // NEXT_PUBLIC_ANALYTICS_API=https://api-dev.yourcompany.com/analytics
165
+ // NEXT_PUBLIC_IPWHOIS_API_KEY=your-ipwho-is-key // optional, for higher rate limits
159
166
 
160
167
  // .env.production
161
168
  // NEXT_PUBLIC_ANALYTICS_API=https://api.yourcompany.com/analytics
169
+ // NEXT_PUBLIC_IPWHOIS_API_KEY=your-ipwho-is-key
162
170
 
163
171
  const analytics = useAnalytics({
164
172
  config: {
165
173
  apiEndpoint: process.env.NEXT_PUBLIC_ANALYTICS_API || '/api/analytics',
174
+ // Optional: your own ipwho.is API key (use env var; omit for free tier)
175
+ ipGeolocation: {
176
+ apiKey: process.env.NEXT_PUBLIC_IPWHOIS_API_KEY,
177
+ timeout: 5000,
178
+ },
166
179
  },
167
180
  });
168
181
  ```
@@ -341,6 +354,12 @@ interface AnalyticsConfig {
341
354
  logLevel?: LogLevel; // 'silent' | 'error' | 'warn' | 'info' | 'debug' (default: 'warn')
342
355
  // Metrics options
343
356
  enableMetrics?: boolean; // Enable metrics collection (default: false)
357
+ // IP Geolocation (ipwho.is) - pass your own API key via env var for higher rate limits
358
+ ipGeolocation?: {
359
+ apiKey?: string; // Use env var, e.g. VITE_IPWHOIS_API_KEY or REACT_APP_IPWHOIS_API_KEY
360
+ baseUrl?: string; // Default: 'https://ipwho.is'
361
+ timeout?: number; // Default: 5000
362
+ };
344
363
  // Existing options
345
364
  autoSend?: boolean;
346
365
  enableLocation?: boolean;
@@ -981,7 +1000,7 @@ MIT © [Switch Org](https://github.com/switch-org)
981
1000
 
982
1001
  ## 🙏 Acknowledgments
983
1002
 
984
- - Uses [ipwho.is](https://ipwho.is/) for free IP geolocation and accurate connection data
1003
+ - Uses [ipwho.is](https://ipwho.is/) for IP geolocation and connection data (free tier; consumers can pass their own API key via `config.ipGeolocation.apiKey` for higher rate limits)
985
1004
  - Built with modern web APIs (User-Agent Client Hints, Geolocation API)
986
1005
 
987
1006
  <!-- ## 📞 Support