Exclude own referring domains from stats #51

Closed
opened 2026-07-16 11:03:06 +02:00 by alex · 0 comments
Owner
# app/controllers/dashboard_controller.rb
# Top 10 referring domains
@top_referring_domains = Ahoy::Visit.where.not(referring_domain:
                                               [ nil, "localhost" ])
                                    .where.not("referring_domain LIKE ?",
                                               "%" + ENV["RAILS_APP"] + "%") 
                                    .group(:referring_domain)
                                    .count.sort_by { |domain, count| -count }
                                    .first(10).to_h
@top_referring_domain_all_counter = Ahoy::Visit.where.not(referring_domain: nil)
                                               .where.not("referring_domain LIKE ?",
                                                 "%" + ENV["RAILS_APP"] + "%") 
                                               .count
```ruby # app/controllers/dashboard_controller.rb # Top 10 referring domains @top_referring_domains = Ahoy::Visit.where.not(referring_domain: [ nil, "localhost" ]) .where.not("referring_domain LIKE ?", "%" + ENV["RAILS_APP"] + "%") .group(:referring_domain) .count.sort_by { |domain, count| -count } .first(10).to_h @top_referring_domain_all_counter = Ahoy::Visit.where.not(referring_domain: nil) .where.not("referring_domain LIKE ?", "%" + ENV["RAILS_APP"] + "%") .count ```
alex added this to the release/20260717 milestone 2026-07-16 11:03:06 +02:00
alex self-assigned this 2026-07-16 11:03:06 +02:00
alex closed this issue 2026-07-17 18:48:44 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
as-consult/starterkit-8#51
No description provided.