2017-01-18 3 views
9

私は、光沢のあるアプリケーションのどの機能が最大限に使用されているかを把握したいと思います。 これを行う方法は何ですか? 現時点で私は光沢のあるサーバaccess.logを解析し、lifecycle_tableというDTオブジェクトがロードされたことを示す .../session/69d4f32b3abc77e71097ae4beefbd135/dataobj/lifecycle_tableのようなリンクを見つけることができます。しかし、私はこれらのオブジェクトのためにこれを見ることができますDT。 良い方法がありますか? 独自のIPごとにこの統計情報を作成したいと考えています。基本的にどのタブがクリックされますか?私は検索文字列などに興味がありません光沢のあるサーバーのログを分析して使用状況に関する統計を作成する

+0

独自のログファイルを作成します。関心のある反応的なコンテキストがアクティブ化されるたびに、関連する情報をログファイルに書き込んで、そのログファイルに関する統計を作成できます。 – nicola

+0

@nicolaタブが選択されているときに、どのように何かをトリガーするには? – drmariod

答えて

4

編集:クリックしたタブについての情報を得るには、?tabsetPanel を参照してください。パネルのIDを指定できます。 したがって、tabsetPanel(id = "tabs"、...)を使用すると、入力$ tabsを使用してサーバー側で選択したタブパネルを追跡できます。私はIPを取得するために約4-5コードスニペットを知っていて、それらはすべてあなたがそれを呼び出す方法JSSやXSSスタイルの使用:IPに関する(https://shiny.rstudio.com/articles/tabsets.htmlに基づく)

library(shiny) 

ui <- shinyUI(pageWithSidebar(

    # Application title 
    headerPanel("Tabsets"), 

    # Sidebar with controls to select the random distribution type 
    # and number of observations to generate. Note the use of the br() 
    # element to introduce extra vertical spacing 
    sidebarPanel(
    radioButtons("dist", "Distribution type:", 
       list("Normal" = "norm", 
         "Uniform" = "unif", 
         "Log-normal" = "lnorm", 
         "Exponential" = "exp")), 
    br(), 

    sliderInput("n", 
       "Number of observations:", 
       value = 500, 
       min = 1, 
       max = 1000) 
), 

    # Show a tabset that includes a plot, summary, and table view 
    # of the generated distribution 
    mainPanel(
    tabsetPanel(id = "tabs", 
       tabPanel("Plot", plotOutput("plot")), 
       tabPanel("Summary", verbatimTextOutput("summary")), 
       tabPanel("Visited Tabs", tableOutput("table")) 
    ) 
) 
)) 


# Define server logic for random distribution application 
server <- shinyServer(function(input, output, session) { 
    global <- reactiveValues(visitedTabs = c()) 

    # Reactive expression to generate the requested distribution. This is 
    # called whenever the inputs change. The renderers defined 
    # below then all use the value computed from this expression 
    data <- reactive({ 
    dist <- switch(input$dist, 
        norm = rnorm, 
        unif = runif, 
        lnorm = rlnorm, 
        exp = rexp, 
        rnorm) 

    dist(input$n) 
    }) 

    observe({ 
    input$tabs 
    isolate({ 
     userTabInfo <- paste0(" selected: ",input$tabs) 
     print(userTabInfo) 
     global$visitedTabs = c(global$visitedTabs, userTabInfo) 
    }) 
    }) 

    # Generate a plot of the data. Also uses the inputs to build the 
    # plot label. Note that the dependencies on both the inputs and 
    # the 'data' reactive expression are both tracked, and all expressions 
    # are called in the sequence implied by the dependency graph 
    output$plot <- renderPlot({ 
    dist <- input$dist 
    n <- input$n 

    hist(data(), 
     main=paste('r', dist, '(', n, ')', sep='')) 
    }) 

    # Generate a summary of the data 
    output$summary <- renderPrint({ 
    str(session$userData) 
    # session$user 
    }) 

    # Generate an HTML table view of the data 
    output$table <- renderTable({ 
    data.frame(global$visitedTabs) 
    }) 
}) 

shinyApp(ui, server) 

以下の例を参照してください。 :)私はそれが何とか可能であるべきだと私は同意するが、人々はすでに3-4年前に尋ねたので、私は本当に輝くチームからの認識の問題を確認していない。とにかくタブの追跡が助けてくれることを願ってあなたが好きなら、IPを再び取得するためにJSスニペットを追加することができます。

+0

Puh、私は入力を追跡するのに興味がありませんでしたが、これは素晴らしい解決策です。とにかく、私が好きではないのはフリージープへの呼び出しです...光沢のあるサーバーは、すでにユーザーのIPを知っています。それ以外の方法はありませんか?あなたはXSSのように少し見える:-)または実際にそれは... – drmariod

+0

HI @drmariod。ああ、私は別の質問に答えることを諦めたと思う、それはもっと面白かった;)とにかく、入力なしのタブだけを追跡するための上記の編集を見てください。 IPについて:私はIPを取得するために約4〜5つのコードスニペットを知っています。彼らはJSSまたはXSSスタイルを使用しています。それはどういうわけか可能ですが、人々は既に3-4年前に尋ねたので、私は輝かしいチームからの本当に意識の問題ではないと思います。とにかくタブの追跡が助けてくれることを願って – BigDataScientist

関連する問題