npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ainamika-sdk

v1.0.5

Published

Advanced AI-powered analytics SDK with error tracking, event management, and real-time insights for web applications

Readme

Ainamika SDK

npm version License: MIT

Ainamika SDK is an advanced AI-powered analytics SDK that provides comprehensive error tracking, event management, and real-time insights for web applications. Built with TypeScript and designed for modern web development.

🚀 Features

  • 🤖 AI-Powered Analytics: Intelligent event tracking with AI-generated insights
  • 🛡️ Advanced Error Tracking: Comprehensive error capture with stack traces, screenshots, and DOM snapshots
  • � Client ID Security: Secure API access with client ID validation to prevent unauthorized usage
  • �📊 Real-time Event Tracking: Track user interactions, page views, and custom events
  • 🔧 Auto-Configuration: Automatically analyze your DOM and suggest optimal tracking configurations
  • ⚡ Web Worker Support: Batched event processing for optimal performance
  • 🌐 Offline Support: Queue events when offline and sync when online
  • 🎯 Environment Detection: Automatic development/production environment detection
  • 📱 Cross-Platform: Works across all modern browsers and frameworks

📦 Installation

npm install ainamika-sdk

Or via CDN:

<script src="https://unpkg.com/ainamika-sdk@latest/dist/ainamika-sdk.js"></script>

🏁 Quick Start

Basic Usage

import AInamikaSDK from 'ainamika-sdk';

// Initialize the SDK
const analytics = new AInamikaSDK({
            apiKey: '',
            autoConfig: true,
            debug: true,
            clientId: 'YOU_WILL_GET_AFTER_SIGINING_UP_IN_DASHBOARD_UNDER_PROFILE',
            apiDetails: {
                
            },
            workerConfig: {
                batchSize: 50,  // Increased from 5 to 50
                batchInterval: 3000  // Reduced interval to 3 seconds
            },
});

// Track custom events
analytics.track('button_click', {
  button_id: 'signup-btn',
  page: 'landing',
  user_id: 'user123'
});

// Track user identification
analytics.setUser('user123');

With Error Tracking

  const sdk = new AInamikaSDKPro({
            apiKey: '',
            autoConfig: true,
            debug: true,
            clientId: 'YOU_WILL_GET_AFTER_SIGINING_UP_IN_DASHBOARD_UNDER_PROFILE',
            apiDetails: {
                
            },
            workerConfig: {
                batchSize: 50,  // Increased from 5 to 50
                batchInterval: 3000  // Reduced interval to 3 seconds
            },
            errorTracking: {
                enabled: true,
                captureScreenshots: true,
                captureDomSnapshots: true,
                maxStackTraceDepth: 10,
                maxErrorsPerSession: 50,
                debounceMs: 1000,
                enableNetworkTracking: true,
                enableConsoleCapture: true
            }
        });

// Manually capture exceptions
try {
  // Your code here
} catch (error) {
  analytics.captureException(error, {
    context: 'user-action',
    severity: 'high'
  });
}

Auto-Configuration

Ainamika SDK can automatically analyze your DOM structure and generate optimal tracking configurations:

const analytics = new window.AInamikaSDK({
            apiKey: '',
            autoConfig: true,
            debug: true,
            clientId: 'YOU_WILL_GET_AFTER_SIGINING_UP_IN_DASHBOARD_UNDER_PROFILE',
            apiDetails: {
                
            },
            workerConfig: {
                batchSize: 50,  // Increased from 5 to 50
                batchInterval: 3000  // Reduced interval to 3 seconds
            },
            errorTracking: {
                enabled: true,
                captureScreenshots: true,
                captureDomSnapshots: true,
                maxStackTraceDepth: 10,
                maxErrorsPerSession: 50,
                debounceMs: 1000,
                enableNetworkTracking: true,
                enableConsoleCapture: true
            }
});

// The SDK will automatically:
// 1. Analyze your DOM structure
// 2. Generate tracking configuration via AI
// 3. Attach event listeners to relevant elements
// 4. Track user interactions automatically
  • Batching & Retry Logic: Batches events and sends them to the backend, with retry logic for failed sends.
  • Web Worker Support: Offloads event batching and sending to a web worker for performance and reliability.
  • Manual Event Tracking: Supports manual .track(eventName, properties) calls for custom analytics events.
  • Flexible API Endpoint: Can send events to a custom API endpoint with custom headers.
  • Session & User ID Management: Generates session and user IDs for event context.
  • Debug Logging: Optional debug mode for verbose logging in the browser console.

Usage

  1. Include the SDK

    <script src="./sdk.js"></script>
    <script>
      new AInamikaSDKPro({
          apiKey: '',
             autoConfig: true,
             debug: true,
             clientId: 'YOU_WILL_GET_AFTER_SIGINING_UP_IN_DASHBOARD_UNDER_PROFILE',
             apiDetails: {
                    
             },
             workerConfig: {
                 batchSize: 50,  // Increased from 5 to 50
                 batchInterval: 3000  // Reduced interval to 3 seconds
             },
             errorTracking: {
                 enabled: true,
                 captureScreenshots: true,
                 captureDomSnapshots: true,
                 maxStackTraceDepth: 10,
                 maxErrorsPerSession: 50,
                 debounceMs: 1000,
                 enableNetworkTracking: true,
                 enableConsoleCapture: true
             }
      });
    </script>
  2. Manual Event Tracking

    window.AInamikaSDKPro.track('custom_event', { foo: 'bar' });
  3. Config Caching

    • Configs are cached in localStorage under the key ainamika_dom_config_cache by DOM hash.
    • Configs can also be saved/loaded as a JSON file (if debug mode is enabled).
  4. Dynamic DOM Support

    • The SDK automatically detects DOM changes and fetches/apply new configs as needed.
  5. Batching & Web Worker

    • Events are batched and sent in the background using a web worker (if supported).

🔐 Security

Client ID Validation: All SDK requests are secured with client ID validation to prevent unauthorized access.

  • Required: Every request must include a valid clientId that is registered with your Ainamika account
  • Automatic: The SDK automatically includes your client ID in all API requests
  • Secure: Invalid or missing client IDs will result in 400 error responses
  • Get Your Client ID: Sign up in the Ainamika dashboard and find your unique client ID under Profile settings
// ✅ Correct - Always provide your registered client ID
const analytics = new AInamikaSDK({
  clientId: 'your-registered-client-id-from-dashboard',
  // ... other config
});

// ❌ Invalid - Using unregistered client ID will fail
const analytics = new AInamikaSDK({
  clientId: 'invalid-or-unregistered-id',
  // ... other config
});

Advanced

  • Custom API Endpoint: Use the apiDetails option to send events to a custom endpoint with custom headers.
  • Worker Config: Control batch size and interval via workerConfig.
  • Debug Mode: Set debug: true for verbose logs.

Example AI generated Config

{
  "events_to_track": [
    {
      "element_selector": "button",
      "event_type": "click",
      "event_name": "user_login_button_click"
    },
    {
      "element_selector": "form",
      "event_type": "submit",
      "event_name": "form_submit"
    }
  ]
}

File Structure

  • sdk.js : Main SDK logic (compiled from TypeScript)
  • sdk.ts : TypeScript source
  • worker.js: Web worker for batching and sending events

Requirements

  • Modern browser with ES6 support
  • Backend server for config generation and event ingestion

License

MIT