forked from galasa-dev/galasa.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-ssr.js
30 lines (24 loc) · 972 Bytes
/
gatsby-ssr.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
const React = require("react")
const { globalStyle } = require("./src/components/layout/layout.module.scss")
const digitalData = require("./src/utils/digital-data")
if (process.env.GATSBY_GALASA_ENV !== "LOCAL") {
console.log("Non-local build - adding tracking.")
exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }, pluginOptions) => {
const totalComponents = getHeadComponents()
totalComponents.push(<script type="text/javascript" dangerouslySetInnerHTML={{
__html: digitalData
}}></script>)
totalComponents.push(<script src="https://1.www.s81c.com/common/stats/ibm-common.js" type="text/javascript" async></script>)
replaceHeadComponents(totalComponents)
}
} else {
console.log("Local build - no tracking.")
}
exports.onRenderBody = ({ setHtmlAttributes }) => {
setHtmlAttributes({ className: globalStyle })
}