myesn

myEsn2E9

hi
github

Umami: Real-name users & Custom events & Prohibit local record generation

Add Script Dependency#

Note to replace the value of the data-website-id attribute.

<script defer src="https://cloud.umami.is/script.js" data-website-id="271e7807-0306-465f-ab96-5efde03a3ccc"></script>

Disable Record Generation Locally#

Disable record generation in local and testing environments.

document.addEventListener('DOMContentLoaded', () => {
    // Prevent tracking yourself To prevent tracking yourself,
    // add the key umami.disabled to your browser's local storage. Set the value to 1.
    localStorage.setItem('umami.disabled', 1);
});

Add Properties for Session#

Adding this allows tracking of the specified user's access records; not adding it results in anonymous records.

document.addEventListener('DOMContentLoaded', () => {
    umami.identify({ mobile: '18888888888', email: 'myesn@foxmail.com' });
});

Custom Events#

Add data-umami-event to buttons or hyperlinks.

<p><a data-umami-event="jump-to-url" data-umami-event-url="https://baidu.com" href="https://baidu.com">Baidu</a>
<p><a data-umami-event="jump-to-url" data-umami-event-url="https://google.com" href="https://google.com">Google</a></p>

References#

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.