From 64f2a27a92a971cfd83035989415b4e1d140947c Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Fri, 10 Nov 2023 09:40:38 +0800 Subject: [PATCH] perf: add async and defer mark for inject website script --- src/client/hooks/useInjectWebsiteScript.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/hooks/useInjectWebsiteScript.ts b/src/client/hooks/useInjectWebsiteScript.ts index f57b258..e4f1136 100644 --- a/src/client/hooks/useInjectWebsiteScript.ts +++ b/src/client/hooks/useInjectWebsiteScript.ts @@ -10,6 +10,8 @@ export function useInjectWebsiteScript() { const el = document.createElement('script'); el.src = location.origin + '/tracker.js'; el.setAttribute('data-website-id', String(websiteId)); + el.setAttribute('async', 'async'); + el.setAttribute('defer', 'defer'); document.head.append(el); } );