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

@entrolytics/svelte-sdk

v2.2.0

Published

SvelteKit integration for Entrolytics - First-party growth analytics for the edge

Downloads

33

Readme

npm License: MIT TypeScript Svelte


Overview

@entrolytics/svelte-sdk is the official SvelteKit SDK for Entrolytics - first-party growth analytics for the edge. Add powerful analytics to your Svelte 5 and SvelteKit applications with minimal configuration.

Why use this SDK?

  • Zero-config setup with automatic environment detection
  • Svelte actions for declarative click tracking
  • Svelte stores for reactive state management
  • Edge-optimized with sub-50ms response times globally

Key Features

Analytics

  • Automatic page view tracking
  • Custom event tracking
  • User identification
  • SvelteKit navigation support

Developer Experience

  • use:trackClick Svelte action
  • $isLoaded reactive store
  • SvelteKit $page store integration
  • Full TypeScript support

Quick Start

Installation

npm install @entrolytics/svelte-sdk
# or
pnpm add @entrolytics/svelte-sdk
<!-- +layout.svelte -->
<script>
  import { initEntrolytics } from '@entrolytics/svelte-sdk';

  // Zero-config: automatically reads from .env
  initEntrolytics();
</script>

<slot />

Add to your .env file:

VITE_ENTROLYTICS_WEBSITE_ID=your-website-id
VITE_ENTROLYTICS_HOST=https://entrolytics.click

# Or for SvelteKit static
PUBLIC_ENTROLYTICS_WEBSITE_ID=your-website-id
PUBLIC_ENTROLYTICS_HOST=https://entrolytics.click

Configuration Options

Zero-Config (Recommended)

<script>
  initEntrolytics(); // Reads from env
</script>

Explicit Configuration

initEntrolytics({
  // Required: Your Entrolytics website ID
  websiteId: 'your-website-id',

  // Optional: Custom host (for self-hosted)
  host: 'https://entrolytics.click',

  // Optional: Auto-track page views (default: true)
  autoTrack: true,

  // Optional: Use edge-optimized endpoints (default: true)
  useEdgeRuntime: true,

  // Optional: Respect Do Not Track (default: false)
  respectDnt: false,

  // Optional: Cross-domain tracking
  domains: ['example.com', 'blog.example.com'],
});

Runtime Configuration

The useEdgeRuntime option controls which collection endpoint is used:

Edge Runtime (default) - Optimized for speed and global distribution:

initEntrolytics({
  websiteId: 'your-website-id',
  useEdgeRuntime: true // or omit (default)
});
  • Latency: Sub-50ms response times globally
  • Best for: Production Svelte/SvelteKit apps, globally distributed users
  • Endpoint: Uses /api/send-native for edge-to-edge communication
  • Limitations: No ClickHouse export, basic geo data

Node.js Runtime - Full-featured with advanced capabilities:

initEntrolytics({
  websiteId: 'your-website-id',
  useEdgeRuntime: false
});
  • Features: ClickHouse export, MaxMind GeoIP (city-level accuracy)
  • Best for: Self-hosted deployments, advanced analytics requirements
  • Endpoint: Uses /api/send for Node.js runtime
  • Latency: 50-150ms (regional)

When to use Node.js runtime:

  • Self-hosted Svelte/SvelteKit deployments without edge runtime support
  • Applications requiring ClickHouse data export
  • Need for advanced geo-targeting with MaxMind
  • Custom server-side analytics workflows

Tracking Events

trackEvent

<script>
  import { trackEvent } from '@entrolytics/svelte';

  function handlePurchase() {
    trackEvent('purchase', {
      revenue: 99.99,
      currency: 'USD'
    });
  }
</script>

<button on:click={handlePurchase}>Buy Now</button>

trackClick Action

Use the Svelte action for declarative click tracking:

<script>
  import { trackClick } from '@entrolytics/svelte';
</script>

<button use:trackClick={{ event: 'cta_click', data: { variant: 'hero' } }}>
  Get Started
</button>

Page View Tracking

Automatic (with SvelteKit)

<!-- +layout.svelte -->
<script>
  import { page } from '$app/stores';
  import { initEntrolytics, usePageView } from '@entrolytics/svelte';

  initEntrolytics({ websiteId: 'your-website-id' });
  usePageView(page);
</script>

<slot />

Manual

<script>
  import { trackPageView } from '@entrolytics/svelte';

  // Track current page
  trackPageView();

  // Track specific URL
  trackPageView('/custom-path', 'https://referrer.com');
</script>

User Identification

<script>
  import { identify } from '@entrolytics/svelte';

  // When user logs in
  function handleLogin(user) {
    identify(user.id, {
      email: user.email,
      plan: user.subscription
    });
  }
</script>

Stores

isLoaded

Check if the tracking script is loaded:

<script>
  import { isLoaded } from '@entrolytics/svelte';
</script>

{#if $isLoaded}
  <p>Analytics loaded!</p>
{/if}

TypeScript

Full TypeScript support with exported types:

import type { EntrolyticsOptions } from '@entrolytics/svelte';

License

MIT License - see LICENSE file for details.