simple web tracker
npm install @dooboostore/swt!Logo
SWT (Simple Web Tracker) is a lightweight JavaScript library designed for tracking user interactions and events on web pages. It provides functionalities to log various user activities, manage sessions, and visualize data through a built-in dashboard.
* Event Tracking: Tracks clicks, mouse movements, scrolls, page loads, and URL changes.
* Session Management: Automatically manages user sessions, allowing for new session creation and retrieval of session data.
Configurable: Easily configure tracking behavior via HTML data- attributes.
* Dashboard: A built-in dashboard for visualizing collected session data, including path flow, event distribution, and heatmaps.
* Data Export: Export collected data to CSV format from the dashboard.
To use SWT, include the dist/index.js script in your HTML. You can configure SWT using data-swt-* attributes on the script tag.
``html`
id="swt"
data-swt-target-query-selector="a, img, div.wow"
data-swt-post-url="http://your-backend-url.com/track"
data-swt-post-buffer-time="5000"
data-swt-token="your-auth-token"
data-swt-open-dashboard-delay="0"
type="module" src="https://cdn.jsdelivr.net/npm/@dooboostore/swt/dist/index.min.js"
>
You can also dynamically insert the SWT script from a CDN into your page. This is useful for external sites or when you prefer not to host the script directly.
`javascript`
const script = document.createElement('script');
script.id = 'swt';
script.type = 'module';
script.setAttribute('data-swt-target-query-selector', '#portal, #scriptHolder, #home_banner, #viewport-box');
script.src = 'https://cdn.jsdelivr.net/npm/@dooboostore/swt/dist/index.min.js';
document.head.appendChild(script);
These options are set as data-swt-* attributes on the