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>
Buy Me A CoffeeDigitalOcean Referral Badge
Loading...
Edward Beazer

Edward Beazer - I just like to build shit. Sometimes I get stuck for hours, even days while trying to figure out how to solve an issue or implement a new feature. Hope my tips and tutorials can save you some time.

DigitalOcean Referral Badge