Number of times an article is viewed?
BorisB 0
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
Yes, this is possible.
Yes, this is possible.
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
Yes that's made all the pages have the same number and every page is updating properly now.
I guess the problem is, for example, if I havent created "page three" of a review but have created page one and two already, then go to check page one a few times and then create page three it will not have those few page views strored in its review_extra7 field, so the count is slighlty behind the other pages as it didn't exist when counting began on the review.
I guess after i post a review fully i will use phpadmin to sort this problem out.
Thanks for your help once again!
PS, I'm working on a redesign of my website and was wondering if you could simply confirm that I can do the following, i'm sure its possible as i think i've seen a thread a long time ago about this very thing. I'd like to call up different information depending on what page is being displayed.
For example, if someone clicks on a review and the review is of a memory product, i'd like to call in site_footer a list of all the latest memory reviews and another showing all the latest news posts about memory (I realize i will have to setup a news category called "Memory" to do this).
If you could just confirm this as possible I'll get back to you when i would like to implement this feature.
Cheers.
James.
Yes that's made all the pages have the same number and every page is updating properly now.
I guess the problem is, for example, if I havent created "page three" of a review but have created page one and two already, then go to check page one a few times and then create page three it will not have those few page views strored in its review_extra7 field, so the count is slighlty behind the other pages as it didn't exist when counting began on the review.
I guess after i post a review fully i will use phpadmin to sort this problem out.
Thanks for your help once again!
PS, I'm working on a redesign of my website and was wondering if you could simply confirm that I can do the following, i'm sure its possible as i think i've seen a thread a long time ago about this very thing. I'd like to call up different information depending on what page is being displayed.
For example, if someone clicks on a review and the review is of a memory product, i'd like to call in site_footer a list of all the latest memory reviews and another showing all the latest news posts about memory (I realize i will have to setup a news category called "Memory" to do this).
If you could just confirm this as possible I'll get back to you when i would like to implement this feature.
Cheers.
James.
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
That's odd. What happened if you try to update the counter manually over phpMyAdmin?
Here an example query to reset all counters in this review (16) to 800:
That's odd. What happened if you try to update the counter manually over phpMyAdmin?
Here an example query to reset all counters in this review (16) to 800:
UPDATE esselbach_st_review SET review_extra7 = '800' WHERE review_id = '16';
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
http://www.pureoverclock.com/review.php?id=16&page=1
If you flick through each page the xxx Reads part is different. If it was grabbibg the first value and using that for all the pages it couldn't happen.
Have i done something wrong again lol?
http://www.pureoverclock.com/review.php?id=16&page=1
If you flick through each page the xxx Reads part is different. If it was grabbibg the first value and using that for all the pages it couldn't happen.
Have i done something wrong again lol?
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
It's not because UPDATE esselbach_st_review SET review_extra7=review_extra7+1 WHERE review_id = '$id' will update all article pages at once with the counter on the first page.
One final thing I've noticed about the counter is that when i place $insert[review_extra1] in template "review_header" it grabs the number from different page id's and not just from page1 of a reviews id. This means the potential for grabing different values is quite high.
It's not because UPDATE esselbach_st_review SET review_extra7=review_extra7+1 WHERE review_id = '$id' will update all article pages at once with the counter on the first page.
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
One final thing I've noticed about the counter is that when i place $insert[review_extra1] in template "review_header" it grabs the number from different page id's and not just from page1 of a reviews id. This means the potential for grabing different values is quite high.
This is slightly annoying as all these figures are different on my site because of when i was having problems and also because when i post a review up i check for errors on each page as I go, so usually pages have been refresh before the whole review is up online, so there is always a difference of 3 or 4 views as you go down the pages.
Is there a way to get it to read from page 1's $insert[review_extra1] only?
Thanks.
One final thing I've noticed about the counter is that when i place $insert[review_extra1] in template "review_header" it grabs the number from different page id's and not just from page1 of a reviews id. This means the potential for grabing different values is quite high.
This is slightly annoying as all these figures are different on my site because of when i was having problems and also because when i post a review up i check for errors on each page as I go, so usually pages have been refresh before the whole review is up online, so there is always a difference of 3 or 4 views as you go down the pages.
Is there a way to get it to read from page 1's $insert[review_extra1] only?
Thanks.
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
Doh, I should have known you wouldn't post up code that was iffy, you never do, i should have known it was me doing something wrong.
I hit problems because i was already using 6 fields for reviews and so i changed the code to this when attempting the mod::
UPDATE esselbach_st_review SET review_extra7=review_extra7+7
So it was adding 7 views instead of one. All fixed now and witho caching disabled it refreshes real time.
Thanks for taking the time to help on a Sunday.
Doh, I should have known you wouldn't post up code that was iffy, you never do, i should have known it was me doing something wrong.
I hit problems because i was already using 6 fields for reviews and so i changed the code to this when attempting the mod::
UPDATE esselbach_st_review SET review_extra7=review_extra7+7
So it was adding 7 views instead of one. All fixed now and witho caching disabled it refreshes real time.
Thanks for taking the time to help on a Sunday.
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
To disable the caching system on review pages only. Open review.php and remove:
Find:
and replace with:
To disable the caching system on review pages only. Open review.php and remove:
$cache = GetCache("reviews", "review-$id-$page");
if (!$cache)
{
Find:
WriteCache("reviews", "review-$id-$page", $review, 0);
}
and replace with:
echo $review;
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
This is the easiest way to implant this feature in the Storyteller 1.x series.
The updated script (above) will count only on the first page. The counter is actually in real time, only the page will refresh every 10 minutes. You could disable the caching system to see the output of the counter in real time. However, this would add additional load to the server.
This is the easiest way to implant this feature in the Storyteller 1.x series.
The updated script (above) will count only on the first page. The counter is actually in real time, only the page will refresh every 10 minutes. You could disable the caching system to see the output of the counter in real time. However, this would add additional load to the server.
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
Thanks Philipp, I appreciate the help with all this but it's just not as solid an idea as i would like to have for my article counter.
Like i said, the Silent PC Review counter works real time and updates page views on only the first page of a review and doesn't use a field to sort of hack the article view feature.
This, in my opinion is the only way a counter should work if it's to be of any use. Ok, real time is not really essential, but it lets you know if its' working correctly as you can test it and see it update right away.
I guess it works for some peope but just doesn't suit my need for accurate reporting i guess.
Could i use a third party script for accurate article counting?
Thanks Philipp, I appreciate the help with all this but it's just not as solid an idea as i would like to have for my article counter.
Like i said, the Silent PC Review counter works real time and updates page views on only the first page of a review and doesn't use a field to sort of hack the article view feature.
This, in my opinion is the only way a counter should work if it's to be of any use. Ok, real time is not really essential, but it lets you know if its' working correctly as you can test it and see it update right away.
I guess it works for some peope but just doesn't suit my need for accurate reporting i guess.
Could i use a third party script for accurate article counting?
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
Change the review count script to:
The script will now only count on the first page.
Yes, it's the caching system. Open review.php and find:
Replace this code with
This will change the caching system to refresh the review pages every 10 minutes.
I've been keeping an eye on the stats and every time i refresh a page it adds not just 1 extra page view but however many pages there are to that review, so basically if a review is 12 pages, its updating the page views by 12, just by refreshing one page first page.
Change the review count script to:
// Review count
dbconnect();
if ($page < 2)
{
DBQuery("UPDATE esselbach_st_review SET review_extra1=review_extra1+1 WHERE review_id = '$id'");
}
The script will now only count on the first page.
It also doesn't update reatime, i guess its using the caching system.
Yes, it's the caching system. Open review.php and find:
WriteCache("reviews", "review-$id-$page", $review, 0);
Replace this code with
WriteCache("reviews", "review-$id-$page", $review, MkTime()+600);
This will change the caching system to refresh the review pages every 10 minutes.
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
Hello again, this code isn't working for me actually. I've been keeping an eye on the stats and every time i refresh a page it adds not just 1 extra page view but however many pages there are to that review, so basically if a review is 12 pages, its updating the page views by 12, just by refreshing one page first page. It also doesn't update reatime, i guess its using the caching system.
Philipp, would you be able to make this work exactly like on silent PC review. There stats update real time:
http://www.silentpcreview.com/article15-page1.html
If you refresh this page it will show one extra page view right away.
Thanks!
Hello again, this code isn't working for me actually. I've been keeping an eye on the stats and every time i refresh a page it adds not just 1 extra page view but however many pages there are to that review, so basically if a review is 12 pages, its updating the page views by 12, just by refreshing one page first page. It also doesn't update reatime, i guess its using the caching system.
Philipp, would you be able to make this work exactly like on silent PC review. There stats update real time:
http://www.silentpcreview.com/article15-page1.html
If you refresh this page it will show one extra page view right away.
Thanks!
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
What is it actually counting here?
If an article has 23 pages and a person clicks every page and reads all the way through, is it going to update the article views by 23 or just by 1?
I have a feeling it gets its data by how many times the first page of an article is refreshed, so if someone is on page one and keeps on refreshing over and over it will go up by the amount of times this person pressed refresh. If he was to go on and do this to page two it would not update the views anymore, correct?
This is how it works here anyway: http://www.silentpcreview.com/article15-page1.html
What is it actually counting here?
If an article has 23 pages and a person clicks every page and reads all the way through, is it going to update the article views by 23 or just by 1?
I have a feeling it gets its data by how many times the first page of an article is refreshed, so if someone is on page one and keeps on refreshing over and over it will go up by the amount of times this person pressed refresh. If he was to go on and do this to page two it would not update the views anymore, correct?
This is how it works here anyway: http://www.silentpcreview.com/article15-page1.html
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
I assume you are using the freeware version. Open mod_review.php and find:
Replace this with:
Then open mod_news.php and find:
and replace with:
This will add a pageview counter on the edit/remove pages of reviews and news
I assume you are using the freeware version. Open mod_review.php and find:
$result = DBQuery("SELECT review_title, reviewpage_id, review_page, review_hook FROM esselbach_st_review ORDER BY reviewpage_id DESC LIMIT 100");
while (list($review_title, $reviewpage_id, $review_page, $review_hook) = mysql_fetch_row($result))
{
if ($review_hook)
{
$review_title = "<font color="red">$review_title</font>";
}
TblMiddle2("$reviewpage_id / 1", "$review_title ($review_page)", "editreview&opts=editreview-$reviewpage_id", "editreview&opts=deletereview-$reviewpa
ge_id");
}
Replace this with:
$result = DBQuery("SELECT review_title, reviewpage_id, review_page, review_hook, review_extra1 FROM esselbach_st_review ORDER BY reviewpage_id DESC LIMIT 100");
while (list($review_title, $reviewpage_id, $review_page, $review_hook, $review_extra1) = mysql_fetch_row($result))
{
if ($review_hook)
{
$review_title = "<font color="red">$review_title</font>";
}
TblMiddle2("$reviewpage_id / 1", "$review_title ($review_page) / $review_extra1 pageviews", "editreview&opts=editreview-$reviewpage_id", "editreview&opts=deletereview-$reviewpa
ge_id");
}
Then open mod_news.php and find:
$result = DBQuery("SELECT story_title, story_id, story_sticky, story_hook FROM esselbach_st_stories ORDER BY story_id DESC LIMIT 100");
while (list($story_title, $story_id, $story_sticky, $story_hook) = mysql_fetch_row($result))
{
($story_sticky) ? $featured = "<b>$words[FEATR]</b>" :
$featured = "";
if ($story_hook)
{
$story_title = "<font color="red">$story_title</font>";
}
TblMiddle2("$story_id / 1", "$story_title $featured", "editnews&opts=editstory-$story_id", "editnews&opts=deletestory-$story_id");
}
and replace with:
$result = DBQuery("SELECT story_title, story_id, story_sticky, story_hook, story_extra1 FROM esselbach_st_stories ORDER BY story_id DESC LIMIT 100");
while (list($story_title, $story_id, $story_sticky, $story_hook, $story_extra1) = mysql_fetch_row($result))
{
($story_sticky) ? $featured = "<b>$words[FEATR]</b>" :
$featured = "";
if ($story_hook)
{
$story_title = "<font color="red">$story_title</font>";
}
TblMiddle2("$story_id / 1", "$story_title $featured / $story_extra1 pageviews", "editnews&opts=editstory-$story_id", "editnews&opts=deletestory-$story_id");
}
This will add a pageview counter on the edit/remove pages of reviews and news
1 Re: Number of times an article is viewed?
Forma 17
From: -
From: -
Number of times an article is viewed?
This is great!
I'm curious though, is there any way to keep an eye on this data without having to have it displayed on the main site for everyone to see?
This is great!
I'm curious though, is there any way to keep an eye on this data without having to have it displayed on the main site for everyone to see?
1 Re: Number of times an article is viewed?
BorisB
OP
0
From: -
From: -
Number of times an article is viewed?
Philipp,
Excellent! Thank you. It works perfectly, although there is a minor typo.
esselbach_st_reviews in your code snippet above should be esselbach_st_review, like this:
I've already installed it and it is giving me great insights into what is popular and what is not so popular
Philipp,
Excellent! Thank you. It works perfectly, although there is a minor typo.
esselbach_st_reviews in your code snippet above should be esselbach_st_review, like this:
// Review count
dbconnect();
DBQuery("UPDATE esselbach_st_review SET review_extra1=review_extra1+1 WHERE review_id = '$id'");
I've already installed it and it is giving me great insights into what is popular and what is not so popular
1 Re: Number of times an article is viewed?
timbo 0
From: -
From: -
Number of times an article is viewed?
That is a very good idea - will add that myself.
That is a very good idea - will add that myself.
1 Re: Number of times an article is viewed?
Philipp
From: Austria
Administrator
1342From: Austria
Number of times an article is viewed?
With two small modifications.
First, open cadmin and add a new news field: News => Edit Fields => Enabled, text only and a new review field: Reviews => Edit Fields => Enabled, text only
Then open story.php in an editor and add after:
the following:
and save the file. Next open review.php in an editor and add after:
the following:
Now you can use $insert[story_extra1] and $insert[review_extra1] in the story/review templates to show how many times an item has been viewed.
Let me know if you have any additional questions.
With two small modifications.
First, open cadmin and add a new news field: News => Edit Fields => Enabled, text only and a new review field: Reviews => Edit Fields => Enabled, text only
Then open story.php in an editor and add after:
HeaderBlock();
the following:
// Story count
dbconnect();
DBQuery("UPDATE esselbach_st_stories SET story_extra1=story_extra1+1 WHERE story_id = '$id'");
and save the file. Next open review.php in an editor and add after:
if (!$page) $page = 1;
the following:
// Review count
dbconnect();
DBQuery("UPDATE esselbach_st_reviews SET review_extra1=review_extra1+1 WHERE review_id = '$id'");
Now you can use $insert[story_extra1] and $insert[review_extra1] in the story/review templates to show how many times an item has been viewed.
Let me know if you have any additional questions.
Philipp,
Is there a way to track how many times a particular article or news item is viewed?