Usually, one of the first things I need to do with a new Mautic installation is to set up a double opt-in campaign so that people can sign up for a newsletter.
Googling how to do that usually shows up some very old posts about setting up a campaign that starts from a form submission. Whilst that works, one of the most regular questions I get from clients is "Why does it take so long for the user to get the confirmation email after they fill in the form?".
There are many ways to set up an opt-in campaign, and I don't think the usual method of doing this is optimal.
The usual suggested opt-in campaign works like this.
- The user fills in a form.
- A campaign is started from the opt-in form.
- The campaign adds the user to a pending segment.
- It emails them a link to a landing page.
- The user visits the landing page and gets taken out of the pending segment and put into the confirmed segment.
The logic is sound. The problem is that campaigns run from a cron and the recommended spacing of the required crons is 15 minutes. So assuming that the campaign update and campaign trigger crons need to run before the first email will get sent, it could potentially take 20 minutes (If you use the recommended cron settings).
A standard opt-in campaign setup:
Arguably, the first email is the most crucial in the whole campaign. If it doesn't arrive quickly then it may be ignored.
This is why I prefer to use standalone forms and send the confirmation email using a form action and then put the user into a campaign.
Create a landing page on either your website or in Mautic for the confirmation page.
Create a template email that has a link to the confirmation page which will be sent when someone fills in the form.
Create a new standalone form (Not a campaign form or you will not have the right actions available) with an email field and any other fields you want to store.
In the form actions tab, send the previously created email which links to the landing page and add the user to a segment (or tag them accordingly).
Create a new campaign which runs from the segment you just put the user into, or a segment which includes a filter that includes the tag you just tagged the user with.
The form actions:
I always add a 'remove from do not contact' action in case someone tries to opt-in to something but they had previously been marked as do not contact for any reason (Or they wouldn't get the emails they are now signing up for). I then add them to the pending segment and send the confirmation email.
The benefit of doing it this way is that form actions run as soon as the form is submitted and doesn't need to wait for a cron before anything happens.
The campaign then starts from the segment that you put the user into in the form actions. It uses either a 'visits page' action if you are using a Mautic landing page, or a 'visits url' action if you send them to a page on your main website.
The confirmation email now gets sent instantly and the campaign is simplified to just check for anyone who has been sent the confirmation email visiting the confirmation page.
I understand that this post is a little vague and not a total walkthrough of how to set up an opt-in campaign. It was written with existing users in mind that probably followed the same blog posts I did when setting up my first campaigns and then carried on doing the same thing.
If you would like to see a total walkthrough of how to set up an opt-in campaign in this way, let me know in the comments.