> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Add Mailchimp to Catalyst

> Add the Mailchimp app's tracking and pop-up script to a Catalyst storefront with the Next.js Script component.

This guide shows you how to add the script from the [Mailchimp app](https://www.bigcommerce.com/apps/mailchimp/) to your Catalyst storefront, so that Mailchimp features such as pop-up forms and tracking work on every page. To collect newsletter signups only, use Catalyst's built-in newsletter subscription form instead. It was added in [Catalyst 1.4](/developer/docs/storefront/catalyst/release-notes/1-4-0) and subscribes shoppers through the GraphQL Storefront API.

## Prerequisites

* The Mailchimp app installed on your BigCommerce store, and the script URL Mailchimp provides, as described in the [Install scripts section of the Mailchimp docs](https://mailchimp.com/help/connect-or-disconnect-mailchimp-for-bigcommerce/#heading+install+scripts).
* A Catalyst project running locally. See [Getting Started](/developer/docs/storefront/catalyst/getting-started).

> **Warning**
>
> Scripts added with the Next.js `<Script>` component load without waiting for cookie consent, and the Mailchimp script can set cookies as soon as it loads. To defer it until the shopper consents, add it with Script Manager instead. See [Add scripts with Script Manager](/developer/docs/storefront/catalyst/guides/manually-installing-scripts#add-scripts-with-script-manager).

## Add the script to the default layout

The script needs to load on every page, so add it to the default layout, which all pages share:

**`app/[locale]/(default)/layout.tsx`**

```tsx {1,25-28} title="app/[locale]/(default)/layout.tsx" showLineNumbers={false}
import Script from 'next/script';
import { setRequestLocale } from 'next-intl/server';
import { PropsWithChildren } from 'react';

import { Footer } from '~/components/footer';
import { Header } from '~/components/header';

interface Props extends PropsWithChildren {
  params: Promise<{ locale: string }>;
}

export default async function DefaultLayout({ params, children }: Props) {
  const { locale } = await params;

  setRequestLocale(locale);

  return (
    <>
      <Header />

      <main>{children}</main>

      <Footer />

      <Script
        src="https://chimpstatic.com/mcjs-connected/js/users/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.js"
        strategy="lazyOnload"
      />
    </>
  );
}

```

The `lazyOnload` strategy delays loading the script until the browser has processed the critical interactive elements and scripts.

## Check that the script loads

If you have active Mailchimp pop-ups, load your site to confirm the script works. The following shows an email signup pop-up offering a discount:

![Mailchimp popup loading within Catalyst via script](/_fern-files/bigcommerce.docs.buildwithfern.com/dfb45ea869426a433c3aadd4487b59bb9a7c25ee7fd12dc34ae0948e9e655077/assets/storefront/catalyst/mailchimp-catalyst-loading.gif)

If you don't see a pop-up, you might not have one configured. To confirm the script loaded, check your browser's local storage for `mcform` keys under **Application > Local storage**:

![Mailchimp localstorage values](/_fern-files/_img/0dcdb6051330e26e6c5fca9e9b910561282df6292c04d37938733ad4342040fd.webp)

Because the script is in the shared default layout, navigating between pages doesn't re-render the widget. The script loads once per session instead of on every page:

![Mailchimp navigation experience](/_fern-files/bigcommerce.docs.buildwithfern.com/f5e6145ca1b1e1eb1da92c78ea47edfe417e3bf4db91d99fc96a8156ba9c2335/assets/storefront/catalyst/mailchimp-catalyst-navigating.gif)

## Next steps

* Manage the script from the control panel, with consent handling, using [Script Manager](/developer/docs/storefront/catalyst/guides/manually-installing-scripts#add-scripts-with-script-manager).
* See the [Next.js `<Script>` documentation](https://nextjs.org/docs/app/api-reference/components/script) for other loading strategies.