Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have made a little patch. It creates the feature to exclude search engines and other bots from statistics.
Comment | File | Size | Author |
---|---|---|---|
#20 | interdiff-2433955-16-20.txt | 591 bytes | ricovandevin |
#20 | drupal-exclude-bots-in-statistics-2433955-20-D8.patch | 4.24 KB | ricovandevin |
Comments
Comment #1
mgiffordNice. To get it in Core we'd have to bring it into D8 first so the functionality could be backported.
Comment #2
timmillwoodGreat thought (and patch) but as @mgifford says, this needs to be against the 8.0.x branch and not against 7.34.
Comment #3
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedComment #4
mgiffordComment #6
mallezieComment #11
Wim LeersIronically, we also have #2883776: /core/modules/statistics/statistics.php These pages use this blocked resource. If Googlebot can't access important resources on your page, the page might be indexed incorrectly..
Which is true? What's the behavior we want?
Comment #12
ricovandevin CreditAttribution: ricovandevin at Finlet for One Shoe commentedI guess the desired behavior is that the resource (/core/modules/statistics/statistics.php) is available to crawlers but it should not record the view.
Comment #13
ricovandevin CreditAttribution: ricovandevin at Finlet commentedA first patch that applies against 8.6.x-dev.
Comment #15
timmillwoodI'd fear that this could make the already slow statistics.php even slower.
Comment #16
ricovandevin CreditAttribution: ricovandevin at Finlet commentedIt will undoubtedly make the script slower. If anyone has better ideas I'd be happy to turn those ideas into patches. For now let us work on fixing the issue.
Fixed the issue that the request is not pushed onto the request stack.
Comment #17
ricovandevin CreditAttribution: ricovandevin at Finlet commentedForgot to change the issue status. :-$
Comment #19
timmillwoodI wonder if there's anything we can do at the JS level?
Failing tests are related to there not being a schema to match the new config settings, quite a simple fix.
Comment #20
ricovandevin CreditAttribution: ricovandevin at Finlet for One Shoe commentedFixed schema.
Comment #21
Wim LeersThanks for working on this!
When #2502313: Installing the Statistics module doesn't do anything, one must also know about some pretty mysterious setting and enable it lands, we won't have any configuration left. This would bring back configuration. I'm also not convinced. Furthermore, that list of bots would need to be updated continuously. That's not workable.
Comment #22
ricovandevin CreditAttribution: ricovandevin at Finlet for One Shoe commentedI guess we can safely assume that nobody wants to have bots polluting the statistics. So we can leave out configuration to enable the blocking of bots.
I think that is a good point. But do we have another mechanism for recognizing bots except for inspecting the User-Agent header?
Comment #32
quietone CreditAttribution: quietone at PreviousNext commentedStatistics is approved for removal. See #3266457: [Policy] Deprecate Statistics module in D10 and move to contrib in D11
This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
It will be moved to a contributed Statistics project once the project is created and the Drupal 11 branch is open.