Developer forum
E-mail notifications
NewsV2 - NewsItemViews (Where is it located?)
Posted on 15/04/2011 14:53:29
I've been trying to figure out how newsv2 handles its Show by Views but i cant seem to find it anywhere in the database? , cause i need to manualy update the views, could anyone point me in the right direction of where it is stored?
Replies
Posted on 18/04/2011 07:07:50
Hi Jais,
Please clarify what do you mean under "Show by Views"? Statistics of the opened news?
SELECT TOP 100 Statv2ObjectElement as NewsId, COUNT(*) As Clicks FROM Statv2Object WHERE [Statv2ObjectType]='News' GROUP BY Statv2ObjectElement ORDER BY COUNT(*) DESC
Please clarify what do you mean under "Show by Views"? Statistics of the opened news?
SELECT TOP 100 Statv2ObjectElement as NewsId, COUNT(*) As Clicks FROM Statv2Object WHERE [Statv2ObjectType]='News' GROUP BY Statv2ObjectElement ORDER BY COUNT(*) DESC
Posted on 27/04/2011 14:21:36
Basicly i have a custom module which shows some news, however when i use my custom module to show the news it doesent register that a user has seen the news.
And i use the standard newsv2 to show most popular news, however this doesent work because i use my custom module to show my news normally.
Id prefer using the API to add a record to the database but i couldent locate it anywhere.
And i use the standard newsv2 to show most popular news, however this doesent work because i use my custom module to show my news normally.
Id prefer using the API to add a record to the database but i couldent locate it anywhere.
So i just need'd to know which table to add my row in so that dynamicweb knew that X had seen the news item.
http://nopaste.dk/p3195
Jeppe Eriksson Agger
Posted on 27/04/2011 15:09:33
Hi Jais
You need to add the following piece of code to your Custom Module, when rendering the News Item:
var stat = new Dynamicweb.Frontend.StatisticsObject("News", news.ID.ToString());
That will increment the statistics with the News items you render in your Custom Module. Just make sure, that the first parameter in the constructor is "News" and the second is the ID of the NewsItem being rendered.
Hope this helps :)
- Jeppe
Posted on 27/04/2011 22:09:30
Thank you what i need'd :) , can i ask why this is not part of the newsitem object? wouldent it make more sense? :)
Edit: what is the click parameter on the newsitem object used for?
Also the codesnippet worked so thanks for the hint :)
Edit: what is the click parameter on the newsitem object used for?
Also the codesnippet worked so thanks for the hint :)
Posted on 29/04/2011 00:51:13
Hi Jais,
Clicks property contains information about how many times the news has been opened. This is information stored in statistics.
Clicks property contains information about how many times the news has been opened. This is information stored in statistics.
Posted on 04/05/2011 15:54:50
Could you add a set to the property ? so you dont have to add through statistics but can add on the news item itself.
Nicolai Høeg Pedersen
Posted on 04/05/2011 16:00:28
Making a set on that property would not make sense since that property is a calculation based on statistics.
The newsitem object itself has no way to find out when it is displayed in frontend - thats why you have to log it in the rendering.
The newsitem object itself has no way to find out when it is displayed in frontend - thats why you have to log it in the rendering.
You must be logged in to post in the forum