Skip to content

Commit

Permalink
improve site loading performance
Browse files Browse the repository at this point in the history
- placing datadog script at the end of the head block, and using defer to avoid blocking html rendering
  • Loading branch information
xy-241 committed Jan 20, 2025
1 parent 9553dfb commit 2be05b6
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions quartz/components/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,34 +165,6 @@ export default (() => {

return (
<head>
<script
src="https://notesss.yxy.ninja/script.js"
type="text/javascript">
</script>
<script
dangerouslySetInnerHTML={{
__html: `
window.DD_RUM && window.DD_RUM.init({
clientToken: 'pubf8e87c77bc40109caafef497cae669d9',
applicationId: '1790642d-89c4-45b7-8ba8-b2d58a5212b2',
proxy: 'https://notesss.yxy.ninja',
site: 'datadoghq.com',
service: 'notes.yxy.ninja',
env: 'prod',
// Specify a version number to identify the deployed version of your application in Datadog
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
trackUserInteractions: true,
trackResources: true,
trackLongTasks: true,
defaultPrivacyLevel: 'allow',
usePartitionedCrossSiteSessionCookie: true,
});
`,
}}
/>

{/* <script async src="https://rum.cronitor.io/script.js"></script>
<script
dangerouslySetInnerHTML={{
Expand Down Expand Up @@ -248,6 +220,35 @@ export default (() => {
{js
.filter((resource) => resource.loadTime === "beforeDOMReady")
.map((res) => JSResourceToScriptElement(res, true))}

<script
src="https://notesss.yxy.ninja/script.js"
type="text/javascript"
defer>
</script>
<script
dangerouslySetInnerHTML={{
__html: `
window.DD_RUM && window.DD_RUM.init({
clientToken: 'pubf8e87c77bc40109caafef497cae669d9',
applicationId: '1790642d-89c4-45b7-8ba8-b2d58a5212b2',
proxy: 'https://notesss.yxy.ninja',
site: 'datadoghq.com',
service: 'notes.yxy.ninja',
env: 'prod',
// Specify a version number to identify the deployed version of your application in Datadog
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
trackUserInteractions: true,
trackResources: true,
trackLongTasks: true,
defaultPrivacyLevel: 'allow',
usePartitionedCrossSiteSessionCookie: true,
});
`,
}}
defer/>
</head>
)
}
Expand Down

0 comments on commit 2be05b6

Please sign in to comment.