mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
addd annallitics
This commit is contained in:
parent
294dc519d6
commit
dd5e60afe1
3 changed files with 40 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
|||
"@hackclub/theme": "^0.1.1",
|
||||
"@mdx-js/loader": "^1.5.9",
|
||||
"@next/mdx": "^9.3.5",
|
||||
"@segment/snippet": "^4.9.0",
|
||||
"isomorphic-unfetch": "^3.0.0",
|
||||
"lodash": "^4.17.15",
|
||||
"next": "^9.3.5",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,18 @@
|
|||
import Document, { Html, Head, Main, NextScript } from 'next/document'
|
||||
import * as snippet from '@segment/snippet'
|
||||
import { InitializeColorMode } from 'theme-ui'
|
||||
|
||||
const {
|
||||
ANALYTICS_WRITE_KEY = '35oTlU4UqlhIN8VGYmBxAzyDdfzhcscw',
|
||||
NODE_ENV = 'development'
|
||||
} = process.env
|
||||
|
||||
const renderSnippet = () => {
|
||||
const opts = { apiKey: ANALYTICS_WRITE_KEY, page: true }
|
||||
if (NODE_ENV === 'development') return snippet.max(opts)
|
||||
return snippet.min(opts)
|
||||
}
|
||||
|
||||
export default class extends Document {
|
||||
static async getInitialProps(ctx) {
|
||||
const initialProps = await Document.getInitialProps(ctx)
|
||||
|
|
@ -15,6 +27,7 @@ export default class extends Document {
|
|||
<InitializeColorMode />
|
||||
<Main />
|
||||
<NextScript />
|
||||
<script dangerouslySetInnerHTML={{ __html: renderSnippet() }} />
|
||||
</body>
|
||||
</Html>
|
||||
)
|
||||
|
|
|
|||
26
yarn.lock
26
yarn.lock
|
|
@ -1216,11 +1216,37 @@
|
|||
resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.5.9.tgz#9cf5c3517301daf60f07961ce190f9f92d8da37d"
|
||||
integrity sha512-hty9ftw/RENS+6pEXTy4vi46CO7cDRdhcELxCaklcGTuxeqi9OROJ+oi03RJd2O2V+3wY5geGAdXKlPQCOTE/Q==
|
||||
|
||||
"@ndhoule/each@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@ndhoule/each/-/each-2.0.1.tgz#bbed372a603e0713a3193c706a73ddebc5b426a9"
|
||||
integrity sha1-u+03KmA+BxOjGTxwanPd68W0Jqk=
|
||||
dependencies:
|
||||
"@ndhoule/keys" "^2.0.0"
|
||||
|
||||
"@ndhoule/keys@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@ndhoule/keys/-/keys-2.0.0.tgz#3d64ae677c65a261747bf3a457c62eb292a4e0ce"
|
||||
integrity sha1-PWSuZ3xlomF0e/OkV8YuspKk4M4=
|
||||
|
||||
"@ndhoule/map@^2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@ndhoule/map/-/map-2.0.1.tgz#f5ca0a47424ea67f46e2a6d499b9e9bc886aefa8"
|
||||
integrity sha1-9coKR0JOpn9G4qbUmbnpvIhq76g=
|
||||
dependencies:
|
||||
"@ndhoule/each" "^2.0.1"
|
||||
|
||||
"@next/mdx@^9.3.5":
|
||||
version "9.3.5"
|
||||
resolved "https://registry.yarnpkg.com/@next/mdx/-/mdx-9.3.5.tgz#9343b77c5b92da7bdaa022969977562cd523df6a"
|
||||
integrity sha512-LYzwx+oZ9iPHPzAvf2RPsPpmulmVMdmZ0IrB/eRWTC+RrW6wD0QHEYuS68qm5TWkwi9bLpNru3GANxX6Cniq2A==
|
||||
|
||||
"@segment/snippet@^4.9.0":
|
||||
version "4.9.0"
|
||||
resolved "https://registry.yarnpkg.com/@segment/snippet/-/snippet-4.9.0.tgz#4c9c5e28a26c249eb8ec89f8e62d5bae6cb7669a"
|
||||
integrity sha512-SiWn5R2uYRoxErd21B50AGuZ+twMjZX34wb2MaUmhG/h+6I63C/PwwawVK6oDzagRxFE/3gEDVtF4Yr9NUGgyA==
|
||||
dependencies:
|
||||
"@ndhoule/map" "^2.0.1"
|
||||
|
||||
"@styled-system/background@^5.1.2":
|
||||
version "5.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@styled-system/background/-/background-5.1.2.tgz#75c63d06b497ab372b70186c0bf608d62847a2ba"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue