Home > Blockchain >  I want to limit the total number of articles read on my webpage by a user, without signup, like how
I want to limit the total number of articles read on my webpage by a user, without signup, like how

Time:10-08

I don't have any idea how to implement this. After a bit of search I found out that medium keeps track of the browser and not the user, what is mean is you can access three free articles from each new browser on the same machine (if I am wrong do point it out). I am using React and Firebase for my website.

Edit: I was thinking along the lines of getting some kind of id which is unique to a browser. As cookies and local storage can always be bypassed.

CodePudding user response:

Use javascript and implement a system that uses a cookie or local-storage to verify how many articles are read on your website.

On most of these websites however you are still able to bypass this limit by clearing the cache or using a incognito window.

To also limit these scenarios you can use a cookie in combination with an IP address, which has its own drawbacks, especially in corporate environments, and mobile connections where IP addresses are heavily shared or changed. Depending on your situation this may matter or not.

CodePudding user response:

I don't know if it's a clean way to do it but you can associate an IP to an unique counter. Or with a cookie but he can bypass that by cleaning the cookies

CodePudding user response:

The answer would tightly depend on your application setup and especially on the service backing your front store.

If you are using a self-backed backend, for example a - based server, within your route middleware you can access the remote address from the req.connection.remoteAddress request property along with the user-agent req.header('User-Agent') and forward these to your datastore being Firebase in this case.

If you are deploying your application to Google Cloud Function, you can then access the remote peer address using the fastly-client-ip request header and still forward this to your storage system.

  • Related