Create a Google Sheet Script that accepts a POST command

Job ID: 31375641

Budget: €8 – €30 EUR

Hi I have created a JavaScript code (below) and I need to send the information to a sheet for every time a user visits my site.

NOTE: I don't mind that you use code already published online because tis exists already. As long as you can explain it to me and I can replicate it.

Here's an example of how I would like the sheet to look like: https://docs.google.com/spreadsheets/d/1r1Y44nkYTpDOMBj0ug9FfAGEIm2gOrrUm8gBsVHj71k/edit?usp=sharing

Here's the code:
<script async>
setTimeout(function () {
if (window.google_tag_manager === undefined) {
var request = new XMLHttpRequest();
var userAgents = navigator.userAgent;
var timeStamp = new Date().toUTCString();
var pageViewed = window.location.href;
var browserRes = window.screen.availWidth+'x'+window.screen.availHeight;
request.open("POST", "GOOGLE_SHEET_SCRIPT_URL");
request.setRequestHeader('Content-type', 'application/json');

var params = {
useragent: userAgents,
timestamp: timeStamp,
browserresolution: browserRes,
pageview: pageViewed
}

request.send(JSON.stringify(params));
}
else {
console.log('habemus GTM')
}
}, 3000);</script>


Requirements:
I need this to be "replicatable"
I need a working Google Sheet