perf: add async and defer mark for inject website script

This commit is contained in:
moonrailgun 2023-11-10 09:40:38 +08:00
parent b050a56d4a
commit 64f2a27a92

View File

@ -10,6 +10,8 @@ export function useInjectWebsiteScript() {
const el = document.createElement('script'); const el = document.createElement('script');
el.src = location.origin + '/tracker.js'; el.src = location.origin + '/tracker.js';
el.setAttribute('data-website-id', String(websiteId)); el.setAttribute('data-website-id', String(websiteId));
el.setAttribute('async', 'async');
el.setAttribute('defer', 'defer');
document.head.append(el); document.head.append(el);
} }
); );