diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 722e30cd3f..a0fe425141 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -90,6 +90,10 @@ module Hbc install_artifacts enable_accessibility_access + unless @cask.tap&.private? + ::Utils::Analytics.report_event("cask_install", @cask.token) + end + puts summary end diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 43d9d31bc2..13571da01e 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -22,18 +22,22 @@ module Homebrew HOMEBREW_REPOSITORY.cd do analytics_message_displayed = Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsmessage").chuzzle + cask_analytics_message_displayed = + Utils.popen_read("git", "config", "--local", "--get", "homebrew.caskanalyticsmessage").chuzzle analytics_disabled = Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsdisabled").chuzzle if analytics_message_displayed != "true" && + cask_analytics_message_displayed != "true" && analytics_disabled != "true" && !ENV["HOMEBREW_NO_ANALYTICS"] && !ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"] + ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" # Use the shell's audible bell. print "\a" # Use an extra newline and bold to avoid this being missed. - ohai "Homebrew has enabled anonymous aggregate user behaviour analytics." + ohai "Homebrew has enabled anonymous aggregate formulae and cask analytics." puts <<~EOS #{Tty.bold}Read the analytics documentation (and how to opt-out) here: #{Formatter.url("https://docs.brew.sh/Analytics")}#{Tty.reset} @@ -43,6 +47,7 @@ module Homebrew # Consider the message possibly missed if not a TTY. if $stdout.tty? safe_system "git", "config", "--local", "--replace-all", "homebrew.analyticsmessage", "true" + safe_system "git", "config", "--local", "--replace-all", "homebrew.caskanalyticsmessage", "true" end end diff --git a/docs/Analytics.md b/docs/Analytics.md index 12ded5bc31..b989d30b85 100644 --- a/docs/Analytics.md +++ b/docs/Analytics.md @@ -25,7 +25,9 @@ Homebrew's analytics record some shared information for every event: Homebrew's analytics records the following different events: -- an `event` hit type with the `install` event category and the Homebrew formula from a non-private GitHub tap you have requested to install plus any used options, e.g. `wget --with-pcre` as the action and an event label e.g. `macOS 10.12, non-/usr/local, CI` to indicate the OS version, non-standard installation location and invocation as part of CI. This allows us to identify the formulae that need fixing and where more easily. +- an `event` hit type with the `install` event category and the Homebrew formula from a non-private GitHub tap you install plus any used options, e.g. `wget --with-pcre` as the action and an event label e.g. `macOS 10.12, non-/usr/local, CI` to indicate the OS version, non-standard installation location and invocation as part of CI. This allows us to identify the formulae that need fixing and where more easily. +- an `event` hit type with the `install_on_request` event category and the Homebrew formula from a non-private GitHub tap you have requested to install (e.g. explicitly named it with a `brew install`) plus options and an event label as above. This allows us to differentiate the formulae that users intend to install from those pulled in as dependencies. +- an `event` hit type with the `cask_install` event category and the Homebrew cask from a non-private GitHub tap you install as the action and an event label as above. This allows us to identify the casks that need fixing and where more easily. - an `event` hit type with the `BuildError` event category and the Homebrew formula that failed to install, e.g. `wget` as the action and an event label e.g. `macOS 10.12` You can also view all the information that is sent by Homebrew's analytics by setting `HOMEBREW_ANALYTICS_DEBUG=1` in your environment. Please note this will also stop any analytics from being sent.