Getting Started
This guide will help you integrate TraceLog into your project in just a few minutes.
๐ฆ Installation
npm install @tracelog/client
๐ Quick Start
1. Sign Up and Get Your Project ID
- Sign up at tracelog.io
- Get your Project ID from the dashboard
2. Set Up Your Custom Subdomain
Create a CNAME record in your DNS settings:
Host | Type | Value |
---|---|---|
YOUR_TRACELOG_ID |
CNAME | mdw.tracelog.io |
Replace YOUR_TRACELOG_ID
with your actual Project ID.
3. Initialize TraceLog
Basic setup:
import { TraceLog } from '@tracelog/client';
await TraceLog.init({
id: 'your-project-id'
});
// Send custom events
TraceLog.event('button_click', { buttonId: 'subscribe-btn' });
โ๏ธ Configuration Options
await TraceLog.init({
id: 'your-project-id',
// Session timeout (default: 15 minutes)
sessionTimeout: 900000,
// Data added to every event
globalMetadata: {
version: '1.2.0',
environment: 'production'
},
// Track scrolling in specific containers
scrollContainerSelectors: ['.main-content', '#sidebar'],
// Remove sensitive data from URLs
sensitiveQueryParams: ['token', 'password'],
// Third-party integration
integrations: {
googleAnalytics: {
measurementId: 'G-XXXXXXXXXX'
}
}
});
๐ Automatic Tracking
TraceLog automatically captures:
- Page visits - Navigation between pages
- Clicks - Button and link interactions
- Scrolling - Scroll depth and engagement
- Sessions - User session start/end
๐ฏ Custom Events
// Simple event
TraceLog.event('user_signup');
// Event with data
TraceLog.event('purchase', {
product: 'premium_plan',
price: 29.99,
currency: 'USD'
});
๐งน Cleanup
// Clean up when done (e.g., user logout)
TraceLog.destroy();
Next Steps
- Advanced Configuration - Customize behavior
- API Reference - Complete method documentation
- Best Practices - Tips for optimal tracking