In this article we explain how you can hide the opt in field using a URL parameter. This means that when you send supporters to your form from an email, you can set it so that people already opted in don't have to do so again. This should increase the conversion rates on your form by it being a little shorter and simpler for people already subscribed.
You should only use this approach if all of the below apply:
- You have decided that you don't need to give supporters the opportunity to opt out of emails while completing your forms. This is a judgement call that each organisation must make on their own
- You have configured your newsletter field so that not making a selection does not change your subscriptions and specifically does not act as an unsubscribe
How to do it
1. Drag a hidden field onto your form and assign it with a key such as 'activeopt'
We recommend placing this above your opt-in field for consistency.
The 'form key' or system-readable name, is the important part here - the system will be looking for this name to work out what to do.
2. Populate this field using your email URLs
So now you need to fill this, which is surprisingly simple. When putting URLs into your emails, simply add
The system will use this code to populate a field with the form key 'activeopt' with the value 'Yes'. The steps below will set up the conditionals which will hide the opt in field when this is the case.
Here's a simple example URL:
You can of course add more tracking and pre-filling to the same URL, here's an example of a URL with tracking and pre-filling data, note that pre-fill data comes last
The form pre-population are all coloured red. If you don't want to use a longer URL, that's OK, just make sure thatp:activeopt=Yes is included after the #. (Remember to change the node number too, '123' is just an example.)
3. Set-up your form field conditionals
Now you need to tell the form what to do when the field with the form key 'activeopt' is populated with 'Yes'.
To do this you need to use form conditionals. You can access the interface to set up conditionals by clicking 'Webform > Conditionals' when viewing the relevant item as a logged-in user, or by going directly to the interface url as follows:
(Remember to change the node number too, '123' is just an example.)
Here you should set up the conditions as follows, in the below example the newsletter subscription field was also mandatory, so of course you have to make it not-mandatory in the conditionals before hiding it; otherwise people who can't see the field won't be able to successfully submit the form.
Then hit save.
As always make sure you robustly test your links before launching. Check that:
- The fields are still visible by default
- The fields are not disappearing when activeopt contains anything other than 'Yes'
- The correct fields are disappearing when 'activeopt=Yes'
- The form can still be submitted when the newsletter field isn't visible (i.e. it's not mandatory and hidden)
- and make you run the test both as a logged in Impact Stack user, but also logged out (as your supporters will be)
As always if you get stuck, feel free to reach out: firstname.lastname@example.org
- It doesn't matter what value you use for your hidden field, we've suggested 'activeopt' but it will work with any short text string so long as the value in the URL from your email sender matches the key of the field on the form.
- If you want to learn more about conditional form fields and try them out for other purposes, check out this article: Using conditional form fields.
- Remember to consider renewing consent. As a part of GDPR, consent given is not valid forever, remember when planning your communications to consider how and how often you want to renew this consent. If you want to renew consent by getting another active opt-in, you won't want to hide the opt-in field for all opted in people all of the time.