Can I count non-clicked visits also?

Post your Click counter digestion problems here
Post Reply
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Can I count non-clicked visits also?

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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?
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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!
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post 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

Code: Select all

variable $_SERVER['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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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.
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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?
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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?
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

That works, but I still think you should use a HIT COUNTER for what you want to do, not a CLICK counter.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post by johncc »

But Klemen, it's not a click counter any more. :D :D

Thanks for your help.
johncc
Posts: 11
Joined: Sat Apr 15, 2006 10:38 pm

Post 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.
Post Reply