Prevent analytics script delays from blocking other JS on the page

Oh oops, this is the first script on the page with the `defer`
attribute, which means it needs to run before other scripts with
`defer`—and in this moment, it's not loading for me, which means the
pages aren't working!

I assume Plausible told me to use `defer` rather than `async` because
it expects the page to be ready; okay! Let's just move this to the
very body of the `<head>` instead, so it isn't taking priority over
anything else.
This commit is contained in:
Emi Matchu 2024-07-07 21:11:14 -07:00
parent d79b6b6c33
commit 3f47f47ced

View file

@ -13,7 +13,6 @@
%link{href: image_path('favicon.png'), rel: 'icon'}
= yield :stylesheets
= stylesheet_link_tag "application"
= render 'analytics'
= yield :meta
= open_graph_tags
= csrf_meta_tag
@ -24,6 +23,7 @@
= javascript_include_tag 'application', defer: true
= yield :javascripts
= yield :head
= render 'analytics'
%body{:class => body_class}
#container
= yield :before_title