Open Tracked/Integrations/Connect your website to Mailchimp using Google tag manager server container

Connect your website to Mailchimp using Google tag manager server container

A server container can add subscribers to Mailchimp when they sign up, without exposing your API key in the browser.

4 min read · Updated October 26, 2026

In this guide
Key takeaways
  • Send the sign-up to Mailchimp from the server, so the API key is never in the browser.
  • Use the subscriber hash (MD5 of the lower-case e-mail) and set the status according to your consent rules.
  • Test with a new e-mail and check the audience in Mailchimp.
SSign-up eventServer containerMailchimp Marketing API

Most sign-up forms talk directly to Mailchimp's hosted forms or to a plugin. If your form is custom, or you want a sign-up on your site to feed Mailchimp, your ad platforms and your CRM at once, a server container is a neat place for it. This page explains the API call, the details that cause errors and the consent points. Check Mailchimp's Marketing API documentation for the current endpoints. See first-party data and customer data collection.

What you need

ItemWhere from
API keyMailchimp account, Extras, API keys
Data centre prefixThe part after the dash in the key, such as us21
Audience (list) IDAudience settings, Audience name and defaults
The sign-up eventYour site pushes sign_up with the e-mail and the consent flag
Works worldwide

Runs on your domain, anywhere

Your tracking runs on your own domain, so a visit from any country is handled the same way.

The API call

To add or update a subscriber, send a PUT request to the audience's members endpoint using the subscriber hash, which is the MD5 of the lower-case e-mail address. PUT creates or updates, so repeated sign-ups do not fail.

PUT https://us21.api.mailchimp.com/3.0/lists/{LIST_ID}/members/{MD5_OF_LOWERCASE_EMAIL}
Authorization: Bearer {API_KEY}
{
  "email_address": "[email protected]",
  "status_if_new": "subscribed",
  "merge_fields": { "FNAME": "Jane" },
  "tags": ["website"]
}

In the server container

1

Receive the sign-up event

The web container sends sign_up with the e-mail to your tagging subdomain.

2

Check consent

Only continue if the visitor agreed to marketing e-mail.

3

Compute the hash

Use a variable that makes an MD5 of the lower-case e-mail, or a template that does it.

4

Send the request

Use an HTTP request tag or a Mailchimp template, with the API key in a secure variable.

5

Handle errors

Log the response. A 400 usually means an invalid or already-unsubscribed address.

Check your setup

Check your tracking in one pass

This is an example. Run the check on your own site to see where yours stands.

  • Use status_if_new of pending for double opt-in, so Mailchimp sends a confirmation e-mail first. Use subscribed only where single opt-in is valid for you.
  • Never re-subscribe someone who unsubscribed. Mailchimp will refuse, and you should not try.
  • Record the consent source and date, in a merge field or tag.
  • Keep marketing consent separate from tracking consent.

Common problems

SymptomError 401
Likely causeThe key or data centre prefix is wrong.
FixCheck both.
SymptomError 400, "Member Exists" or "Forgotten Email"
Likely causeThe address is already in the audience or was deleted permanently.
FixUse PUT for updates, and respect the forgotten status.
SymptomHash does not match
Likely causeThe e-mail was not lower-cased or trimmed.
FixNormalise first.
SymptomSign-ups without consent
Likely causeThe consent flag is not checked.
FixAdd a trigger condition.

Why do it from the server

The API key stays secret, you can add the subscriber and send the sign-up to Meta and Google in the same container, and you keep the consent logic in one place. With Open Tracked, the Enricher can also remember the hashed e-mail so later events from the same browser reach the ad platforms with a good match. See the Enricher.

0 of 6 done

A realistic example

A small publisher has a newsletter sign-up box on every article. It used to send sign-ups straight to Mailchimp from the browser, so its API key sat in a script anyone could read, and the sign-up never reached its ad platforms. It moves the call to its server container. The container checks the consent box, adds the subscriber with double opt-in and a source tag, and sends a sign-up event to Meta and Google with the hashed e-mail. A month later the list has grown by about the same amount, the API key is safe, and the ad platforms can build audiences from people who joined. One small change gave the team security, consistency and a better audience seed in a single step.

Live view

Watch events arrive, live

A sample feed. In Open Tracked you see the same stream for your own store.

Frequently asked questions

Can I add Mailchimp subscribers from a server container?

Yes, with an HTTP request to the Marketing API using the subscriber hash.

What is the subscriber hash?

The MD5 hash of the lower-case e-mail address.

How do I use double opt-in?

Set status_if_new to pending so Mailchimp sends a confirmation e-mail.

Where should the API key live?

In a secure variable on the server, never in the browser.

Do I need consent?

Yes, for marketing e-mail. Check it before you send.

Do I need spreadsheets to read my results?

No. Once tracking is live, the Open Tracked analytics shows spend, revenue, ROAS and profit, and you can ask Ari, the built-in AI assistant, questions about your own numbers in plain words. Ari's allowance depends on your analytics plan.

Is Open Tracked different from Open Track or Open Space Track?

No. Open Tracked is the official name of our server-side tracking platform, and the website is opentracked.io. Many people search for it as Open Track, OpenTrack or Open Space Track. All of them lead to the same product: server-side Google Tag Manager hosting, first-party analytics and a CRM pipeline.

Fix your tracking at the source

Open Tracked hosts your server-side Tag Manager, keeps first-party cookies alive and shows what each ad is really worth.

Open Tracked
Written by

The Open Tracked team

We build Open Tracked: server-side tracking hosting, analytics and the tools around them, for stores that spend on ads. Questions about this guide, or an idea for the next one?

Write to us Read the docs

Was this article helpful?

Comments

Loading comments...

Turn better tracking into better marketing performance

Start free