From 5367f1b408bf3077044bd8f6aab5a8db7647c493 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Jun 2017 16:34:54 +0100 Subject: analytics: remove unused analytics. We didn't end up using the `screenview` and `exception` analytics as much as expected so let's remove them and focus on stuff that's formula-specific. --- Library/Homebrew/utils/analytics.rb | 21 ++++----------- Library/Homebrew/utils/analytics.sh | 53 ------------------------------------- 2 files changed, 5 insertions(+), 69 deletions(-) (limited to 'Library/Homebrew/utils') diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 7dd54d3f1..8c69a2980 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -61,22 +61,11 @@ module Utils ev: value) end - def report_exception(exception, options = {}) - if exception.is_a?(BuildError) && - exception.formula.tap && - exception.formula.tap.installed? && - !exception.formula.tap.private? - report_event("BuildError", exception.formula.full_name) - end - - fatal = options.fetch(:fatal, true) ? "1" : "0" - report(:exception, - exd: exception.class.name, - exf: fatal) - end - - def report_screenview(screen_name) - report(:screenview, cd: screen_name) + def report_build_error(exception) + return unless exception.formula.tap + return unless exception.formula.tap.installed? + return if exception.formula.tap.private? + report_event("BuildError", exception.formula.full_name) end end end diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh index 8d5cf2ff7..00527fd9f 100644 --- a/Library/Homebrew/utils/analytics.sh +++ b/Library/Homebrew/utils/analytics.sh @@ -66,56 +66,3 @@ setup-analytics() { export HOMEBREW_ANALYTICS_ID export HOMEBREW_ANALYTICS_USER_UUID } - -report-analytics-screenview-command() { - [[ -n "$HOMEBREW_NO_ANALYTICS" || -n "$HOMEBREW_NO_ANALYTICS_THIS_RUN" ]] && return - - # Don't report commands that are invoked as part of other commands. - [[ "$HOMEBREW_COMMAND_DEPTH" != 1 ]] && return - - # Don't report non-official commands. - if ! [[ "$HOMEBREW_COMMAND" = "bundle" || - "$HOMEBREW_COMMAND" = "services" || - -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.rb" || - -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" || - -f "$HOMEBREW_LIBRARY/Homebrew/dev-cmd/$HOMEBREW_COMMAND.rb" || - -f "$HOMEBREW_LIBRARY/Homebrew/dev-cmd/$HOMEBREW_COMMAND.sh" ]] - then - return - fi - - # Don't report commands used mostly by our scripts and not users. - case "$HOMEBREW_COMMAND" in - --prefix|analytics|command|commands) - return - ;; - esac - - local args=( - --max-time 3 - --user-agent "$HOMEBREW_USER_AGENT_CURL" - --data v=1 - --data aip=1 - --data t=screenview - --data tid="$HOMEBREW_ANALYTICS_ID" - --data cid="$HOMEBREW_ANALYTICS_USER_UUID" - --data an="$HOMEBREW_PRODUCT" - --data av="$HOMEBREW_VERSION" - --data cd="$HOMEBREW_COMMAND" - ) - - # Send analytics. Don't send or store any personally identifiable information. - # http://docs.brew.sh/Analytics.html - # https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#screenView - # https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters - if [[ -z "$HOMEBREW_ANALYTICS_DEBUG" ]] - then - "$HOMEBREW_CURL" https://www.google-analytics.com/collect \ - "${args[@]}" \ - --silent --output /dev/null &>/dev/null & disown - else - local url="https://www.google-analytics.com/debug/collect" - echo "$HOMEBREW_CURL $url ${args[*]}" - "$HOMEBREW_CURL" "$url" "${args[@]}" - fi -} -- cgit v1.2.3