Fichiers

20 lignes
1.0 KiB
HTML

<!doctype html>
<html lang="fr"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Démo mesure d'audience</title>
<script src="/m.js" defer></script>
<style>body{font:16px system-ui;max-width:40rem;margin:2rem auto;padding:0 1rem}button{margin:.2rem}</style>
</head><body>
<h1>Démo mesure d'audience (local)</h1>
<p>Chaque chargement envoie un événement à <code>/m</code>. <a href="/page2.html">Page 2</a></p>
<p>UID stocké : <code id="u">?</code></p>
<button id="off">Ne plus être compté</button> <button id="on">Être compté à nouveau</button>
<script>
document.addEventListener("DOMContentLoaded", function () {
var show = function () { document.getElementById("u").textContent = localStorage.getItem("gm_uid") || (localStorage.getItem("gm_optout") ? "(opposition enregistrée)" : "(aucun)"); };
document.getElementById("off").onclick = function () { gmOptOut(); show(); };
document.getElementById("on").onclick = function () { gmOptOut(false); show(); };
show();
});
</script>
</body></html>