How to segment or tag new newsletter subscribers in Shopify

If you are adding a newsletter subscribe form to a Shopify page and you want the subscribers to be segmented or tagged so that you can filter them in the customer screen, you just need to make a small modification to the newsletter subscribe form.

In Shopify, the newsletter subscribe form creates a new customer in the Customers interface, and you can tag these people when they sign up, and then save a filter to find everyone with these tags. Then, you can use these saved filters to target these particular people with newsletters.

The theme I am working with is the Split theme. The newsletter code is in a snippet in this theme called newsletter-form.liquid.

To add segmentation with tags to this shopify customer, we are going to create a new snippet and modify this code.

First, Create a new snippet called new-newsletter-form and paste the code below (or your own newsletter snippet code) inside it.


{%- form 'customer' -%}
  {{ form.errors | default_errors }}
  {%- if form.posted_successfully? -%}
    <div class="note form-success">{{ 'general.newsletter.confirmation' | t }}</div>
  {% else %}
    <div class="input-group">
{% comment %} The line below is where you can set your customer tags. Use commas to separate and assign multiple tags. {% endcomment %}
      <input type="hidden" name="contact[tags]" value="newsletter, insert-your-tag-here">
      <input type="email" value="{% if customer %}{{ customer.email }}{% endif %}" placeholder="{{ 'general.newsletter.email_label' | t }}" name="contact[email]" id="Email" aria-label="{{ 'general.newsletter.email_label' | t }}" autocorrect="off" autocapitalize="off"><input type="submit" name="commit" id="Subscribe" value="{{ 'general.newsletter.submit' | t }}">
    </div>
{% endif %}
{%- endform -%}

Note the comment within the code indicating the line where you can change the segment tag to use. You can add multiple tags by separating each tag with a comma.

To include this new snippet in your theme, add the following code to the section within the page you want the form to show on:


{%- render 'new-newsletter-form' -%}

Creating the Segment Filter:

  • Make a submission through your form.
  • Login to the backend of Shopify and click on Customers in the side menu.
  • Search for your tag in the filter field, if you were successful then your customer you just submitted should appear
  • Click on the Save Filters button and name your filter.

Now you should be able to sort your customers by your new filter, and choose this segment for email newsletters sent through Shopify.

 

 

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *