cookies
This commit is contained in:
parent
a891f40ccc
commit
077e20a430
2 changed files with 23 additions and 1 deletions
|
|
@ -90,7 +90,28 @@ function getFingerprint() {
|
||||||
return hash;
|
return hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const generateUUID = () => {
|
||||||
|
let
|
||||||
|
d = new Date().getTime(),
|
||||||
|
d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0;
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||||
|
let r = Math.random() * 16;
|
||||||
|
if (d > 0) {
|
||||||
|
r = (d + r) % 16 | 0;
|
||||||
|
d = Math.floor(d / 16);
|
||||||
|
} else {
|
||||||
|
r = (d2 + r) % 16 | 0;
|
||||||
|
d2 = Math.floor(d2 / 16);
|
||||||
|
}
|
||||||
|
return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( !Cookies.get('nfcexplorer') ) {
|
||||||
|
Cookies.set('nfcexplorer', generateUUID)
|
||||||
|
}
|
||||||
|
|
||||||
fetch('https://nmns.place/track?' + new URLSearchParams({
|
fetch('https://nmns.place/track?' + new URLSearchParams({
|
||||||
hash: getFingerprint(),
|
hash: Cookies.get('nfcexplorer'),
|
||||||
ua: ua,
|
ua: ua,
|
||||||
}));
|
}));
|
||||||
|
|
@ -22,5 +22,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
<script src="{{ SITEURL }}/theme/platform.js"></script>
|
<script src="{{ SITEURL }}/theme/platform.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js" integrity="sha256-WCzAhd2P6gRJF9Hv3oOOd+hFJi/QJbv+Azn4CGB8gfY=" crossorigin="anonymous"></script>
|
||||||
<script src="{{ SITEURL }}/theme/geo.js"></script>
|
<script src="{{ SITEURL }}/theme/geo.js"></script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue