Consentlane
← Back to guides
J
JAMstack

Gatsby / Static generator

Difficulty: Easy Setup time: 3 min

Plugin gatsby-plugin-html in gatsby-ssr.js using onRenderBody.

01

Add snippet in gatsby-ssr.js

In gatsby-ssr.js (create it if missing):

exports.onRenderBody = ({ setHeadComponents }) => {
  setHeadComponents([
    <script
      key="consentlane"
      async
      src="https://consentlane.com/v1/cl.js?s=YOUR_KEY"
    />,
  ])
}
02

Build and deploy

gatsby build → the snippet will be embedded in every generated HTML page.

Ready to try? The Free plan is enough to start.

Sign up