ainamika-sdk 1.2.5 → 1.2.6

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/README.md CHANGED
@@ -41,14 +41,42 @@ Sign up at [AInamika Dashboard](https://ainamika.netlify.app) and create a proje
41
41
 
42
42
  ### 2. Initialize the SDK
43
43
 
44
+ #### Minimal Configuration (Recommended Start)
45
+
46
+ The simplest way to get started - just 3 lines:
47
+
48
+ ```javascript
49
+ import AInamikaSDK from 'ainamika-sdk';
50
+
51
+ const analytics = new AInamikaSDK({
52
+ projectKey: 'proj_xxxxxxxxxx', // Get this from your dashboard
53
+ autoConfig: true, // AI-powered auto-configuration
54
+ clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' // Your client ID
55
+ });
56
+ ```
57
+
58
+ That's it! The SDK will automatically track clicks, form submissions, page views, performance metrics, and engagement.
59
+
60
+ #### Full Configuration
61
+
62
+ For more control, you can configure all options:
63
+
44
64
  ```javascript
45
65
  import AInamikaSDK from 'ainamika-sdk';
46
66
 
47
67
  const analytics = new AInamikaSDK({
48
68
  projectKey: 'proj_xxxxxxxxxx', // Get this from your dashboard
49
69
  autoConfig: true, // AI-powered auto-configuration
70
+ clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
50
71
  debug: false, // Set to true for development
51
72
 
73
+ // Extra config - custom data included with ALL events
74
+ extraConfig: {
75
+ appVersion: '2.0.0', // Your app version
76
+ environment: 'production', // Environment name
77
+ deviceId: 'device_abc123' // Custom device identifier
78
+ },
79
+
52
80
  // Enable advanced tracking (enabled by default)
53
81
  advancedTracking: {
54
82
  enabled: true,
@@ -226,9 +254,9 @@ analytics.trackConversion('newsletter_subscribe', undefined, {
226
254
 
227
255
  ```javascript
228
256
  const analytics = new AInamikaSDK({
229
- // Authentication (one required)
230
- projectKey: 'proj_xxxxxxxxxx', // Recommended: Project-based auth
231
- clientId: 'your-client-id', // Legacy: Client-based auth
257
+ // Required for authentication
258
+ projectKey: 'proj_xxxxxxxxxx', // Get from your dashboard
259
+ clientId: 'your-client-id', // Your unique client identifier
232
260
 
233
261
  // Auto-Configuration
234
262
  autoConfig: true, // Enable AI-powered DOM analysis
@@ -242,12 +270,13 @@ const analytics = new AInamikaSDK({
242
270
  batchInterval: 5000 // Batch interval in ms (default: 5000)
243
271
  },
244
272
 
245
- // Extra Config - Custom data included with ALL events
273
+ // Extra Config - Custom data included with ALL events (IMPORTANT!)
246
274
  extraConfig: {
247
- appVersion: '2.0.0', // Your app version
248
- environment: 'production', // Environment name
249
- deviceId: 'device_abc123', // Custom device ID
250
- buildNumber: '1234' // Any custom data you need
275
+ appVersion: '2.0.0', // Your app version (recommended)
276
+ environment: 'production', // Environment: 'development', 'staging', 'production'
277
+ deviceId: 'device_abc123', // Custom device identifier
278
+ buildNumber: '1234', // Build/release number
279
+ // Add any custom fields you need - they'll be included in every event
251
280
  },
252
281
 
253
282
  // Advanced Tracking (NEW)
@@ -266,7 +295,7 @@ const analytics = new AInamikaSDK({
266
295
  // Error Tracking
267
296
  errorTracking: {
268
297
  enabled: true, // Enable error tracking
269
- captureScreenshots: true, // Capture screenshots on error
298
+ captureScreenshots: false, // Capture screenshots on error (default: false)
270
299
  captureDomSnapshots: true, // Capture DOM state on error
271
300
  maxStackTraceDepth: 50, // Stack trace depth limit
272
301
  maxErrorsPerSession: 100, // Max errors per session
@@ -311,16 +340,23 @@ All events include:
311
340
 
312
341
  ### Extra Config
313
342
 
314
- Pass custom data that will be included with **every event**:
343
+ Pass custom data that will be included with **every event**. This is useful for tracking app version, environment, device info, and user context across all analytics.
344
+
345
+ **Common fields:**
346
+ - `appVersion` - Your application version (e.g., '2.0.0')
347
+ - `environment` - Environment name ('development', 'staging', 'production')
348
+ - `deviceId` - Custom device identifier for cross-session tracking
315
349
 
316
350
  ```javascript
317
351
  // Set during initialization
318
352
  const analytics = new AInamikaSDK({
319
- projectKey: 'proj_xxx',
353
+ projectKey: 'proj_xxxxxxxxxx',
354
+ clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
355
+ autoConfig: true,
320
356
  extraConfig: {
321
357
  appVersion: '2.0.0',
322
358
  environment: 'production',
323
- region: 'us-east'
359
+ deviceId: 'device_abc123'
324
360
  }
325
361
  });
326
362
 
@@ -489,9 +525,14 @@ import AInamikaSDK from 'ainamika-sdk';
489
525
  import { useEffect } from 'react';
490
526
 
491
527
  const analytics = new AInamikaSDK({
492
- projectKey: 'proj_xxx',
528
+ projectKey: 'proj_xxxxxxxxxx',
529
+ clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
493
530
  autoConfig: true,
494
- advancedTracking: { enabled: true }
531
+ extraConfig: {
532
+ appVersion: '2.0.0',
533
+ environment: 'production',
534
+ deviceId: 'device_abc123'
535
+ }
495
536
  });
496
537
 
497
538
  function App() {
@@ -526,12 +567,13 @@ let analytics = null;
526
567
  export function getAnalytics() {
527
568
  if (typeof window !== 'undefined' && !analytics) {
528
569
  analytics = new AInamikaSDK({
529
- projectKey: 'proj_xxx',
570
+ projectKey: 'proj_xxxxxxxxxx',
571
+ clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
530
572
  autoConfig: true,
531
- advancedTracking: {
532
- enabled: true,
533
- trackPerformance: true,
534
- trackEngagement: true
573
+ extraConfig: {
574
+ appVersion: process.env.NEXT_PUBLIC_APP_VERSION || '1.0.0',
575
+ environment: process.env.NODE_ENV,
576
+ deviceId: 'device_abc123'
535
577
  }
536
578
  });
537
579
  }
@@ -573,10 +615,21 @@ function MyApp({ Component, pageProps }) {
573
615
  <button id="game-btn" customdata='{"name":"Puzzle Master"}'>Play Game</button>
574
616
 
575
617
  <script>
618
+ // Minimal setup - just 3 required fields
576
619
  const analytics = new AInamikaSDKPro({
577
- projectKey: 'proj_xxx',
620
+ projectKey: 'proj_xxxxxxxxxx',
621
+ clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
578
622
  autoConfig: true,
579
- debug: true,
623
+
624
+ // Optional: Add extra config for better tracking
625
+ extraConfig: {
626
+ appVersion: '2.0.0',
627
+ environment: 'production',
628
+ deviceId: 'device_abc123'
629
+ },
630
+
631
+ // Optional: Configure advanced tracking
632
+ debug: false,
580
633
  advancedTracking: {
581
634
  enabled: true,
582
635
  trackPerformance: true,