0

When creating a questionnaire as an R Shiny app (hosted on shiny servers), what are the possible strategies to avoid or limit users from answering multiple times?

For instance, one strategy would be to ask for an email address and validate this field. However, a fake email address could be added, or a user could have multiple email addresses.

I know there is no perfect solution, but a mix of existing strategies could help. What are the most useful strategies?

Raphus
  • 57
  • 7

1 Answers1

2

Solution 1: Use the user IP address

Which you can get with session$request$REMOTE_ADDR (for details see also this question at SO). Disadvantage: of course, users can hide their address behind a proxy. And many users do not have unique IPs to begin with.

Solution 2: Use all the settings from session$clientData to create a user profile that goes beyond just the IP. But you can switch browsers. You can switch to different devices, etc.

Solution 3: Set a cookie. See this SO question (which only looks at session cookies though). Disadvantages: you have to ask users to permit cookies and they can always delete them.

Solution 4: the best solution I can think of is a 3rd party tracking tool like Google analytics or Mamoto. Such tools provide a user id. You can find more about this in the Shiny articles.

Such tools provide snippets of Javascript code that you need to include in the HTML head:

ui <- fluidPage(
    tags$head(tags$script(HTML(
     // Copy and paste from 3rd party tool
    ))),
    ...  
)
Jan
  • 4,974
  • 3
  • 26
  • 43