hitcounter

Django Hit Count ImportError

帅比萌擦擦* 提交于 2020-01-16 09:59:28
问题 I am trying to use the django hitcount, and I am following the only tutorial out there for it https://django-hitcount.readthedocs.io/en/latest/installation.html, and I am getting stuck on step 2--adding hitcount to the list of installed apps. When I do that, and try and run the server, I get the following error: ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' settings.py INSTALLED_APPS = [ 'hitcount', 'auctionitem.apps.AuctionitemConfig', 'blog.apps

How do I keep track of how many times an external link is clicked?

狂风中的少年 提交于 2019-12-22 23:19:30
问题 I have a site affiliated with a university and we want to link to another site that has a certain teaching program. How can we track the number of times this link has been clicked from within our website? 回答1: I would use jquery and/or ajax to touch a page in the background (ajax) that counts hits whenever a link is clicked and then proceed to allow the link do what it does. 回答2: You can use web analytics tools such as Google Analytics or commercial software such as WebTrends. 回答3: Instead of

How to reset a persistent counter at a particular value?

核能气质少年 提交于 2019-12-22 13:57:27
问题 I had asked a question earlier( How to keep this counter from reseting at 100,000? ), and now have a follow-up question. I have another version of the counter in question that can be told to reset at a certain number, and I would like to make sure that this second version does not have the same problem as the first. What I have coded now is: $reset = '10'; $filename4 = "$some_variable/$filename3.txt"; // Open our file in append-or-create mode. $fh = fopen($filename4, "a+"); if (!$fh) die(

How best to block multiple “counts” on a counter?

爷,独闯天下 提交于 2019-12-08 09:16:12
问题 I've got a real cheesy counter, just adds one to the counter field when a visit hits it. It's not counting page hits, but it's still cheesy. What I need to do is stop someone from just hitting refresh over and over. What's the simplest was to get this done? Cookies? I'd prefer not to log every visitor's ip address, etc... something simple - in C# asp.net mvc. 回答1: Yes, cookies would be a simple way to achieve that. Even simpler would be to simply set a value in Session - if that is set, this

How do I keep track of how many times an external link is clicked?

坚强是说给别人听的谎言 提交于 2019-12-06 16:03:56
I have a site affiliated with a university and we want to link to another site that has a certain teaching program. How can we track the number of times this link has been clicked from within our website? I would use jquery and/or ajax to touch a page in the background (ajax) that counts hits whenever a link is clicked and then proceed to allow the link do what it does. You can use web analytics tools such as Google Analytics or commercial software such as WebTrends. Instead of directly providing the external link, link to a page on your own site that redirects to the link, and it will be

How to reset a persistent counter at a particular value?

和自甴很熟 提交于 2019-12-06 10:02:31
I had asked a question earlier( How to keep this counter from reseting at 100,000? ), and now have a follow-up question. I have another version of the counter in question that can be told to reset at a certain number, and I would like to make sure that this second version does not have the same problem as the first. What I have coded now is: $reset = '10'; $filename4 = "$some_variable/$filename3.txt"; // Open our file in append-or-create mode. $fh = fopen($filename4, "a+"); if (!$fh) die("unable to create file"); if ($reset == 'default'){ // Before doing anything else, get an exclusive lock on

Can you at least get the domain of the https referer?

淺唱寂寞╮ 提交于 2019-12-02 15:44:42
问题 I've noticed that if a foreign https: site links to my non-https site, that I don't get anything in the HTTP Referer header at all. I've experienced this with access.log , but I presume the same happens with JavaScript's document.referrer , too. So, if the referrer is https, is there no way to get any information about it? Not even the hostname / domain name? Or is it possible to somehow get at least the domain, with JavaScript? Also, I presume running my own site with https isn't going to

Hit Counter in Codeigniter

荒凉一梦 提交于 2019-12-01 00:51:21
I have the code below: (Step by step) Put counter.txt in APPPATH . 'logs/counter.txt' Make counter_helper.php set in APPPATH . 'helpers/counter_helper.php' ; Autoload newly created helper in APPPATH . 'config/autoload.php' file; Make MY_Controller.php in APPPATH . 'core/MY_Controller.php' Any controller should extend MY_Controller instead of CI_Controller ; Echo it on page with: <?php echo $this->count_visitor;?> The Helper : <?php defined('BASEPATH') OR exit('No direct script access allowed.'); if ( ! function_exists('count_visitor')) { function count_visitor() { $filecounter=(APPPATH . 'logs

Hit Counter in Codeigniter

我与影子孤独终老i 提交于 2019-11-30 18:06:06
问题 I have the code below: (Step by step) Put counter.txt in APPPATH . 'logs/counter.txt' Make counter_helper.php set in APPPATH . 'helpers/counter_helper.php' ; Autoload newly created helper in APPPATH . 'config/autoload.php' file; Make MY_Controller.php in APPPATH . 'core/MY_Controller.php' Any controller should extend MY_Controller instead of CI_Controller ; Echo it on page with: <?php echo $this->count_visitor;?> The Helper : <?php defined('BASEPATH') OR exit('No direct script access allowed.

Display number of visitors of google analytics on website

为君一笑 提交于 2019-11-29 12:30:53
问题 A client asked me to display the number of hits/visitors in their website. I would like to know how can you do display this. I would insert it in my footer as displayed: If not possible with google analytics, do you know of a snippet which will work? I've checked websites which offer their services but they recollect information and I would like to learn to do it myself or with google analytics. My files are PHP so maybe there is something I can do with that? 回答1: You can use google anlaytics