Let’s say you have a blog and a user can “Like” and article. On your average site with a userbase your user would be logged in and this data would likely be stored in a Database but with something like a WordPress blog where your user is likely not logged into an account, to keep track if they “Like” an article or not you likely store it’s id into a Cookie for them. At least that’s how most existing solutions do it.
My issue with this is all the solutions I have seen so far create a new cookie for each article a user likes. If you have a large blog with hundreds or thousands of articles and say a user likes 150 articles, that’s 150 cookies being sent with each request. Just the thought of this scares me.
My idea is to store each Article ID into the same cookie in eaither JSON format or possibbly just the ID’s separated with a |
I would then have to extract all the ID’s into an array or something so it adds slightly more processing but would cut down on the HTTP requests
I would love to hear other thoughts on how to do this?
Does the server need to know about it? What if you stored it purely client-side, with
localStorage?