Gatsby Mailchimp Form
Quick mailchimp form to catch emails in Gatsby
Fri, 28 Apr 2023
This is just a quick example of a script tag to load the Mailchimp script in Gatsby. I’m writing this because I had some issues with getting this to display my pop up form. To get this done I did use react-helmet
npm i react-helmet
Inside of your src/pages/index.js
file add this tag to your JSX. All you need to do is replace the https:// link to the link mailchimp gives you
<Helmet>
<script id="mcjs" type="text/javascript">
{`!function (c,h,i,m,p) {m=c.createElement(h),p=c.getElementsByTagName(h)[0],m.async=1,m.src=i,p.parentNode.insertBefore(m,p)}(document,"script","https://chimpstatic.com/mcjs-connected/js/users/somerandomuserid/somemorerandomjs.js");`}
</script>
</Helmet>