One Shopify Email campaign, a routine for every quiz result
Goal: you write one campaign, not three. Everyone who finished “Find your routine” in the last 30 days gets it. Dry-skin shoppers read “Your dry-skin routine, Priya” with the two dry-skin products. Oily-skin shoppers read their routine. Anyone else gets an invitation to take the quiz.
Uses: the customer metafields and the result tag Octane AI writes when Shopify Customers is on for the quiz, with the winning outcome tag on (the default); a customer segment; and a Custom Liquid section in Shopify Email. No code outside the email; no API key. Available on the Plus and Enterprise plans.
Why the tag and not the metafield: Shopify Email’s Liquid includes customer.tags but not customer.metafields (Shopify: custom Liquid in Shopify Email). Segments read the metafields; the email body reads the tag.
Before you start: the quiz’s Storefront panel under Integrations > Shopify Customers prints this quiz’s real metafield keys and its tag prefix. The key q3f9a12cd_completed_at and the tags find-your-routine:... below belong to a fictional store; use yours.
1. The segment
Section titled “1. The segment”Customers, Segments, Create segment:
metafields.octaneai.q3f9a12cd_completed_at >= 30_days_agoA date metafield takes >= 30_days_ago (Shopify: metafield segments). For one result only: customer_tags CONTAINS 'find-your-routine:dry' (Shopify: segment query language).
2. The email
Section titled “2. The email”Marketing, Create campaign, Shopify Email, pick a template, add a Custom Liquid section:
{% if customer.tags contains 'find-your-routine:dry' %} <h2>Your dry-skin routine, {{ customer.first_name | default: 'friend' }}</h2> <p>Skin that feels tight after washing needs a gentle cleanse and a barrier to hold the water in.</p> <img src="https:{{ all_products['cream-cleanser'] | image_url: width: 400 }}" width="200" alt="Cream Cleanser"> <img src="https:{{ all_products['barrier-balm'] | image_url: width: 400 }}" width="200" alt="Barrier Balm"> <p><a href="https://marlow-finch.example/collections/all?filter.p.tag=skin%3Adry">Shop your routine</a></p>{% elsif customer.tags contains 'find-your-routine:oily' %} <h2>Your oily-skin routine, {{ customer.first_name | default: 'friend' }}</h2> <p>Shine by noon? A foaming wash and an oil-free gel keep it balanced.</p> <img src="https:{{ all_products['foam-wash'] | image_url: width: 400 }}" width="200" alt="Foam Wash"> <p><a href="https://marlow-finch.example/collections/all?filter.p.tag=skin%3Aoily">Shop your routine</a></p>{% else %} <h2>Find your routine in two minutes</h2> <p><a href="https://marlow-finch.example/pages/routine-quiz">Take the quiz</a></p>{% endif %}The all_products[...] | image_url pattern is the one on Shopify’s page above. Add one elsif per result; the winning outcome tag is the quiz’s tag prefix followed by the outcome name as a slug (see the tags). Send the campaign to the segment from step 1.
Things to know
Section titled “Things to know”- The tag is the current result: after a retake the tag changes, so a campaign scheduled later follows the latest answer.
- The email cannot print the shopper’s own results link, which lives in a metafield. When an email needs it, start from the “Quiz completed” trigger in Shopify Flow, which carries it as “Results URL”.
- Shopify Email sends to customers subscribed to email marketing only.
- Segments spell a key with dots (
metafields.octaneai.q3f9a12cd_completed_at). Theme Liquid reads the same field with the bracket form,customer.metafields.octaneai['q3f9a12cd_completed_at'].value, because a question’s key can contain-. - To check it, make two test customers with your own addresses, tag one
find-your-routine:dryand the otherfind-your-routine:oily, put both in a segment, send to it, and read both inboxes.
