DataMetrics provides a simple and powerful way to track user behavior and performance metrics for your applications. Follow this guide to integrate our SDK into your project.
Install the DataMetrics SDK using npm:
npm install @datametrics/sdk
Or using a CDN:
<script src="https://cdn.datametrics.com/sdk/latest.js"></script>
Initialize the SDK with your API key:
DataMetrics.initialize({
apiKey: 'your-api-key',
projectId: 'your-project-id'
});
Track custom events in your application:
// Track a simple event
DataMetrics.trackEvent('button_click');
// Track event with properties
DataMetrics.trackEvent('purchase', {
productId: '123',
price: 29.99,
currency: 'USD'
});
initialize(config)
- Initialize the SDKtrackEvent(name, properties?)
- Track custom eventstrackPageView()
- Track page viewssetUserProperties(properties)
- Set user propertiesHere are some example visualizations of the data you can collect: