diff --git a/gatsby-browser.js b/gatsby-browser.js index 68fcc6cd9..54dca922a 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -41,10 +41,12 @@ const onInitialClientRender = () => { } } - // eslint-disable-next-line no-undef - MktoForms2.whenRendered(function (form) { - destyleMktoForm(form); - }); + if (typeof window !== 'undefined' && window.MktoForms2) { + // eslint-disable-next-line no-undef + MktoForms2.whenRendered(function (form) { + destyleMktoForm(form); + }); + } }; const onRouteUpdate = ({ location }) => {