# Custom events Pageviews only tell part of the story. Custom events let you track the actions that matter — signups, checkouts, clicks — and tie them to your traffic sources. ## Track an event Call `track()` with an event name and optional properties. Properties are string key/value pairs you can use to segment events later. **Script Tag** ```javascript // The script tag exposes the tracker on window.__dtc window.__dtc.track('signup_completed', { plan: 'pro' }); window.__dtc.track('button_click', { button: 'cta-hero' }); ``` **NPM Package** ```javascript // Using the tracker instance from createTracker(), see Getting started tracker.track('signup_completed', { plan: 'pro' }); tracker.track('button_click', { button: 'cta-hero' }); ``` > **Note: Event naming** > > Use short, consistent `snake_case` names like `signup_completed` or `checkout_started`. A stable naming scheme keeps your dashboard readable as you add more events. ## Identify users Call `identify()` to associate events with a user. All subsequent events in the session are attributed to that user ID, so you can follow a visitor across anonymous browsing and signed-in usage. **Script Tag** ```javascript window.__dtc.identify('user-42', { plan: 'pro' }); ``` **NPM Package** ```javascript tracker.identify('user-42', { plan: 'pro' }); ``` > **Info: Privacy first** > > Pass your own internal user ID — never an email address or other personal data. Traits are optional string key/value pairs.