Skip to content

Commit

Permalink
feat: add apollo integration (#5341)
Browse files Browse the repository at this point in the history
  • Loading branch information
yathomasi authored Jan 20, 2025
1 parent a16780b commit a888be1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gatsby-shared.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GatsbyBrowser, Script } from 'gatsby'

const GATSBY_REO_DEV_CLIENT_ID = process.env.GATSBY_REO_DEV_CLIENT_ID
const GATSBY_APOLLO_IO_APP_ID = process.env.GATSBY_APOLLO_IO_APP_ID

export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({
element
Expand All @@ -13,6 +14,11 @@ export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({
{` !function(){var e,t,n;e="${GATSBY_REO_DEV_CLIENT_ID}",t=function(){Reo.init({clientID:"${GATSBY_REO_DEV_CLIENT_ID}"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.async=!0,n.onload=t,document.head.appendChild(n)}();`}
</Script>
)}
{GATSBY_APOLLO_IO_APP_ID && (
<Script id="apollo-io">
{`function initApollo(){var n=Math.random().toString(36).substring(7),o=document.createElement("script");o.src="https://assets.apollo.io/micro/website-tracker/tracker.iife.js?nocache="+n,o.async=!0,o.defer=!0,o.onload=function(){window.trackingFunctions.onLoad({appId:"${GATSBY_APOLLO_IO_APP_ID}"})},document.head.appendChild(o)}initApollo();`}
</Script>
)}
</>
)
}

0 comments on commit a888be1

Please sign in to comment.