@journium/js
v1.1.1
Published
Journium JavaScript SDK for web browsers - Track events, pageviews, and user interactions with ease
Readme
@journium/js
The official Journium JavaScript SDK for web browsers. Track events, pageviews, and user interactions with ease.
Getting Started
Learn how to use Journium to power your application:
Prerequisites
- Modern browser (ES2017+)
- An existing Journium application. Create your account for free.
Installation Option 1: Via package manager
npm install @journium/jsUsage
import { init } from '@journium/js';
const journium = init({
publishableKey: "your-publishable-key"
});For more detailed examples and configuration options, visit the Journium documentation.
Installation Option 2: Adding the JavaScript snippet to your HTML
For websites without module bundlers (Shopify, WordPress, static HTML), use the CDN version with a single global journium object.
Script Tag
<script>
!function(j,o,u,r,n,i,u,m){
if(!o.__JV){
window.journium=o;
o._q=[];
o._i=null;
o.init=function(c,n){o._i=[c,n]};
var methods="track identify reset capturePageview startAutocapture stopAutocapture flush getEffectiveOptions onOptionsChange destroy".split(" ");
for(var k=0;k<methods.length;k++){
!function(method){
o[method]=function(){o._q.push([method].concat(Array.prototype.slice.call(arguments)));return o}
}(methods[k])
}
o.__JV=1;
(m=j.createElement("script")).type="text/javascript";
m.async=!0;
m.src="https://cdn.jsdelivr.net/npm/@journium/js@1/dist/journium.min.js";
m.onerror=function(){console.warn("Journium: Failed to load SDK from CDN")};
(i=j.getElementsByTagName("script")[0]).parentNode.insertBefore(m,i);
}
}(document,window.journium||[]);
journium.init({
publishableKey: 'YOUR_PUBLISHABLE_KEY'
});
</script>Usage Examples
// Track events
journium.track('page_view', { page: 'home' });
journium.track('button_click', { button: 'signup' });
// Identify users
journium.identify('user123', {
email: '[email protected]',
plan: 'pro'
});Other SDKs
- @journium/nextjs - Next.js SDK
- @journium/react - React SDK
Support
Need help? Reach out to us:
- 📖 Join our official community Discord server
- 🐛 Issue Tracker
Contributing
We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines and code of conduct.
License
This project is licensed under the MIT license.
See LICENSE for more information.
