Page View Counter #2417
-
Guys, Has anyone tried to implement a page view counter for 2sxc? e.g. a counter for the blog or news app. Or have anyone an idea on how we can accomplish this? I guess I can make something like this => var value = (bool)HttpContext.Current.Session["pageVisited"];
` And save PageCounter in the database. But won't that be hard on the database? This would be a fantastic addition to 2sxc. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Okay, so I found this on stack overflow... "So there's nothing built in, but since it's all open-source, you could easily add it. Note that 2sxc data model is optimized for infrequent writing and mass-reading scenarios, so updating data on each view wouldn't be the best way to do this. But you could just put it in a SQL table or something or use another counting/tracking system for that." - iJungleBoy |
Beta Was this translation helpful? Give feedback.
-
Simple counters are often useful, but everybody will have different needs and I don't think it's a priority to add it as a 2sxc feature, also because any developer can quickly brew their own. In terms of DB load I would recommend a basic setup where you only update it every 10 or 100 or so counts. Or you could simply use an existing web service like https://countapi.xyz/ |
Beta Was this translation helpful? Give feedback.
Simple counters are often useful, but everybody will have different needs and I don't think it's a priority to add it as a 2sxc feature, also because any developer can quickly brew their own.
In terms of DB load I would recommend a basic setup where you only update it every 10 or 100 or so counts.
Or you could simply use an existing web service like https://countapi.xyz/