@itways/events-sdk
v1.2.5
Published
Integral Ways Analytics SDK to send events to backend (React, Angular, JS, React Native compatible)
Readme
Frontend Analytics SDK
Send events from your frontend (React, Angular, plain JS) to your backend analytics platform.
🔧 Build SDK
# Install dependencies
npm install
# Clean old build (optional)
npm run clean
# Build (ESM + UMD formats)
npm run buildOutput
dist/
├── index.esm.js ← For modern builds (ES Modules)
└── index.umd.js ← For CDN/global browser usePublish
npm login
npm publish --access public🚀 Install
npm install @itways/events-sdk🔧 Usage
import { init, trackEvent } from '@itways/events-sdk';
init({
apiKey: 'your-api-key',
secret: 'your-secret',
endpoint: 'https://api.yourdomain.com/api/events'
});
trackEvent('pageview', { url: window.location.href });<script src="https://cdn.yourdomain.com/sdk/index.umd.js"></script>
<script>
YourAnalytics.init({ apiKey: 'x', secret: 'y', endpoint: 'https://...' });
YourAnalytics.trackEvent('click', { btn: 'save' });
</script>🔐 Setup Your Secrets (once)
Go to your GitHub repo > Settings > Secrets and variables > Actions > New Repository Secret:
NPM_TOKEN: Your personal npm access token
Generate from https://www.npmjs.com/settings > Access Tokens (type: automation)
Use read & publish access
Automation
tag version should be changed every creation
git tag v1.0.3 git push origin v1.0.3
