-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add gtag * chore: add consent button * feat: add consent management link * Update src/theme/Root.js Co-authored-by: Ben Kremer <ben@walletconnect.com> * chore: add longer explanation as to why the termly button is rerendered * chore: update order of termly script * chore: defer gtm --------- Co-authored-by: Ben Kremer <ben@walletconnect.com>
- Loading branch information
Showing
2 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,36 @@ | ||
import React from 'react' | ||
import React, { useEffect } from 'react' | ||
import { DocsSidebarProvider } from '@docusaurus/theme-common/internal' | ||
|
||
export default function Root({ children }) { | ||
return <DocsSidebarProvider>{children}</DocsSidebarProvider> | ||
useEffect(() => { | ||
// Need to replace the consent preferences button after render due | ||
// to the loading order of docusaurus scripts and footer tags. | ||
// The server rendered tags are present before the termly script | ||
// finishes loading. Making the tags not trigger the termly modal. | ||
setTimeout(() => { | ||
const termlyATag = document.createElement('a') | ||
termlyATag.href = '#' | ||
termlyATag.className = 'termly-display-preferences footer__link-item' | ||
termlyATag.innerHTML = 'Consent Preferences' | ||
document.getElementById('termly-display-preferences')?.parentElement.append(termlyATag) | ||
document.getElementById('termly-display-preferences')?.remove() | ||
}, 0) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
<noscript> | ||
<iframe | ||
src="https://www.googletagmanager.com/ns.html?id=GTM-5557TG59" | ||
height="0" | ||
width="0" | ||
style={{ | ||
display: 'none', | ||
visibility: 'hidden' | ||
}} | ||
></iframe> | ||
</noscript> | ||
<DocsSidebarProvider>{children}</DocsSidebarProvider> | ||
</> | ||
) | ||
} |