Hello.
I'm just wondering if I can share the click stat between two websites?
It's like this: the counter is installed on the first website. The second website will also contain some of the contents of the first website. Is it possible to show the click stat directly from the first website to the second website?
I already tried linking the "display.php" file from the first website but nothing happens. What I did just to show the click stats on the second website is by backing up the database from the first site and restoring it to the second site every week. I wish there's a much easier way.
Thanks.
Sharing click stats between sites
Re: Sharing click stats between sites
Interesting question.
With default files it doesn't work because the settings and functions are overwritten by each new display.php you load.
I prepared a modified display file that should work on remote websites.
To make this work:
1. Upload the display_remote.php file to each copy of CCount
2. On the first website, first import the local display.php, just like in the instructions:
3. after that code, include display_remote.php from the second website:
4. now you can display any count from the second website by prefixing ID with "remote_". So, to show count on link with ID 526 from the second website, the code is:
That should do it.
If you have more than one remote website, you should edit the display_remote.php file on each website and give IDs a unique prefix by changing to for example and you would then use this code for that website
With default files it doesn't work because the settings and functions are overwritten by each new display.php you load.
I prepared a modified display file that should work on remote websites.
To make this work:
1. Upload the display_remote.php file to each copy of CCount
2. On the first website, first import the local display.php, just like in the instructions:
Code: Select all
<script src="http://first.com/ccount/display.php"></script>
Code: Select all
<script src="http://second.com/ccount/display_remote.php"></script>
Code: Select all
<script>ccount_display('remote_526')</script>
If you have more than one remote website, you should edit the display_remote.php file on each website and give IDs a unique prefix by changing
Code: Select all
$prefix = 'remote_';
Code: Select all
$prefix = 'second_';
Code: Select all
<script>ccount_display('second_526')</script>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Re: Sharing click stats between sites
Thanks a lot. This should get the job much easier.
Re: Sharing click stats between sites
Hello.
I followed the instructions but unfortunately, it doesn't work. The page on the second website now contains these scripts in the heading:
<script src="http://redist.ezyro.com/cnt/display.php"></script>
<script src="http://mimic.ezyro.com/c/display_remote.php"></script>
I uploaded "display_remote.php" to where "display.php" is located on both websites. I now display the click count with this as you instructed:
<script>ccount_display('remote_180')</script>
Nothing happens. The click stats disappeared. Anyway to fix it?
Thanks.
I followed the instructions but unfortunately, it doesn't work. The page on the second website now contains these scripts in the heading:
<script src="http://redist.ezyro.com/cnt/display.php"></script>
<script src="http://mimic.ezyro.com/c/display_remote.php"></script>
I uploaded "display_remote.php" to where "display.php" is located on both websites. I now display the click count with this as you instructed:
<script>ccount_display('remote_180')</script>
Nothing happens. The click stats disappeared. Anyway to fix it?
Thanks.
Re: Sharing click stats between sites
That's because you don't have a link with ID 180 in your http://mimic.ezyro.com/c/ counter (max ID is 179).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Re: Sharing click stats between sites
Yes, because ID 180 is on redist and I haven't added it yet on mimic. I want to fetch it from redist and display the click count on mimic. If that's the case, it still won't work because all the ID on redist need to be on mimic. Then I still have to backup and restore the database from redist to mimic. I think there's no way to fetch the IDs from redist and display the click count on mimic.Klemen wrote: Thu Jun 14, 2018 3:23 pm That's because you don't have a link with ID 180 in your http://mimic.ezyro.com/c/ counter (max ID is 179).
Oh well, back to the usual backup and restore thing. Thanks.
Re: Sharing click stats between sites
I think the variables in display.php are local only to the site and can't be passed on to another site just like with the variables in a function in JavaScript which can't be used in another function. I wish there's another way of fetching the counts from a remote site.
Re: Sharing click stats between sites
My example above does just that; the display_remote.php passes variables from one site to another one for use within that site's function.
If you need some specific way to pass variables (not in the format CCount uses) it will be up to you to properly format and use them, or hire a PHP developer for help.
If you need some specific way to pass variables (not in the format CCount uses) it will be up to you to properly format and use them, or hire a PHP developer for help.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
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


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
Re: Sharing click stats between sites
Finally fixed it. Thanks for the display_remote.php file you created. The display_remote.php file is no longer needed on the page. By uploading the file to both sites, it somehow automatically passed on the variables for the counter. On the second site, instead of putting its own display.php script, I replaced it with the display.php script of the first website and that did the trick. The pages on the second website can now display the click stats from the first website. Also, the "remote_" prefix doesn't needed to be added on the ID because it will not work.
That file you created is the savior. Thanks again.
That file you created is the savior. Thanks again.