Add rake task to collect admin overview metrics (#13023)
* Add rake task to collect admin overview metrics * Print the Forem Instance domain
This commit is contained in:
parent
0834a7453f
commit
03465e8882
2 changed files with 12 additions and 0 deletions
|
|
@ -6,5 +6,7 @@ module Ahoy
|
|||
|
||||
belongs_to :visit
|
||||
belongs_to :user, optional: true
|
||||
|
||||
scope :overview_link_clicks, -> { where(name: "Overview Link Clicked") }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
10
lib/tasks/metrics.rake
Normal file
10
lib/tasks/metrics.rake
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace :metrics do
|
||||
desc "Collects metrics from Forem instances"
|
||||
task overview: :environment do
|
||||
puts "Admin Overview Link Tracking for #{SiteConfig.app_domain}:"
|
||||
links_by_target = Ahoy::Event.overview_link_clicks.group("properties -> 'target'").count
|
||||
links_by_target.each do |k, v|
|
||||
puts "#{k.delete_prefix(URL.url)}: #{v}"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue