Skip to content

Instantly share code, notes, and snippets.

@kandros
Last active May 5, 2019 10:46
Show Gist options
  • Save kandros/3a2feaea93a1c05495251e728c28b8b1 to your computer and use it in GitHub Desktop.
Save kandros/3a2feaea93a1c05495251e728c28b8b1 to your computer and use it in GitHub Desktop.
add simpleanalytics.com to gatsby
const React = require("react")
exports.onRenderBody = ({ setPostBodyComponents }) => {
if (process.env.NODE_ENV !== `production`) {
return null
}
return setPostBodyComponents([
<script
key="simpleanalytics"
async
defer
src="https://visits.yourdomain.com/app.js"
/>,
<noscript key="simpleanalytics-no-script">
<img src="https://visits.yourdomain.com/image.gif" alt="" />
</noscript>,
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment