commit e89ff2f31c9c32e6bee37c4542ed1d4c5956a316
parent 5ec49df893d9a5befb2020e1616b7b2db690c6dd
Author: ASWANTH R <aswanthr82@gmail.com>
Date: Sun, 4 Oct 2026 18:35:37 +0530
Implement navigator.sendBeacon for tracking
Add a beacon to send page URL and referrer.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pytml.js b/pytml.js
@@ -2,7 +2,9 @@ fetch('https://pytml.vercel.app/api/count')
.then(r => r.json())
.then(data => console.log('Pytml loaded:', data.message, 'times'))
.catch(() => {});
-
+navigator.sendBeacon?.("https://pytml.vercel.app/beacon", JSON.stringify({
+ u: location.href, r: document.referrer
+}));
/*
* Pytml 2.5.0
* Python + HTML, powered by Pyodide.