Skip to contents

Capture whitepaper download events for lead tracking and analytics. Each download is logged with user type classification to segment investors from artists and other interested parties. Call this function from web download handlers or Shiny apps whenever a user downloads the whitepaper. Allows duplicate downloads to track repeat engagement.

Usage

log_whitepaper_download(
  email,
  user_type = "other",
  user_id = NULL,
  ip_address = NULL,
  user_agent = NULL,
  cn = NULL
)

Arguments

email

Character string. Email address of the downloader. Validated using is_valid_email() before insertion. Used to track engagement history and identify repeat downloaders.

user_type

Character string. Classification of downloader (default: "other"). Must be one of:

  • "investor": Potential investors accessing due diligence materials

  • "artist": Artists interested in joining the platform

  • "other": Press, researchers, general interest

user_id

Character string or NULL. UUID of authenticated user if download occurs while logged in (format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). NULL for anonymous downloads. Used to correlate downloads with user accounts.

ip_address

Character string or NULL. IP address from web request (e.g., request$REMOTE_ADDR in Shiny). Used for geographic analytics and duplicate detection.

user_agent

Character string or NULL. Browser user agent string (e.g., request$HTTP_USER_AGENT in Shiny). Used for device/browser analytics and bot detection.

cn

DBI connection object or NULL. Database connection from artcore::dbc("artsite"). If NULL (default), creates and closes connection automatically. Pass existing connection for batch logging.

Value

Character string. UUID of the created download record (format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). Use this ID for record keeping or linking to other systems.

Examples

if (FALSE) { # \dontrun{
# Log an investor download from web request
download_id <- log_whitepaper_download(
  email = "partner@vc.com",
  user_type = "investor",
  ip_address = request$REMOTE_ADDR,
  user_agent = request$HTTP_USER_AGENT
)

# Log an authenticated user download
download_id <- log_whitepaper_download(
  email = user$email,
  user_type = "artist",
  user_id = user$id
)
} # }