Creating web page view number tracker?

Hi all, nice to meet you :) I'd like to know where to start in creating something that tracks how many people has viewed a page, or a website Googling comes up with way too many tools, rather than how to actually create one yourself Does anyone know where I could go to create this, and other similar tools? Any sort of starting point would be great :)
8 Replies
Rägnar O'ock
Rägnar O'ock3w ago
There's 2 main ways of tracking that : - on the server: each time the page is requested, log the request somewhere - on the client: each time a page is loaded have a bit of js send an event to a logging server The serverside way is more precise because not blockable by the user, but it is not feasible at scale as it won't work if the page is cached (at any point along its path) The client side way is less precise (because an adblocker can prevent the call) but it can work in more situations (SPAs, cached MPAs...)
ἔρως
ἔρως3w ago
also, doesn't it require consent from the user? (for gdpr or other law's purposes)
Rägnar O'ock
Rägnar O'ock3w ago
Not if you only track "the page was loaded" But if you add more stuff you might need to But that's valid for both cases
ἔρως
ἔρως3w ago
it's good to have that in mind
James
JamesOP3w ago
Really fair point I don't want to do anything that a user might be unaware of That latter one sounds interesting I was wondering how possible it was to do it in JS I assumed it was difficult due to the amount of tools there are for this thing and like 0 tutorials on making your own The serverside one, I asume would also use javascript
Rägnar O'ock
Rägnar O'ock3w ago
Serverside uses whatever you have on the server. As for it being hard to do, usually the number of tools to do something is inversely proportional, the harder it is the less tool exist to do it
James
JamesOP3w ago
That... makes sense I always thought that rule was based on number of tutorials Rather than number of tools But this makes more sense I'm surprised I could not find any tutorials then Perhaps I need to learn where to look
Rägnar O'ock
Rägnar O'ock3w ago
Usually for that kind of stuff you don't really find tutorials. You might find guides or usage docs. Tutorials exist for entry level stuff but for more advanced stuff you'll need to read the doc and figure it out yourself because most often even if you find a tuto it won't be applicable to your specific situation. So tool creators don't bother with it Tldr : tutorials exist for simple stuff, for complex stuff you need to read the doc

Did you find this page helpful?