<bdo id='ajotM'></bdo><ul id='ajotM'></ul>
      <legend id='ajotM'><style id='ajotM'><dir id='ajotM'><q id='ajotM'></q></dir></style></legend>
      <tfoot id='ajotM'></tfoot>

      1. <i id='ajotM'><tr id='ajotM'><dt id='ajotM'><q id='ajotM'><span id='ajotM'><b id='ajotM'><form id='ajotM'><ins id='ajotM'></ins><ul id='ajotM'></ul><sub id='ajotM'></sub></form><legend id='ajotM'></legend><bdo id='ajotM'><pre id='ajotM'><center id='ajotM'></center></pre></bdo></b><th id='ajotM'></th></span></q></dt></tr></i><div id='ajotM'><tfoot id='ajotM'></tfoot><dl id='ajotM'><fieldset id='ajotM'></fieldset></dl></div>

        <small id='ajotM'></small><noframes id='ajotM'>

      2. 使用 Google Analytics 在网站上显示实时用户数

        Show live user count on website with Google Analytics(使用 Google Analytics 在网站上显示实时用户数)

        <small id='GD7v1'></small><noframes id='GD7v1'>

          <tfoot id='GD7v1'></tfoot>
            <tbody id='GD7v1'></tbody>

            • <bdo id='GD7v1'></bdo><ul id='GD7v1'></ul>
              <i id='GD7v1'><tr id='GD7v1'><dt id='GD7v1'><q id='GD7v1'><span id='GD7v1'><b id='GD7v1'><form id='GD7v1'><ins id='GD7v1'></ins><ul id='GD7v1'></ul><sub id='GD7v1'></sub></form><legend id='GD7v1'></legend><bdo id='GD7v1'><pre id='GD7v1'><center id='GD7v1'></center></pre></bdo></b><th id='GD7v1'></th></span></q></dt></tr></i><div id='GD7v1'><tfoot id='GD7v1'></tfoot><dl id='GD7v1'><fieldset id='GD7v1'></fieldset></dl></div>
                • <legend id='GD7v1'><style id='GD7v1'><dir id='GD7v1'><q id='GD7v1'></q></dir></style></legend>
                  本文介绍了使用 Google Analytics 在网站上显示实时用户数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何通过 Google 分析显示任何页面加载时的在线访问者数量?

                  How can I show the number of visitors online at any page load via Google analytics?

                  例如,当访问者在某处加载页面时,它会显示58 个在线访问者".

                  E.g., when a visitor loads the page somewhere it will say "58 Visitors Online".

                  推荐答案

                  正如 Trott 之前所解释的,分析中没有这样的功能.但是,我给你一个非常非常古老的选择.我是在 2004 年写的,所以它已经过时了,但基本上有效.此外,它在不使用任何数据库的情况下工作......有时你需要像这样的复古解决方案:)

                  As Trott explained before, there is no such function in analytics. However, I give you a very very old alternative. I wrote this in 2004, so its outdated, but basically works. Also, it works without using any databases.. sometimes you need retro-solutions like this :)

                  现场演示:kopli.pri.ee/stackoverflow/6976362.php

                  (您需要为当前文件夹设置 777 chmod,以便自动创建 users.dat)

                  <?php
                  $current_users_file = 'users.txt';
                  if (!file_exists($current_users_file)) fclose(fopen($current_users_file, "w"));
                  $users = file($current_users_file);
                  $found = false;
                  $user_count = count($users);
                  $fp = fopen($current_users_file, "w");
                  foreach($users as $user) {
                      $user = explode("|", $user);
                      if ($user[1]+300 < time()) {
                          $user_count--;
                          continue;
                      } elseif ($user[0] == $REMOTE_ADDR) {
                          $user[1] = time();
                          $found = true;
                      }
                      $user = trim(implode("|", $user))."
                  ";
                      fputs($fp, $user);
                  }
                  if (!$found) {
                      fputs($fp, $REMOTE_ADDR."|".time()."
                  ");
                      $user_count++;
                  }
                  fclose($fp);
                  echo 'Active users <b>' . $user_count . '</b>';
                  ?>
                  

                  这篇关于使用 Google Analytics 在网站上显示实时用户数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='t1h0Z'></tbody>

                  <small id='t1h0Z'></small><noframes id='t1h0Z'>

                  <legend id='t1h0Z'><style id='t1h0Z'><dir id='t1h0Z'><q id='t1h0Z'></q></dir></style></legend>

                        <bdo id='t1h0Z'></bdo><ul id='t1h0Z'></ul>

                            <tfoot id='t1h0Z'></tfoot>
                            <i id='t1h0Z'><tr id='t1h0Z'><dt id='t1h0Z'><q id='t1h0Z'><span id='t1h0Z'><b id='t1h0Z'><form id='t1h0Z'><ins id='t1h0Z'></ins><ul id='t1h0Z'></ul><sub id='t1h0Z'></sub></form><legend id='t1h0Z'></legend><bdo id='t1h0Z'><pre id='t1h0Z'><center id='t1h0Z'></center></pre></bdo></b><th id='t1h0Z'></th></span></q></dt></tr></i><div id='t1h0Z'><tfoot id='t1h0Z'></tfoot><dl id='t1h0Z'><fieldset id='t1h0Z'></fieldset></dl></div>