Overview
The Journium JavaScript SDK can be integrated into any web application, whether you’re using vanilla JavaScript, jQuery, or any other JavaScript framework. This guide covers both CDN and npm installation methods.Installation Methods
CDN Installation (Recommended for quick setup)
Add Journium to your HTML page using our CDN:NPM Installation
For modern JavaScript applications using a bundler:Configuration Options
Basic Configuration
Advanced Configuration
Tracking Events
Automatic Tracking
Journium automatically tracks several events when configured:- Page views: Tracks when users visit different pages
- Click events: Records clicks on buttons, links, and other elements
- Scroll depth: Measures how far users scroll on pages
- Form submissions: Tracks form completions and abandonment
- Performance metrics: Load times, render times, and other performance data
Custom Event Tracking
Track specific events important to your business:User Identification
Identify users to get more detailed analytics:Page Tracking
Single Page Applications (SPAs)
For SPAs, manually track page changes:Router Integration
Example integration with popular routers:Error Tracking
Track JavaScript errors and exceptions:Performance Monitoring
Track performance metrics:Best Practices
1. Load Journium Early
Place the Journium script as early as possible in your page load:2. Use Environment-Specific Configuration
3. Handle Errors Gracefully
4. Batch Events for Performance
Troubleshooting
Common Issues
Journium is not defined- Make sure the Journium script is loaded before you try to use it
- Check that the CDN URL is correct and accessible
- Verify your project ID and API key are correct
- Check that you’re using the right environment (development/production)
- Ensure your domain is whitelisted in your Journium project settings
- Journium loads asynchronously and shouldn’t block your page
- Events are batched and sent efficiently
- The SDK is lightweight (~15KB gzipped)