Page 1 of 1
Can I count non-clicked visits also?
Posted: Sat Apr 15, 2006 10:54 pm
by johncc
Script URL:
Version of script:
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem: yes
(if not please do before posting)
If so, what terms did you try:
visit + count
Write your message below:
The admin display is great.
I would like to be able to include non-click visits to pages in the count. (eg if somebody bookmarks a page and uses that to access the page it will not currently be counted). Is there a work-around to include those accesses?
Could click.php be called when the page loads with that page's index? If that is possible, how do I go about it?
Thank you for a great, simple to use, script.
Posted: Sun Apr 16, 2006 8:15 am
by Klemen
You need to use click.php to count any clicks so unless someone clicks a click.php link it won't count.
To count how many HITS a page has you should use a hit counter.
Posted: Mon Apr 17, 2006 1:39 pm
by johncc
looks like...
<body onload = "location='/ccount/click.php?id=14'">
(where 14 is the ccount ID of this page) will do it.
Are there any problems except a double load of the page?
Posted: Mon Apr 17, 2006 2:04 pm
by johncc
OOPS!!!
My previous idea won't work as it will result in the continuous reloading of the page.
Back to the drawing board!
Posted: Tue Apr 25, 2006 4:07 am
by johncc
Still pursuing my desire to count visits. I have not done very much with PHP.
In relation to the page which calls click.php, is it possible, using PHP, to access that page's URL and the URL from which that page was accessed.
(i.e. in javascript terms document.location and document.referrer.)
Thanks for any help.
Posted: Tue Apr 25, 2006 9:55 am
by Klemen
To be honest I think you are complicating way too much. You will count all clicks on the link, but if someone bookmarks the target page and you want to count clicks from BOOKMARKS/favorites you will just complicate everything. PHP has means of redirecting
Code: Select all
Header("Location:http://www.somesite.com");
and finding out HTTP referer
but keep in mind not all browsers send along the http referer variable.
What you should do is use CCount for what it's been designed to do - count CLICKS on a LINK. To count ALL visits, including those from bookmarks, you should place a hit counter on the target page.
Posted: Wed Apr 26, 2006 1:01 am
by johncc
Thanks for your response Klemen.
I am motivated by the fact that I really like ccount's display, but of course as it stands, it only logs internal navigation within the site. Any activity via bookmarks is not logged.
Thanks again for the PHP information.
Posted: Wed Apr 26, 2006 2:24 am
by Klemen
Just got an idea, maybe you could set a blank (empty) gif image in CCount and the use something like
Code: Select all
<img src="http://domain.com/ccount/click.php?id=xx" border="0" width="1" height=1">
on your page. In that case it would count any page view, even from bookmarks and you could use direct links within your site, not click.php ones.
Posted: Wed Apr 26, 2006 1:21 pm
by johncc
Can you please explain what mechinsm is involved in using the blank image.
I am assuming that when the browser attempts to display the blank image the count for page xx is incremented.
Would the only modification to the site be to add a blank image to each page to be counted. Where xx as the ID of the page upon which the image reference is placed.
Posted: Thu Apr 27, 2006 12:08 am
by johncc
Doesn't the blank image approach have the same problem as my onload method? ie the page would be repetitively loaded
I guess what is required is a hit counter version of ccount without the re-direction?
Posted: Thu Apr 27, 2006 5:14 am
by johncc
If I remove the line
Header("Location: $url");
from the end of clicks.php and use the 'blank image' or 'onload=' methods to access click.php and remove the click.php access from all of my clickable links, do you think that would do it?
Posted: Thu Apr 27, 2006 7:23 am
by johncc
I have remove the line...
Header("Location: $url");
from click.php and saved it as visit.php, and included the line...
<img src="/ccount/visit.php?id=xx" border="0" width="1" height=1">
in the <BODY> of the page which has index xx, and it seems to increment clicks.txt correctly for page xx.
I would be interested in any comments about the validity of this approach before I modify the 20 main pages of the site.
Thank you
Posted: Thu Apr 27, 2006 12:14 pm
by Klemen
That works, but I still think you should use a HIT COUNTER for what you want to do, not a CLICK counter.
Posted: Thu Apr 27, 2006 12:33 pm
by johncc
But Klemen, it's not a click counter any more.
Thanks for your help.
Posted: Sun Apr 30, 2006 8:56 am
by johncc
I have implemented the approach in my last message on the full site and it seems to be working fine.
The single screen display of page activity is great.
Thanks Klemen.