Skip to content

Instantly share code, notes, and snippets.

@kandros kandros/gatsby-ssr.js
Last active May 5, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.