goatcounter
goatcounter copied to clipboard
pageviews from backend don't follow "Track unique visitors for up to 8 hours" setting
I am sending pageviews from a nodejs backend and the "Track unique visitors for up to 8 hours" setting doesn't seem like it is being followed. When I visit the same page several times from the same computer, goatcounter shows it as having multiple visits instead of just 1 visit as I expected.
const data = {
no_sessions: false,
hits: [
{
ip,
path,
"user_agent": req.headers["user-agent"]
}
]
}
try {
const response = await fetch('https://owir.goatcounter.com/api/v0/count', {
method: 'post',
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
}); ...
Are you sure the ip and user_agent fields are set? Does it return an error if you drop the no_sessions parameter?
What is the actual request it sends?
Still happens after dropping no_sessions. I deleted all the pageviews, sent the following and then gc showed 2 views for / and 1 view for /about .
Nov 17 05:01:48 PM
{"hits": [{
"ip": "70.179.129.22",
"path": "/",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
}]}
Nov 17 05:01:57 PM
{"hits": [{
"ip": "70.179.129.22",
"path": "/about",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
}]}
Nov 17 05:04:44 PM
{"hits": [{
"ip": "70.179.129.22",
"path": "/",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
}]}