mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
Track Discourse user agent pageviews as crawler
Since 5bfe051e, Discourse user agents are marked as non-crawlers (to avoid accidental blacklisting). This makes sure pageviews for these agents are tracked as crawler hits.
This commit is contained in:
@ -62,7 +62,11 @@ module Middleware
|
||||
@is_crawler ||=
|
||||
begin
|
||||
user_agent = @env[USER_AGENT]
|
||||
CrawlerDetection.crawler?(user_agent) ? :true : :false
|
||||
if CrawlerDetection.crawler?(user_agent)
|
||||
:true
|
||||
else
|
||||
user_agent.downcase.include?("discourse") ? :true : :false
|
||||
end
|
||||
end
|
||||
@is_crawler == :true
|
||||
end
|
||||
|
Reference in New Issue
Block a user