Skip to content

Commit a888be1

Browse files
authored
feat: add apollo integration (#5341)
1 parent a16780b commit a888be1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gatsby-shared.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { GatsbyBrowser, Script } from 'gatsby'
22

33
const GATSBY_REO_DEV_CLIENT_ID = process.env.GATSBY_REO_DEV_CLIENT_ID
4+
const GATSBY_APOLLO_IO_APP_ID = process.env.GATSBY_APOLLO_IO_APP_ID
45

56
export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({
67
element
@@ -13,6 +14,11 @@ export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({
1314
{` !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)}();`}
1415
</Script>
1516
)}
17+
{GATSBY_APOLLO_IO_APP_ID && (
18+
<Script id="apollo-io">
19+
{`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();`}
20+
</Script>
21+
)}
1622
</>
1723
)
1824
}

0 commit comments

Comments
 (0)