@qbix/q.js 1.0.1 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/dist/Metrics.js +2873 -0
- package/dist/Metrics.min.js +95 -0
- package/dist/Q.js +187 -183
- package/dist/Q.min.js +89 -88
- package/dist/Q.minimal.js +186 -182
- package/dist/Q.minimal.min.js +48 -48
- package/dist/handlebars.minimal.min.js +1 -12
- package/dist/jquery.minimal.min.js +18 -10
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Size: ~40KB (Minified + GZipped), [compare to other frameworks](https://gist.git
|
|
|
6
6
|
How to use: copy contents of `dist` into your project, and then include it like this:
|
|
7
7
|
| File Type | Code to Use |
|
|
8
8
|
|------------|-------------|
|
|
9
|
-
|`.html` files| `<script type="module"
|
|
10
|
-
|`.js` or `.ts` files|`import Q from 'https://unpkg.com/@
|
|
9
|
+
|`.html` files| `<script type="module" src="https://unpkg.com/@qbix/q.js@1.0.2/dist/Q.min.js">`|
|
|
10
|
+
|`.js` or `.ts` files|`import Q from 'https://unpkg.com/@qbix/q.js@1.0.2/dist/Q.min.js';`
|
|
11
11
|
|<img src="https://github.com/user-attachments/assets/ba3df93e-0cd8-4189-93fc-11947b63b684" alt="Description" width="100" height="87"> | Full documentation here: https://qbix.com/platform/guide/javascript |
|
|
12
12
|
|
|
13
13
|
This is part of the much larger full-stack [Qbix Platform](https://github.com/Qbix/Platform) that contains many pre-built reusable tools, plugins, and requires PHP and Node.js on the back-end. If you want to build an entire full-stack social network like Facebook you're well-advised to go with that. But if you just want to use the lightweight front-end core, with your own back-end and other frameworks, then start with this framework here.
|
|
@@ -648,3 +648,31 @@ In it, you will define the tools, methods, and other things. Here is an example:
|
|
|
648
648
|
|
|
649
649
|
```
|
|
650
650
|
|
|
651
|
+
|
|
652
|
+
# 📊 Metrics.js — Standalone Telemetry
|
|
653
|
+
|
|
654
|
+
This repo also includes **Metrics.js** — a standalone telemetry library that tracks scroll depth, section engagement, and video/audio playback across 9 embed providers. No dependencies, no build step, works on any website.
|
|
655
|
+
|
|
656
|
+
```html
|
|
657
|
+
<script src="https://unpkg.com/@qbix/q.js/dist/Metrics.js"></script>
|
|
658
|
+
<script>
|
|
659
|
+
Metrics.init({ endpoint: '/telemetry', page: document.title });
|
|
660
|
+
Metrics.ScrollTracker.init({ sections: 'h2[id]' });
|
|
661
|
+
Metrics.MediaTracker.init(); // auto-discovers YouTube, Vimeo, SoundCloud, Wistia, JW Player, Dailymotion, Spotify, Twitch, Muse.ai
|
|
662
|
+
</script>
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
Unique features:
|
|
666
|
+
- **Watched seconds** — tracks unique seconds of video/audio covered, not just total playback. Seeking back and replaying doesn't inflate the number.
|
|
667
|
+
- **Section engagement** — knows which heading the user is actually reading, not just how far they scrolled.
|
|
668
|
+
- **Persistent visitor ID** — `localStorage` with `sessionStorage` fallback. ITP-safe because it's first-party storage.
|
|
669
|
+
- **9 media providers** — auto-detected, APIs loaded on demand, no configuration needed.
|
|
670
|
+
- **Zero Q.js dependency** — works completely standalone. But if Q.js is loaded, Metrics automatically gains CSRF tokens, `Q.Page` SPA tracking, `Q/tabs` and `Q/columns` auto-hooks, and debounced server-side state updates.
|
|
671
|
+
|
|
672
|
+
👉 **[Full Metrics.js documentation →](Metrics.md)**
|
|
673
|
+
|
|
674
|
+
## From Metrics.js to the Qbix Platform
|
|
675
|
+
|
|
676
|
+
Metrics.js is the lightweight entry point. For the full server-side stack — visit attribution, referral chain walking, multi-level commissions, real-time WebSocket updates, and per-component Merkle-tree cache invalidation — install the [Qbix Platform](https://github.com/Qbix/Platform) with the Metrics plugin.
|
|
677
|
+
|
|
678
|
+
The platform includes a high-performance [webserver](https://github.com/Qbix/webserver) (Cosmopolitan C binary) that maintains a Merkle tree of rendered component hashes. When data changes, only the affected components re-render — not the whole page. Combined with static site generation for CDN caching and `Streams/check` for per-stream change detection over WebSocket, you get sub-second updates with near-zero server load. No PHP required for serving — the webserver handles everything.
|