Simple MailChimp Documentation

Installation

Template Tag

Simple MailChimp is designed to be the easiest way to display a MailChimp sign-up form on your website. There is only one tag: {exp:simple_mailchimp}

Contents

Parameters

api_key=""

Your MailChimp API key. Where can I find my API Key?

list_id=""

The ID of the list you would like to subscribe users to. How can I find my List ID?

form_name="simple_mailchimp"

The value to be used in the name attribute on the <form> element.

return=""

The path to the page to display on a successful submission. This value should be similar to that used in the {path=""} tag (i.e. template_group/template).

error_delimiters="|"

The HTML used to wrap form error. Separate the opening and closing tags with a vertical pipe character.

form_class=""

A class, set of classes, to be applied to the <form> element. If left blank, no classes will be applied.

form_id=""

An ID to be applied to the <form> element. If left blank, no ID will be applied.

email_field="EMAIL"

The merge field that contains the users email.

browser_validate="no"

If anything except "yes" the browser validation will be suppressed.

w3c_validate="no"

If "yes" helpful (but invalid) input attributes will be suppressed.

double_optin="yes"

Flag to control whether a double opt-in confirmation message is sent.

Variables

{label:MERGE}

The {label:MERGE} variable displays a label where MERGE is the merge tag for that field (e.g. {label:EMAIL}).

The {label:MERGE} variable accepts a number of parameters as follows:

text=""

The text to be displayed between <label> tags. If left blank the field name specified in MailChimp will be used.

attr:ATTR=""

Where ATTR is any HTML attribute that will be applied to the opening label tag. (e.g. attr:class="form-label" will output <label class="form-label">.)

You can not override the for="" attribute, it will always correspond to the ID of the appropriate {merge:MERGE} variable.

{merge:MERGE}

The {merge:MERGE} variable displays a merge field where MERGE is the MailChimp merge tag for that field (e.g. {merge:EMAIL}).

The {merge:MERGE} variable accepts the attr:ATTR parameters as described above. You can not override the name="", id="" and required attributes.

{error:MERGE}

The {error:MERGE} variable displays an error if a field is not filled out correctly where MERGE is the merge tag for the field.

If an error is displayed it will be wrapped in the delimiters specified in the {exp:mailchimp} opening tag. If the field is filled out correctly nothing is displayed.

{submit}

The {submit} variable displays the submit button for the form.

The {submit} variable accepts for following parameters:

type="input"

This determines whether the outputted tag will be an <input type="submit"> or a <button< element. Any value other than button will output an <input> element.

value="Subscribe"

The text displayed on the button.

attr:ATTR=""

As described above. You can not override the type="" attribute.

Conditionals

{error:MERGE}

The {error:MERGE} conditional variable can be used to create custom error messages.

{success}

The {success} conditional will be either true or false based on whether the form submission is successful. It is set to false if the form hasn‘t been submitted yet.

Example

{exp:simple_mailchimp
api_key="1234567890abcdef1234567890abcdef-us2"
list_id="1234567890"
error_delimiters="<p class='error'>|</p>"}
    {if success}
        <p class="success">Success! Check your email to activate your subscription.</p>
    {if:else}
        <p>
            {label:EMAIL}
            {merge:EMAIL}
            {error:EMAIL}
        </p>
        <p>
            {label:MMERGE1}
            {merge:MMERGE1}
            {if error:MMERGE1}This is a custom error!{/if}
        </p>
        {submit}
    {/if}
{/exp:simple_mailchimp}
Google+