Skip to content

v0.4.0 - SaaS Integration & Simplified Setup

Choose a tag to compare

@decker-dev decker-dev released this 20 Jun 13:15
· 192 commits to main since this release

Major Changes

  • SaaS Integration: Now uses Better Analytics SaaS (https://better-analytics.app/api/collect) as the default endpoint
  • Required Site Parameter: The site parameter is now required, while endpoint is optional
  • Simplified Setup: You can now start tracking with just init({ site: 'my-app' }) - no endpoint configuration needed unless you want to use your own server

Breaking Changes

// Before (v0.3.0 and earlier)
init({ endpoint: '/api/collect', site: 'my-app' });

// After (v0.4.0) - Uses Better Analytics SaaS by default
init({ site: 'my-app' });

// Or with custom endpoint
init({ site: 'my-app', endpoint: '/api/collect' });

New Features

Default SaaS Integration

import { init, track } from "better-analytics";

// Automatically sends to Better Analytics SaaS
init({ site: 'my-app' });
track('user_signup', { plan: 'pro' });

Simplified Next.js Setup

import { Analytics } from "better-analytics/next";

// Just add your site ID - works immediately
<Analytics site="my-app" />

// Environment variable approach
// .env.local: NEXT_PUBLIC_BA_SITE=my-app
<Analytics />

This update makes Better Analytics much easier to get started with while maintaining full flexibility for custom implementations.