Janus Client SDK
A lightweight JavaScript library for tracking events from web applications. Automatically handles batching, retries, rate limiting, and persistence.
Lightweight (~3KB)Auto RetryBatchingPersistence
Best Practices
Initialize Early#
Initialize the SDK in your <head> to capture events as early as possible:
html
<head><script src="https://addjanus.ca/janus.js"></script><script>Janus.init('jns_your_api_key_here');</script></head>
Track Meaningful Events#
Focus on specific, actionable events:
javascript
// Good: Specific, actionable eventsJanus.track('checkout_started', { cartValue: 150 });Janus.track('feature_used', { feature: 'export_pdf' });// Avoid: Too generic or too frequentJanus.track('click'); // Too vagueJanus.track('mousemove'); // Too noisy
Identify Users After Login#
javascript
async function onLoginSuccess(user) {Janus.identify(user.id, {email: user.email,plan: user.subscription});Janus.track('login_success');}
Reset on Logout#
javascript
function onLogout() {Janus.track('logout');Janus.reset(); // Generate new anonymous ID}
Use Debug Mode During Development#
javascript
Janus.init('jns_your_api_key_here', {debug: true // See all SDK activity in console});
Need Help?
If you have questions or run into issues, check out our troubleshooting guide or reach out to our support team.
Troubleshooting Guide