Campaign Manager

Send professional campaign messages to your subscribers.

Templates

Campaign templates are CMS pages in your theme that use the Template component. They are usually designed by a developer, and like any CMS page, they can use other components to generate content.

The page URL must include a :code parameter, which identifies the campaign and subscriber when the message is viewed in a browser.

title = "Default template"
url = "/campaign/message/:code"
description = "Campaign with basic fields"

[campaignTemplate]
==
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>
            Newsletter
        </title>
    </head>
    <body>
        {richeditor name="body" size="huge"}{/richeditor}
    </body>
</html>

The first time you create a campaign, click Create a Default Template to generate a starting template in the current theme.

Template Fields

Templates use the dynamic syntax parser to define form fields. Each field is shown in the campaign editor, where its content can be filled in for each campaign.

Text

Renders a single line editor field for smaller blocks of text.

{text name="websiteName" label="Website Name"}Our wonderful website{/text}

Textarea

Renders a multiple line editor field for larger blocks of text.

{textarea name="websiteDescription" label="Website Description"}This is our vision for things to come{/textarea}

Rich Editor

Renders a WYSIWYG content editor.

{richeditor name="content" label="Main content"}Default text{/richeditor}

Markdown

Renders a Markdown content editor.

{markdown name="content" label="Markdown content"}Default text{/markdown}

File Upload

Renders a file upload field. The output value is the full path to the file.

{fileupload name="logo" label="Logo"}https://placehold.co/100x100{/fileupload}

Repeater

Renders a repeating section with other fields inside.

{repeater name="content_sections" prompt="Add another content section"}
    <h2>
        {text name="title" label="Title"}Title{/text}
    </h2>
    <p>
        {textarea name="content" label="Content"}Content{/textarea}
    </p>
{/repeater}

See the supported tags for the full list of available fields.

Mail Tags

Tags insert subscriber specific values into the message when it is sent. Use them in the template or the campaign content by wrapping the tag name in curly braces, for example {first_name}. The available tags are listed in the campaign editor.

Tag Description
{first_name} The subscriber's first name.
{last_name} The subscriber's last name.
{email} The subscriber's email address.
{unsubscribe_url} The URL for unsubscribing from the list.
{browser_url} The URL for viewing the message in a browser.
{tracking_pixel} An image tag that records when the message is opened.
{tracking_url} The URL of the tracking image.

A tracking pixel is added before the closing </body> tag of every message automatically, so {tracking_pixel} is only needed for templates without a body tag.

Plugins can register their own tags. See Mail Tags.

Dynamic Templates

By default, the template content is the same for every reader. This makes the campaign predictable, since you know exactly what was sent to each subscriber.

To send personalized content to each subscriber, enable the isDynamic property on the component.

[campaignTemplate]
isDynamic = 1

When enabled, the template is rendered once for each subscriber. Components on the page can access the subscriber using the campaignTemplate.subscriber Twig variable, or in PHP with the following.

\Responsiv\Campaign\Components\Template::getDynamicSubscriber();

Note: Dynamic templates increase database storage requirements, since a copy of every email sent to every subscriber is stored.