Getting to know your customers: first party and zero party data, without being creepy
TL;DR
Difficulty: Intermediate
- Build on two kinds of data: orders, which cover every buyer, and what customers tell you on purpose (zero party data).
- Use behaviour data only with consent, keep guesses rare and harmless, and never touch health, beliefs or private life.
- Every use needs its own legal basis. Personalisation is rarely necessary for the contract, so write down the legitimate interests test or ask for consent.
- Ask one question at a time, at the moment it matters, and use the answer visibly. Measure quizzes with a holdout, never by comparing finishers with everyone else.
- Store each preference with its source, basis and expiry date, and tell customers why they see what they see.
What to read first
Every shop wants to show each customer the right thing at the right moment. Most get there by watching people, and customers can feel it. This chapter shows the other way: learning from orders and from what customers tell you on purpose, with the legal basis, the questions and the database design to do it properly.
Knowing your customers is not the same as watching them
Every shop owner wants the same thing from customer data: to show each person the right products, say the right thing at the right moment, and stop wasting money on messages nobody wanted. And every shop owner has felt the other side of it, as a customer. The advert that follows you around for a week. The email that knows something you never told anyone.
So the question for this chapter is a practical one: how does a shop get to know its customers well enough to help them, without being creepy and without breaking the law?
The short answer: build on two kinds of data. What customers do in your shop, which you can see in your own orders and, with permission, in their visits. And what customers tell you on purpose, because you asked a good question at a good moment and gave them something back for the answer. Be very careful with a third kind, the things you guess about people. And leave a fourth kind alone entirely.
The product page chapter covered what a shop must tell the customer. This one turns it round: what the shop may learn about the customer, and how. Two earlier articles set out the strategy. Privacy first growth explains the layers of consent, server side collection and data people give on purpose. Personalisation without surveillance explains why personalisation does not need tracking at all. This chapter does not repeat them. It goes through the practical work in a shop: which legal basis each use needs, how the cookie rules differ, accounts and guests, the ways to ask, what to keep and for how long, and how the record looks in the shop's own database.
A few terms first, so nobody is left behind:
- Personal data is any information about a person who can be identified, directly or indirectly. An email address, an order history and a quiz answer saved to an account all count.
- First party data is what you collect yourself, in your own shop: orders, account details, and (with consent where the law asks for it) what people look at.
- Zero party data is what a customer tells you deliberately so that you will use it: a preference, a room they are furnishing, how often they want emails.
- Third party data is collected by companies with no relationship with the person. It plays no part in this chapter.
This is general information, not legal advice. Where a decision carries real legal risk, a data protection specialist should look at your specific case.
Example: what Shannonside Home already knows on an ordinary Tuesday
Shannonside Home is the invented online homeware shop in Limerick (shannonsidehome.example) that runs through this whole series. Niamh owns it, Callum builds and runs the shop. It sells ceramics, kitchen textiles, lamps and small furniture, about 1,400 products. All figures here are the example's own, invented for teaching.
In a month the shop has 110,000 sessions and converts 1.8% of them, which gives:
So orders a month, at an average order value of €84. The newsletter has 38,000 subscribers. Over the last 24 months 24,000 different people have ordered, and 11,000 of them have an account.
Here is what the shop already holds, before anyone asks a single new question:
| What Shannonside holds | Where it lives | Who it covers |
|---|---|---|
| Every order: products, prices, dates, delivery address | The shop database | All 24,000 customers |
| Account details and saved addresses | The shop database | 11,000 account holders |
| Email engagement (opens, clicks) | The email tool | Subscribers |
| Browsing behaviour | Analytics, only after consent | Visitors who agreed |
| What customers want, in their own words | Nowhere yet | Nobody |
The last row is the gap this chapter fills. Niamh knows that a customer bought a teapot. She does not know whether it was a gift, a replacement, or the first piece of a new kitchen. The customer knows, and would happily say so if asked well.
Four kinds of customer data, and why the difference matters
Customer data comes in four kinds, and the difference is not academic. It decides how useful the data is, how customers feel about you using it, and which legal basis you need.
- Transactional data: what people bought, when, for how much, where it went. Reliable, because money changed hands.
- Observed data: what people did on the way. Pages viewed, searches, items added to the basket, emails clicked.
- Declared data: what people told you, on purpose. This is zero party data.
- Inferred data: what you guessed from the other three. "Probably has a dog." "Probably just moved house."
The term zero party data comes from the research firm Forrester, which described it in 2018 as data "shared explicitly and intentionally by consumers"1, and published a report on it that October2. The idea is older than the name: shopkeepers have always asked "who is it for?". The name is useful because it separates two things that used to be lumped together as first party data: what you watch and what you are told.
How customers feel about each kind has been studied. Tami Kim, Kate Barasz and Leslie John ran a series of experiments on why people see an ad. People judged an information flow as less acceptable when the firm inferred the information than when the person had stated it, and less acceptable when it was gathered outside the website where the ad appeared. Telling people why they saw an ad lowered its effect when the flow was one they found unacceptable, and could raise it when the flow was acceptable and the platform trusted3. An earlier field study by Elizabeth Aguirre and colleagues found the same shape from another angle: personalised adverts did better when the information had been collected openly, and worse when people felt it had been collected covertly4.
That is the whole case for zero party data in two studies. Declared data is not just more accurate. Using it feels fair to the customer, because they handed it over.
Example: four facts about one Shannonside customer
Take one invented customer, Aoife from Ennis, Co. Clare. Here is what the shop holds about her, sorted into the four kinds:
| Fact | Kind | How the shop got it | How it feels to Aoife if used |
|---|---|---|---|
| Bought a stoneware dinner set in March | Transactional | Her order | Expected |
| Looked at oak side tables three times last week | Observed | Analytics, after she accepted cookies | Fine on the site, odd in an email |
| "I'm furnishing a living room" | Declared | One tap answer in her delivery email | Welcome, she asked for it |
| "Probably moved house recently" | Inferred | Guessed from a dinner set plus furniture views | Unsettling if she ever sees it |
The inferred line is the one to notice. It might even be true. But if Shannonside sends Aoife an email headed "Settling into your new home?", she will wonder how the shop knows, and that moment of unease is exactly the reaction the research measured. The same message, sent because she ticked "I've just moved" herself, reads as service.
What a shop should not try to know
Some information is off limits for a homeware shop, even if a customer would type it in.
The GDPR gives special protection to what it calls special category data: racial or ethnic origin, political opinions, religious or philosophical beliefs, trade union membership, genetic and biometric data, data concerning health, and data concerning a person's sex life or sexual orientation5. Processing it is prohibited unless one of a short list of conditions applies, and none of them is "it would help my email campaign". Guessing it is no safer than asking for it: an inference about someone's health is still data about their health.
For a homeware shop the risk is rarely obvious. Nobody plans to ask about religion. The risk hides in innocent looking questions and in clever inferences: a quiz option about mobility, a guess about pregnancy from what someone browses, a festive gift guide that sorts people by faith. The Target pregnancy story is the famous example of an inference that should never have reached a customer, and that article sets out the ethical gates in detail.
Three rules keep a shop clear of trouble:
- Ask about the product, never about the person's body, beliefs or private life.
- Do not build inferences about special category topics, even internally.
- Use the account page test: if you would be embarrassed to show the customer a field on their own account page, do not store it.
Example: the easy grip question Shannonside nearly asked
Callum's first draft of the kitchen quiz had a question: "Do you have difficulty gripping or lifting?", with the idea of recommending lighter mugs and pans with large handles. It is a kind thought. It is also a question about health, and storing the answer against a named account would create health data.
The fix is to ask about the product instead. The final quiz asks: "Which matters most in a mug? Light to lift, large handle, keeps tea hot, dishwasher safe." Anyone can pick "light to lift" or "large handle" for any reason: arthritis, a small child, a preference. The shop stores a product preference, not a condition, and still recommends the right mugs. Nobody is asked to explain themselves, and the data could appear on the account page without anyone blushing.
Every use of customer data needs its own legal basis
Under the GDPR you may only process personal data if one of six lawful bases in Article 6(1) applies5. Four matter for a shop:
- Contract: the processing is necessary to perform a contract with the person, or to take steps they asked for before one. Delivering an order needs the address.
- Legal obligation: the law requires it. Keeping invoices for Revenue is the classic case.
- Legitimate interests: the processing is necessary for a genuine interest of yours, and the person's interests do not override it.
- Consent: the person agreed, freely, specifically, informed and unambiguously, and can withdraw as easily as they gave it.
The basis belongs to the use, not to the data. The same order history is processed on the contract basis when you deliver it, on legal obligation when you keep the invoice, and on a different basis again when you use it to pick recommendations.
That last point catches many shops out. The European Data Protection Board, the body of EU data protection regulators, says plainly that personalisation is usually not necessary for the contract. Its own example is an online marketplace that wants to show personalised product suggestions based on the listings someone viewed: that personalisation is not objectively necessary to provide the marketplace service, so it cannot rely on the contract basis6. The Data Protection Commission (DPC), Ireland's regulator, sits on that board, so this is the line it works to.
Legitimate interests is the basis most shops will reach for. The wording of Article 6(1)(f) contains a three part test, applied in order: a purpose test (is there a legitimate interest?), a necessity test (is the processing necessary for it?) and a balancing test (do the person's interests and rights override it?). All three must be passed before you start using the data. Recital 47 of the GDPR says that direct marketing may be regarded as a legitimate interest, and puts weight on what the person can reasonably expect5. That helps, but it is not a free pass: you still run the full test, and the separate email and cookie rules still apply. Two more rules sit on top. Anyone may object to processing for direct marketing at any time, including profiling for it, and then you must stop. And you must tell people at the point of collection what you will do with their data and on which basis5.
| Shannonside's use | Data | Basis | What it means in practice |
|---|---|---|---|
| Delivering the order | Name, address, phone, items | Contract | No tick box needed, but nothing beyond what delivery needs |
| Keeping invoices | Order and payment records | Legal obligation | Kept for the period tax law requires, then deleted |
| Showing the quiz shortlist right now | The quiz answers | Contract (a step she asked for) | Use at once, no storage needed |
| Saving quiz answers for later visits | The quiz answers | Consent | "Save my answers" is a choice, not a default |
| Recommendations from order history on the site | Past orders | Legitimate interests | Balancing test written down, easy objection |
| Marketing emails | Email address, preferences | Consent or the soft opt in | See the email consent article |
| "Where did you hear about us?" survey | One optional answer | Legitimate interests | Optional, used only in aggregate |
Example: Shannonside's balancing test for recommendations from order history
Niamh wants the homepage to show logged in customers products that go with what they bought before. Here is the three part test as Callum writes it into the shop's records:
- Purpose. Showing customers products that complement their past purchases, so they find what they need faster and the shop sells more. A commercial interest is a legitimate interest.
- Necessity. The recommendation needs the product categories of past orders. It does not need browsing history from other sites, location, age or anything else. So only order lines from the last 24 months are used, and only for logged in account holders.
- Balancing. A customer who keeps an account at a homeware shop reasonably expects it to remember what they bought, the way a good local shop would. The data is not sensitive, nothing leaves the shop, and nothing is inferred beyond "bought a dinner set, show matching serving bowls". The account page has a switch, "Show me suggestions based on my orders", on by default, and the privacy notice explains it.
Result: legitimate interests, with an easy objection. Had Niamh wanted to combine order history with bought in data or social media profiles, the balancing test would have tipped the other way, and the answer would have been consent or nothing.
Cookies and device storage follow their own rules
There are two separate laws at work, and mixing them up is a common mistake in shop privacy notices. Data protection law (the GDPR) governs what you do with personal data. A second law governs the act of storing or reading anything on the visitor's device, whether it is a cookie, local storage or a tracking pixel. In Ireland that is regulation 5 of the ePrivacy Regulations, S.I. No. 336 of 20117.
Regulation 5(3) is short: you need the person's consent, given on the basis of clear and comprehensive information that is prominently displayed and easily accessible. Regulation 5(5) allows only two exceptions: storage needed purely to transmit a communication, and storage strictly necessary for a service the person explicitly asked for, such as a basket, a login or the record of their cookie choices7. The DPC's guidance draws the practical lines. Analytics cookies need consent. A banner with an accept button must give equal prominence to an option to reject or to manage cookies. Pre checked boxes and sliders set to on are not allowed. And you should ask people to reaffirm a stored consent choice no later than six months after you recorded it8. The UK has since added an exception for analytics. Ireland has not.
And consent must be real consent. The Court of Justice of the EU decided in the Planet49 case in 2019 that a pre ticked box is not valid consent to cookies9. The GDPR points the same way: consent needs a clear affirmative act, and silence or inactivity is not one5.
The cookies and consent article sets the UK, Germany and Austria side by side, and the Irish rules sit on the same EU footing, so I do not repeat it here.
What matters for this chapter is the consequence. Whatever your consent rate, behaviour data covers only part of your visitors. Orders and what people tell you cover everyone who buys or answers.
Example: how much of Shannonside's traffic the shop can actually see
Assume 61% of Shannonside's sessions come from visitors who accept analytics cookies on the banner (an invented figure for the example, and a number every shop should measure for itself). The sessions the shop can observe in front end analytics follow from a simple rate (see Foundations: ratios and rates):
where is the number of sessions the shop can observe, is all sessions in the month, and is the share of sessions with analytics consent, written as a decimal.
So sessions a month leave no behavioural trace in analytics. Unlike a shop in the UK, Niamh has no statistics exception to close that gap. The 1,980 orders, on the other hand, are all in the shop database, whatever anyone clicked on the banner. That asymmetry is why this chapter keeps steering towards orders and declared data, and why the tracking series covers the shop database as the source of truth.
Accounts and guest checkout: let people choose
An account is the natural home for what a shop knows about a customer: saved addresses, order history, preferences. It is tempting to make one compulsory. It is a mistake on two counts.
The first is conversion. Baymard Institute's checkout research lists "the site wanted me to create an account" as a reason given by 18% of US online shoppers who abandoned an order, after excluding those who were only browsing10. The checkout chapter goes through the other reasons.
The second is data minimisation. The GDPR says personal data must be adequate, relevant and limited to what is necessary for the purpose5. German regulators have spelled out what that means for shops. In March 2022 the Datenschutzkonferenz, the joint body of Germany's data protection authorities, said online shops must in principle offer a guest checkout alongside any customer account, because a first order does not justify keeping someone's data on file for uncertain future orders. It also said that analysing an account's order history for advertising, and storing payment details, need informed consent11. In 2025 the Hamburg authority reported a court decision accepting an exception for a large marketplace, which had offset the lack of a guest option by automatically deleting accounts left unused for a set period12. None of this binds the DPC or an Irish shop. It is still the clearest statement anywhere of where minimisation leads, and it rests on the same GDPR article that applies in Ireland.
The practical answer is to offer both and let the customer decide after the purchase, when they have a reason to. Solidus, the open source shop framework I build on, already works this way: the email address sits on the order, and the link from an order to a user account is optional.
Example: Shannonside's account offer on the confirmation page
At Shannonside, 55% of orders are placed as a guest. That is:
That is guest orders a month. Instead of asking for a password before payment, Callum adds one line to the order confirmation page: "Save your details for next time? Choose a password and this order appears in your account." The order details are already filled in.
If 30% of guests take the offer:
That is about new accounts a month, each created by a person who chose it after a good experience, and each one a deliberate decision of exactly the kind the German regulators describe. The other 70% stay guests. Their order data is used for the order and the legal records, and nothing extra is added to it.
The ways to ask: a toolkit for declared data
Declared data does not appear on its own. It comes from questions, and a question in a shop is a small piece of design with a cost (friction) and a price (what the customer gets back). The rule that runs through all the tools below: ask one thing, at the moment it is relevant, and use the answer straight away where the customer can see it.
There are five tools worth building, each covered in its own section: quizzes and finders, preference centres, progressive profiling, post purchase questions, and the account page itself.
Quizzes and style finders that give something back
A quiz works when it solves a real problem for the customer. In a catalogue of 1,400 products, "which of these 90 lamps suits my room?" is a real problem. A good finder asks three or four questions and returns a short list. The customer gets a shortlist, and the shop gets the answers.
Two cautions. First, the immediate shortlist uses the answers for a step the customer asked for, so it needs no extra permission. Saving the answers to an account for future visits is a separate use, so offer it as a choice: "Save my answers so the shop remembers my style." Second, measure a quiz properly. The people who finish a quiz are the keenest shoppers on the site, so comparing their conversion rate with everyone else's will always flatter the quiz.
Example: the lamp finder, measured with a holdout
Callum builds a lamp finder with three questions: which room, what kind of light (reading, mood, overall), and a price band. To measure it, the shop splits visitors to the lighting category at random: half are offered the finder (the exposed group), half are not (the holdout, or control group). The method is the subject of the experiments chapter.
After four weeks the naive view looks spectacular. Of 7,000 exposed sessions, 30% start the quiz (2,100) and 62% of those finish (1,302). The finishers convert at 4.2%, against 1.8% for the shop as a whole, which looks like "2.3 times the conversion rate". It is not. The finishers were already the most determined lamp buyers.
The honest comparison is group against group. Here are the four weeks:
- Control: 7,000 sessions, 133 orders, a conversion rate of 1.90%.
- Exposed: 1,302 finishers with 55 orders, plus 5,698 other sessions with 97 orders, so 152 orders from 7,000 sessions, a conversion rate of 2.17%.
The relative uplift (see Foundations: percentages):
where is the relative uplift, is the conversion rate of the exposed group and is the conversion rate of the control group.
A relative uplift of , not . Is it real or noise? A two proportion test answers that (see Foundations: hypothesis tests):
where is the test statistic, is the pooled conversion rate of both groups together, and and are the numbers of sessions in the exposed and control groups. A above about 1.96 means the difference is unlikely to be chance at the usual 5% level.
After four weeks, , and:
With , well below , the difference could easily be chance. Not enough. Callum keeps the test running for 16 weeks in total, with the same rates, so 28,000 sessions per group. The control group has 532 orders (1.90%), the exposed group 606 (2.16%), the pooled rate is 0.02032, and:
With , above , the uplift is now credible. Over the 16 weeks the exposed half produced 74 extra orders, worth €6,216 in revenue and, at a 52% gross margin, about €3,232 in gross profit. Rolled out to all lighting visitors, the finder roughly doubles that. And every finisher who ticked "save my answers" added a room and a style to their account, which feeds the next sections.
Preference centres people actually use
A preference centre is the page where subscribers choose what they hear about and how often. Most shops have only one switch, subscribed or not, which means the only way to get fewer emails is to get none. A preference centre gives people a middle way, and every choice they make there is declared data: topics, frequency, channel.
Keep it short. Four to six topics that match how the shop is organised, a frequency choice, and the unsubscribe link visible, never hidden. Hiding the exit to keep people on the list is exactly the kind of design the dark patterns article warns about, and the law requires unsubscribing to be easy anyway. The email chapter of the advertising series covers the sending side.
Example: the "fewer emails" option at Shannonside
Shannonside's 38,000 subscribers lose 0.6% a month to unsubscribes:
That is people a month. Callum changes the unsubscribe page: the "Unsubscribe from everything" button stays first and plain, and below it sit two alternatives, "Only send me the monthly round up" and "Only new ceramics and kitchen textiles". Suppose 35% of the people who reach that page pick an alternative instead of leaving:
That keeps about subscribers a month, about 960 over a year, each of them now receiving fewer, better matched emails and each choice stored as a declared preference. Nobody was stopped from leaving: the button they came for is the first thing on the page.
Progressive profiling: one question at a time
Progressive profiling means building up a picture of a customer over many small moments instead of one big form. The sign up form asks for an email address. The delivery email asks one question. The review request asks another. Each question is optional, takes one tap, and arrives when it is relevant.
The reason is simple arithmetic: long forms are abandoned, and most people never come back to finish them. A one tap question in a message people were going to open anyway gets far more answers in total, and the answers are fresher.
Here is how Shannonside maps questions to moments:
| Moment | The one question | What it unlocks for the customer |
|---|---|---|
| Newsletter sign up | Email only, plus an optional "What are you shopping for?" | Emails about the right categories |
| Delivery email | "Which room is this for?" | Suggestions that match the room |
| Lamp or tableware finder | The finder's three questions, with "save my answers" | A shortlist now, a remembered style later |
| Review request, 21 days after delivery | "Was it a gift?" | No gift reminders for things bought for yourself |
| Account page | All of the above, editable, with a delete button | Control |
Example: twelve months of asking one question at a time
Before, Shannonside had a long optional form at account creation with seven profile fields. About 350 new accounts a month were created and roughly a quarter filled in the form, so about 88 profiles a month, around 10% of account holders after a year.
With progressive profiling, the delivery email's room question goes to account holders only (about 45% of orders, so 891 a month), and 24% answer it, about 214 answers a month. The finders add about 90 saved profiles a month and the account page about 30. That is about 334 new declared preferences a month. Allowing for people who answer twice, about 3,600 of the 11,000 account holders have declared a room or a style after twelve months, which is 33%.
Post purchase questions: what is it for, and where did you hear of us
The moment after a purchase is the friendliest in the whole relationship. The customer has just said yes. A short, optional question on the order confirmation page or in the confirmation email gets answers that no tracking can provide.
Two questions earn their place:
- "What is this for?" A gift, a replacement, a new home, a treat. It changes what you should send next, and the chapter on the second order builds on exactly this.
- "Where did you first hear about us?" This is a self reported attribution survey. It catches what analytics cannot see: a friend's recommendation, a podcast, a shop window, an Instagram post seen weeks before a Google search.
Treat survey answers with care. Only some customers answer, and the ones who do may differ from the ones who do not, which is called non response bias (see Foundations: sampling). People also remember imperfectly. The survey answers a different question from analytics, "where did you first hear of us", not "which click came last", and neither is the truth on its own. The attribution chapter explains how to weigh them, and how incrementality tests settle the argument.
For guest orders, store the answer in a way that does not add to the person's record: an aggregate table with the date and the answer, not linked to the order. That keeps the German regulators' point about guests in spirit, and you lose nothing, because the survey is only ever read in aggregate.
Example: Shannonside's survey against analytics
Shannonside adds "Where did you first hear about Shannonside Home?" to the confirmation page, optional, seven choices. In a month 38% of the 1,980 customers answer:
That is about answers. Callum puts the answers next to the shop's analytics report of the same month's orders by last click channel:
| Channel group | Survey: first heard (%) | Analytics: last click (%) |
|---|---|---|
| Search, paid and organic | 22 | 55 |
| Social media, paid and organic | 35 | 12 |
| 8 | 14 | |
| Friend or family | 18 | 0 |
| Direct or unknown | 0 | 15 |
| Other, including press and podcasts | 17 | 4 |
Search finishes the journey, social media and friends start it. A budget based only on the analytics column would cut the social spend that brings people to search in the first place. A budget based only on the survey would ignore that most people search before they buy. Niamh now has two views, and a reason to run a proper incrementality test before moving money.
Collect less, and keep it for less time
Data minimisation is not only a legal principle. It is also good engineering. Every field you store has to be protected, explained in the privacy notice, exported when someone asks for their data, and deleted on time. A field you never use is all cost.
The GDPR states the principles directly: personal data must be collected for specified purposes and not used in ways incompatible with them, limited to what is necessary, and kept in a form that identifies people for no longer than necessary5. In practice that means three habits:
- A purpose for every field. Before adding a field, write the sentence "I will use this to ...". If the sentence is vague, the field goes.
- The smallest version that works. If the purpose is a birthday voucher, the birth month is enough. The year adds nothing but risk.
- An expiry date. Preferences go stale. A room someone was furnishing two years ago says little about them today. Let declared preferences expire, and ask again if they still matter.
Example: Shannonside's sign up form, from seven fields to two
The old newsletter sign up form asked for email, first name, last name, date of birth, gender, phone number and Eircode. Callum goes through each field with Niamh:
| Field | "I will use this to ..." | Decision |
|---|---|---|
| send the newsletter | Keep | |
| First name | write "Hi Aoife" | Drop (the emails read fine without it) |
| Last name | nothing | Drop |
| Date of birth | send a birthday voucher | Replace with an optional birth month, asked later |
| Gender | nothing defensible (homeware is not gendered) | Drop |
| Phone number | nothing (no SMS programme) | Drop |
| Eircode | nothing for the newsletter (orders carry the delivery address) | Drop |
The new form has one required field, email, and one optional question, "What are you shopping for?", with five choices. The shop stores less, explains less, and gives the customer a reason to answer the one question it kept. Retention follows the same logic: declared preferences expire after 12 months, unused accounts are flagged after three years without an order and deleted after a reminder, and order records are kept for as long as tax law requires and no longer.
From signals to segments and moments
Data is only worth holding if it changes what the shop does. The bridge from data to action is the segment (a group of customers who should get the same treatment) and the moment (the trigger that makes it relevant now).
Declared data makes segments simple and honest. "Told us they are furnishing a living room" needs no clustering algorithm. Combined with transactional data it gets sharper: "furnishing a living room, bought ceramics, last order between 60 and 120 days ago". When the segments need to come from behaviour patterns rather than rules, the segmentation article shows how to find them with clustering. The recommendations chapter that follows this one turns segments into suggestions on each page.
A good segment passes three checks: it is big enough to matter, it maps to a different action, and the customer would recognise why they are in it.
Example: one segment and one moment at Shannonside
After a year, 3,600 account holders have declared a room. Of those, 1,240 chose "living room". Callum filters for those who also bought ceramics and whose last order was between 60 and 120 days ago: 186 people. The moment is the arrival of a new range of stoneware vases. The email says, at the top: "You told us you're furnishing a living room, so here are the new vases first." Below it, a link: "Change what you hear about."
The 186 customers get an email that explains itself. Nobody else gets it. And if someone changed their mind about the living room, one click fixes it.
The customer record in your own database
Everything in this chapter becomes concrete in the shop's database. When I build a shop on Ruby on Rails and Solidus, the customer record lives in the client's own database, and the code belongs to the client once paid, so the record can be shaped exactly to the business. Here is the minimum structure, for developers. Shop owners can skip to the next heading: the point is that every preference carries its source, its legal basis and its expiry date, and every consent carries its wording and its timestamp.
Two tables. The first holds declared preferences, one row per key and customer. The second is the consent record: Article 7(1) of the GDPR requires you to be able to demonstrate that someone consented5, so you store what they agreed to, which wording they saw, and when.
# db/migrate/20270222090000_create_customer_preferences.rb
class CreateCustomerPreferences < ActiveRecord::Migration[8.0]
def change
create_table :customer_preferences do |t|
t.references :user, null: false, foreign_key: { to_table: :spree_users }
t.string :key, null: false # "room", "style", "shopping_for"
t.string :value, null: false # "living_room", "scandi", "gift"
t.string :source, null: false # where the customer told us
t.string :legal_basis, null: false # "consent" or "legitimate_interests"
t.datetime :expires_at, null: false
t.timestamps
end
add_index :customer_preferences, [:user_id, :key], unique: true
create_table :consent_records do |t|
t.references :user, null: false, foreign_key: { to_table: :spree_users }
t.string :purpose, null: false # "save_quiz_answers", "newsletter"
t.boolean :granted, null: false
t.string :wording_version, null: false # which text the customer saw
t.datetime :recorded_at, null: false
end
add_index :consent_records, [:user_id, :purpose, :recorded_at]
end
end
The foreign key points at spree_users, the table the common Solidus authentication extension uses. Solidus lets a shop configure its own user class (Spree.user_class), and an order's link to a user is optional, which is what makes guest checkout possible. The consent table never updates a row: a withdrawal is a new row with granted: false, so the history stays intact.
The model enforces the rules from the minimisation section in code, so nobody can quietly add a field nobody asked for:
# app/models/customer_preference.rb
class CustomerPreference < ApplicationRecord
ALLOWED_KEYS = %w[room style shopping_for].freeze
belongs_to :user, class_name: Spree.user_class_name
enum :source, { quiz: "quiz", delivery_email: "delivery_email",
account_page: "account_page" }, validate: true
enum :legal_basis, { consent: "consent",
legitimate_interests: "legitimate_interests" }, validate: true
validates :key, inclusion: { in: ALLOWED_KEYS }
validates :value, length: { maximum: 40 }
before_validation { self.expires_at ||= 12.months.from_now }
scope :current, -> { where("expires_at > ?", Time.current) }
end
Three details matter. ALLOWED_KEYS is the list of things the shop has decided it may know; adding to it is a deliberate code change that goes through review and tests, not a marketing whim. Free text is capped at 40 characters, so nobody can paste their life story into a preference. And current makes expired preferences invisible to every query without deleting them in the request path; a nightly job deletes them for good.
The delivery email question is triggered by the order itself. Solidus publishes events on its event bus, Spree::Bus, and order_finalized fires when an order is completed13. A subscriber schedules the question, and only for account holders, because guests get nothing added to their record:
# app/subscribers/shannonside_home/room_question_subscriber.rb
module ShannonsideHome
class RoomQuestionSubscriber
include Omnes::Subscriber
handle :order_finalized, with: :schedule_room_question,
id: :shannonside_room_question
def schedule_room_question(event)
order = event.payload[:order]
return if order.user.nil? # guest order: nothing added
RoomQuestionJob.set(wait: 2.days).perform_later(order.id)
end
end
end
# config/initializers/omnes.rb
Rails.application.config.to_prepare do
ShannonsideHome::RoomQuestionSubscriber.new.subscribe_to(Spree::Bus)
end
The segment from the previous example is then a plain query. It reads declared preferences and completed orders, nothing else:
living_room = CustomerPreference.current
.where(key: "room", value: "living_room")
.select(:user_id)
Spree::Order.complete
.where(user_id: living_room)
.group(:user_id)
.having("MAX(completed_at) BETWEEN ? AND ?", 120.days.ago, 60.days.ago)
.pluck(:user_id)
Before sending anything, the email job also checks the latest consent record for the newsletter, so the segment never reaches someone who withdrew. And because everything about a customer lives in these few tables plus the orders, answering a subject access request (a customer's legal right to a copy of their data) is one method that collects the rows for one user and exports them. If you ever do store free text that could be sensitive, Rails can encrypt individual columns in the database with Active Record Encryption14.
Being open about it: say why
Openness costs almost nothing and builds trust, and the research earlier in this chapter shows it is also effective, as long as what you reveal is something the customer is comfortable with3. Declared data passes that test by design, so say it out loud:
- "Because you told us you're furnishing a living room."
- "Based on your last order."
- "You asked for monthly emails only, so this is your round up."
Each line comes with a way to change it, one click away. The privacy notice says the same in plain words, and the account page shows every stored preference with an edit and a delete button. If a line feels awkward to write ("Because you looked at side tables three times"), the data use behind it is probably the problem, not the wording.
Example: the homepage module at Shannonside
For logged in customers with a declared room, the homepage shows a row headed "For your living room", with a small line underneath: "You told us this in March. Change it." For customers without a declared room, the row shows bestsellers, headed "What people are buying this week", with no pretence of personal insight. For customers who switched off suggestions based on their orders, neither row uses their history. Three states, all honest, all controlled by the customer.
A checklist for knowing your customers properly
| Check | Done when |
|---|---|
| Every use has a legal basis | A table like Shannonside's exists, one row per use |
| Legitimate interests are written down | Each one has a purpose, necessity and balancing note |
| No special category data | No field or inference touches health, beliefs or private life |
| Cookies match the law | Consent for everything not strictly necessary, reject as prominent as accept, choices renewed within six months |
| Guest checkout exists | The account is offered after the order, never forced before it |
| Every question gives something back | The answer changes what the customer sees, visibly |
| Every field has a purpose | The "I will use this to ..." sentence exists for each |
| Preferences expire | An expiry date on every row, a job that deletes expired rows |
| Consent is provable | Purpose, wording version and timestamp stored, withdrawals as new rows |
| Customers can see and change it | Account page shows every preference with edit and delete |
| Effects are measured with a holdout | No "finishers convert 2.3 times better" claims |
Conclusion
A shop gets to know its customers best by asking, not by watching. Orders tell you what people bought, and they cover everyone. Declared data tells you why, and customers hand it over gladly when the question is short, timely and visibly useful. Behaviour data helps where the law and consent allow, and guesses about people should stay rare, harmless and never sensitive.
Give every use of data its own legal basis, write down the legitimate interests test where you rely on it, keep cookies within the rules, let people buy as guests, store only what you will use, and let it expire. Build the customer record in your own database with the source, basis and expiry on every row. Then tell customers why they see what they see. Done this way, knowing your customers is not creepy. It is simply good service.