R Shining server:如何计算我的应用程序的用户数
我使用的是RR Shining server:如何计算我的应用程序的用户数,r,shiny-server,R,Shiny Server,我使用的是RShining server开源版本。我想计算我的应用程序的用户数。这是我的配置文件: # Instruct Shiny Server to run applications as the user "shiny" run_as shiny; # Define a server that listens on port 80 server { listen 80; server_name some_name; # Define a location at the b
Shining server
开源版本。我想计算我的应用程序的用户数。这是我的配置文件:
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Define a server that listens on port 80
server {
listen 80;
server_name some_name;
# Define a location at the base URL
location / {
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server/;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
}
}
当我使用我的应用程序并查看日志文件时,没有任何信息告诉我使用我的应用程序的IP/用户。有没有办法获取此信息?您可以使用列出的javascript加载项。它允许您提取IP和由其他信息(如浏览器、显示大小等)组成的唯一指纹(散列)。对于shinyapps.io中的大多数用户,IP信息不可用,但您应该能够获得粗略的计数。请注意,如果同一个人使用不同的浏览器,您将得到不同的哈希值 关键部分正在增加
inputIp("ipid"),
inputUserid("fingerprint")
到侧栏布局中的某个位置。这些是收集所需信息所需的隐藏元素
在那之后,他们可以在一个观察者中作为
observe({
fingerprint <- input$fingerprint
ipid <- input$ipid
})
观察({
指纹你为什么要在全局环境中定义变量?哦,那是出于个人原因。你不必这么做。我从一开始就得到这些信息,然后在其他函数中使用这些变量。谢谢。我接受了答案,但你不认为那些.js文件对于少量信息来说需要大量工作吗?当然。对我来说,这只是谷歌搜索和粘贴。或者你可以添加谷歌分析,这将是你必须添加到回购协议的简单代码