Skip to content

Conversation

@mekarpeles
Copy link
Member

Addresses step 2 of #11620

This pull request updates the openlibrary/templates/site/head.html template to improve how resources and scripts are loaded, with a particular focus on optimizing the experience for bots versus human users. The main changes ensure that certain external connections and analytics scripts are only included for non-bot users, and clarify some meta tag comments.

Conditional loading for bots:

  • Added conditional logic to only include <link rel="preconnect"> tags for athena.archive.org and apollo.archive.org when the visitor is not a bot.
  • Wrapped the analytics script (loading from apollo.archive.org) so it only runs for non-bot users, reducing unnecessary resource usage for bots.

Meta tag and comment cleanup:

  • Updated comments for Google and Bing site verification meta tags to remove personal references and clarify their purpose.

Copilot AI review requested due to automatic review settings December 24, 2025 15:23
@mekarpeles mekarpeles added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Dec 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements step 2 of #11620 by preventing analytics scripts and preconnect resources from being loaded for bot traffic, which will allow increasing Matomo sampling rates to 100% while reducing unnecessary resource usage.

Key Changes:

  • Added conditional logic to exclude bots from loading preconnect links to athena.archive.org and apollo.archive.org
  • Wrapped Matomo analytics initialization code to only execute for non-bot users
  • Cleaned up meta tag comments to remove personal references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mekarpeles mekarpeles added Patch Deployed This PR has been deployed to production independently, outside of the regular deploy cycle. and removed Patch Deployed This PR has been deployed to production independently, outside of the regular deploy cycle. labels Dec 29, 2025
@mekarpeles mekarpeles added this to the Sprint 2025-12 milestone Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 1 Do this week, receiving emails, time sensitive, . [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants