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

>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.

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

Leave a Reply