我正在使用R # 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;
}
}
开源版本。我想计算我的应用程序的用户数。这是我的配置文件:
javac -cp .;algs4.jar JavaFile.java
当我使用我的应用程序并查看日志文件时,没有任何内容告诉我使用我的应用程序的IP /用户。有没有办法获取这些信息?
答案 0 :(得分:4)
您可以使用列出的here添加的javascript附件。它允许您提取IP和由misc信息组成的唯一指纹(散列),如浏览器,显示大小等。对于shinyapps.io中的大多数用户,IP信息不可用,但您应该能够得到粗略计数。请注意,如果相同的人使用不同的浏览器,您将获得不同的哈希值
关键部分正在添加
inputIp("ipid"),
inputUserid("fingerprint")
到侧边栏布局的某个地方。这些是收集所需信息所需的隐藏元素。
之后,他们可以作为
在观察者中加入observe({
fingerprint <- input$fingerprint
ipid <- input$ipid
})
当然,您需要将.js文件复制到www / js文件夹
来源:https://groups.google.com/forum/#!msg/shiny-discuss/EGQhEyoEk3E/ur0mpif11x4J
要获得实际数量,您需要持久文件存储。这在shinyapps.io中不可用,但您可以使用云存储选项(如dropbox)来记录您的用户。有关此问题的教程,请访问http://shiny.rstudio.com/articles/persistent-data-storage.html。每次有人使用我的应用程序时,我个人都会使用rdrop2编辑我的Dropbox中的文件。