Campaign Manager
Send professional campaign messages to your subscribers.
Signup Component
The campaignSignup component displays a form that adds a person to a mailing list.
| Property | Description |
|---|---|
| list | The list code to subscribe the person to, for example followers. |
| confirm | When enabled, subscribers must confirm their email address before they receive campaigns. |
| metaData | When enabled, the form can capture extra meta data. |
| templatePage | The campaign template page used to generate the confirmation link, when confirmation is required. |
Basic Usage
The component renders a default form, or you can provide your own markup. The onSignup handler accepts an email and optional first_name and last_name values.
title = "Newsletter"
url = "/newsletter"
[campaignSignup]
list = "followers"
confirm = 0
==
<div id="signupContainer">
<form
data-request="campaignSignup::onSignup"
data-request-update="{ 'campaignSignup::result': '#signupContainer' }">
<input name="first_name" type="text" placeholder="First Name" />
<input name="last_name" type="text" placeholder="Last Name" />
<input name="email" type="email" placeholder="john.smith@example.com" />
<button type="submit">
Subscribe
</button>
</form>
</div>
The result partial displays the outcome using the following page variables.
| Variable | Description |
|---|---|
error |
An error message when the subscription failed. |
isThrottled |
True when the request was throttled. |
requireConfirmation |
True when a confirmation email was sent. |
Confirmation
When confirm is enabled, the subscriber is sent an email with a confirmation link. The link points to the campaign template page selected in templatePage, which handles the verification using the Template component.
[campaignSignup] list = "followers" confirm = 1 templatePage = "campaign/default-template"
The email uses the responsiv.campaign::mail.confirm_subscriber mail template, which can be customized by selecting Mail > Mail Templates from the settings menu.
Throttling
To prevent abuse, the same email address can only be submitted once every 30 minutes, and each IP address can create up to three subscribers every 30 minutes. Throttled requests do not change the subscriber.
Capturing Meta Data
To capture extra information with the subscriber, enable the metaData property.
[campaignSignup] metaData = 1
Then pass the values using a meta[] input array.
<form data-request="campaignSignup::onSignup">
<!-- ... -->
<label>
<input type="radio" name="meta[interest]" value="Sport" />
Sport
</label>
<label>
<input type="radio" name="meta[interest]" value="Games" />
Games
</label>
<label>
<input type="checkbox" name="meta[tell_me_more]" value="Yes" />
Tell me more
</label>
<button type="submit">
Subscribe
</button>
</form>
The captured meta data is shown on the subscriber page in the admin panel. Meta data is also available to custom mail tags using $tagData->subscriber->meta_data.
Next: Subscriptions