Skip to content

Commit 3b50aa6

Browse files
Bumps to 5.0.0 (adds MC Group support)
1 parent 69c42ec commit 3b50aa6

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

HISTORY.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
## Version History
3+
4+
**5.0.0**
5+
Adds support for Mailchimp Groups. See README.md for more details on how to implement.
6+
7+
**4.0.0**
8+
Gatsby v2 is now default. See README.md for upgrade details.
9+
10+
**3.0.0**
11+
- uses `gatsby-node` and [Webpack DefinePlugin](https://webpack.js.org/plugins/define-plugin/) to extract your Mailchimp API key during _compile time only_, set it to global, then use it to make the http request. Previously, we were importing your entire `gatsby-config` file
12+
13+
**2.0.0**
14+
- return a promise, not string, from an error'd http request
15+
16+
17+
## To do
18+
- ensure MC endpoint is valid
19+
- create basic MC field form (name, email, submit button)
20+
- spec

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,28 @@ addToMailchimp('email@example.com', {
140140
## Mailchimp Groups
141141
Mailchimp offers the concept of list groups. It's a bit tricky to implement here because you _must_ use the exact key and value as defined in your MC Embedded Form for those fields.
142142

143-
To add these you must go back to your "Embedded Forms" (where you got your endpoint from) and find the form field that represents the group you want to add this user to. Next, copy the name value and use that as your key in the `addToMailchimp` field param. The name field will have weird values like `group[21265][2]` or `group[21269]`.
143+
To add these you must go back to your "Embedded Forms" (where you got your endpoint from) and find the form field that represents the group you want to add this user to. Next, copy the name and use that as your key in the `addToMailchimp` field param. The name field will have weird values like `group[21265][2]` or `group[21269]`.
144+
145+
Similarly, the `input` field `value` must also be the same as you see. This means you must either set the name and value fields manually in your form or keep a mapping in your JS file.
146+
147+
Why do we need to use these weird structure for name and value field? Because this is what Mailchimp expects. 🤷🏽‍♂️
144148

145149
For example, here is a screenshot of what this looks like:
146150

147151
![screenshot of Mailchimp Groups](https://raw.githubusercontent.com/benjaminhoffman/gatsby-plugin-mailchimp/master/img/mc_groups.png)
148152

149153
And the code would be:
150-
```javascript
154+
```
155+
# HTML
156+
/*
157+
Here we chose to name the input field the same as what's in
158+
our embedded form. But you can name it whatever you want and keep
159+
a field name map in your JS. Mailchimp expects the name and value
160+
to match what's in its Embedded Form
161+
*/
162+
<input value="2" name="group[21265][2]">
163+
164+
# JS
151165
addToMailchimp('email@example.com', {
152166
PATHNAME: '/blog-post-1',
153167
FNAME: 'Ben',
@@ -183,18 +197,3 @@ Also, here are some helpful links:
183197
To setup or modify Mailchimp list fields, navigate to your MC list, click "Settings", then click "List fields". Then add, remove, or edit fields as you wish. Make sure to update your `addToMailchimp` listFields object after youʼve made changes in Mailchimp.
184198

185199
![screenshot of Mailchimp list fields settings screen](https://raw.githubusercontent.com/benjaminhoffman/gatsby-plugin-mailchimp/master/img/mailchimp_list_fields.png)
186-
187-
188-
## Version History
189-
**3.0.0**
190-
- uses `gatsby-node` and [Webpack DefinePlugin](https://webpack.js.org/plugins/define-plugin/) to extract your Mailchimp API key during _compile time only_, set it to global, then use it to make the http request. Previously, we were importing your entire `gatsby-config` file
191-
192-
**2.0.0**
193-
- return a promise, not string, from an error'd http request
194-
195-
196-
## To do
197-
- ensure MC endpoint is valid
198-
- create basic MC field form (name, email, submit button)
199-
- spec
200-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gatsby-plugin-mailchimp",
3-
"version": "4.1.0",
3+
"version": "5.0.0",
44
"description": "A simple, lightweight Gatsby plugin to subscribe email addresses to your Mailchimp list",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)