All Collections
Website
Theming
Template updates
Update your theme for consent forms
Update your theme for consent forms

We've made it easier to clearly place your consent opt-ins on a page.

Updated over a week ago

Table of Contents

Turn on consent forms for pages

To get started, you must first have advanced privacy turned on and must have already created and published a consent form. Consent forms can only be added to action based pages, as there is no default submit button.

Before you can add a consent form to a page, you have to enable "Ask for Consent" by going to Site settings > Basic.

Click the checkbox next to "Ask for consent" and select the consent form that you'd like to make your default. Click Save site. This allows you to easily set a default form for your whole site, so once you add the code below to a page template, the default form will show automatically.

📌 Note: If you are using a public theme and have not modified any page templates or page type templates, consent forms will appear on pages automatically. If you have a custom theme or have modified any page templates or page type templates. Insert the code below to trigger the from to appear on your pages. 

Add consent form code to your theme 

To trigger the page to display your consent form, you have to add a few lines of code to your page's theme template. Find your website's theme templates. To do so, in the control panel, go to Website and select the site you wish to modify.

1. Click on Theme > Current custom theme > Templates and select the File name of the page type you wish to modify. (You can also just update the "Layout for all pages" template.)

There are two template files for each page, the top one, e.g. pages_show_endorsement.html, is for pages utilizing a sidebar, the bottom, e.g. pages_show_endorsement_wide.html, is for a page without a sidebar. 

2. You will land on a page similar to this where you will add the following lines of code. They must be added within the form code of the page type in order for the consent responses to be stored. So, depending on your page type, locate {% form_for XX %} and {% endform_for %}, your code snippet can be placed anywhere between these lines. 

For example, as you can see above, in a signup page the consent code must be added below {% form_for signup %} and above {% endform_for %}. 

  {% if page.show_consent_form? %}
    {% include "consent_form" %}
  {% endif %}

When you are finished, click Save and publish changes

You can click Live or Preview to see what the form will look like on your page.

Related HOWTOs

Did this answer your question?