From 3f47f47ced6ba6d0b318568d009f336853f2c328 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 7 Jul 2024 21:11:14 -0700 Subject: [PATCH] Prevent analytics script delays from blocking other JS on the page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 `` instead, so it isn't taking priority over anything else. --- app/views/layouts/application.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 2dc561f3..ab53ffd2 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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