Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I want to use JS to store website data in a separate .TXT file

On my website I have an error404 page, I want to use Javascript to count how many users view that error and store the number in a seperate text document, how might I go about that?

My 404 page is here: http://nebula49dev.rf.gd/error.html

My repo is here: https://github.com/IsaiahSloan/nebsite

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you are haven’t backend server, you can use https://countapi.xyz/ API for counting visit of the page.

Sent request on API and when 404page loaded.

<script>
function cb(response) {
    document.getElementById('visits').innerText = response.value;
}
</script>
<script async src="https://api.countapi.xyz/hit/mysite.com/visits?callback=cb"></script>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading