dashboard logoDocs
Getting startedIntegrations

TypeScript

Use Alytica with TypeScript

Alytica TypeScript Documentation

Type Definition

Add the following type definition to your project to enable TypeScript support for the Alytica tracking function:

declare global {
  interface Window {
    alytica: (eventType: string, payload?: Record<string, any>) => void;
  }
}

Usage

After adding the type definition, you can use window.alytica throughout your application:

// Track event with payload
window.alytica('signup', {
  email: 'user@example.com',
  plan: 'premium'
});
 
// Track payment event
window.alytica('payment', {
  email: 'customer@example.com',
  amount: 99.99
});

Visit Alytica Dashboard →

On this page