How Targeted Ads Work: A Middle School Lesson
It is PD week. There is a new ISTE poster on the media center wall, a Google Classroom with no assignments in it yet, and a printout from your department chair: “We need to integrate digital citizenship this semester.” That is the entire brief. No curriculum. No pacing guide. No definition of what digital citizenship even means for a class of sixth graders who think they already know everything about the internet because they have been on it since they were four.
Here is one topic that earns thirty minutes of advisory, ELA, or social-studies time without requiring you to know anything about computer science: why do the same ads chase you everywhere? Students already notice it. A girl searches “volleyball knee pads” once and gets ads for volleyball gear for two weeks on every app she opens. A boy watches one video about a video game and now his whole feed is that game. They think it is coincidence, or magic, or that someone is actually watching them. None of those is quite right — and the real explanation is more interesting, and more worth knowing.
That gap between what students experience and what they understand about it is a literacy gap. Nobody handed you the curriculum to close it. That is not a planning failure. This post gives you the mechanism in plain language and a no-device lesson you can run without a lab, a login, or a tech coordinator on speed-dial.
TL;DR — how targeted ads work: Targeted advertising works through a four-step pipeline. First, tracking code on websites and apps logs every link you click, video you watch, and page you linger on. Second, those signals get bundled into a behavioral profile — an “audience segment” — sometimes even using data from sites you never visited. Third, a machine-learning model estimates which ad you are most likely to click. Fourth, an automated auction picks the winning ad and delivers it, often before the page you are loading has finished appearing. The whole process happens without any human choosing what you specifically see.
Why do the same ads follow you everywhere?
The phenomenon has a name: retargeting. It works like this. A student visits a shoe retailer’s website, looks at a specific pair of sneakers, and does not buy them. The retailer’s website drops a small piece of code — a cookie or a tracking pixel — onto that student’s browser. That code tells the retailer’s advertising system: this device looked at product #A47B. Later, when that same device loads an unrelated app — a game, a recipe site, a news feed — the advertising system recognizes the code, checks the profile, and decides: show the sneaker ad again.
That is not accidental. It is the intended design. And it does not stop at shoes. The same mechanism follows users across apps, devices, and platforms because the tracking code reports back to centralized advertising networks — not to individual retailers. The network sees across many different websites at once.
Students often assume that someone is personally watching them. The truth is more unsettling in a different direction: no human is watching. The system is completely automated, and it operates at enormous scale — billions of ad decisions per day, none of them made by a person looking at a specific student’s screen.
How targeted ads work: the four-step pipeline

Understanding how targeted ads work means following four steps from the moment you load a page to the moment an ad appears. Each step involves a distinct technology — and a distinct moment where data about you is collected, stored, or used.
Step 1 — Track. Every time you visit a website, tracking code runs invisibly. Cookies record which pages you visit and for how long. Tracking pixels (tiny, invisible images) report back to advertising networks when a page loads. Device IDs tag your phone or tablet across apps even when you are not logged into anything. Hover data on some sites records which product images you paused on, even if you never clicked.
Step 2 — Profile. Those individual signals get bundled into a behavioral profile — a list of inferred interests, demographics, and purchase intentions. Advertising platforms call these “audience segments”: “likely sneaker buyer,” “interested in gaming,” “probable high-school student.” Crucially, a profile can include data from websites you never personally visited — this is called a shadow profile, built when the tracker recognizes your device ID from other sources. You do not have to have an account. You do not have to log in.
Step 3 — Predict. This is where machine learning enters. A model trained on billions of past ad interactions estimates the probability that this specific profile will click a specific ad. The model does not know anything about you as a person. It pattern-matches: “profiles with these characteristics clicked this category of ad at this rate.” The prediction is a number — a probability score.
Step 4 — Serve. In the moments between when you load a page and when it finishes appearing, an automated auction runs. Multiple advertisers bid for the “slot” on your screen. The system picks the winner based on bid price and the model’s prediction score, and displays that ad. No human chose it. The whole thing often completes before the page is fully visible to you.
What the ad system knows vs. what it only guesses
The distinction between confirmed data and inferred data matters — and it is one most students (and most adults) have never seen spelled out.
| What the ad system actually knows | What the ad system only guesses |
|---|---|
| Which links you clicked on tracked sites | Your age (unless you disclosed it in an account) |
| How long you watched a video (watch-time data) | Your income bracket |
| Rough geographic location from your IP address | Your gender (inferred from browsing patterns) |
| Which device and browser you are using | Your current mood or intent |
| Whether you visited a specific product page | What you are likely to buy next |
| Whether you have purchased before (if you logged in) | Whether an ad influenced your behavior |
The right-hand column is where advertising gets it wrong — and where the equity problems begin.
Where AI comes in — and where it gets things wrong

The “Predict” step above is a machine-learning model. It falls squarely under AI4K12 Big Idea #3: Learning — computers learn from data. The model does not understand you. It finds patterns in large datasets of past user behavior and extends those patterns to new cases. That is powerful when the patterns are reliable. It is a problem when they are not.
Consider what the model gets wrong:
- A student researches a violent historical event — a famous battle, say — for a social-studies project. The model does not know it was schoolwork. It may tag the profile with a “violent content” interest and serve ads that have no business near a classroom.
- A student borrows a parent’s tablet to look up “retirement planning.” The model infers “older user with financial interest.” That inference attaches to the device, not the parent.
- A student who watches one cooking video gets profiled as a “cooking enthusiast” and receives ads for kitchen gear for weeks, because the model cannot distinguish between “watched this once” and “genuinely interested.”
These are mislabeling errors — the inevitable result of pattern-matching on thin or mixed data. But they are not just inconvenient. Research from Children and Screens found that roughly 90% of child-directed websites embed third-party trackers, meaning profiles are being built on minors at scale. And because profiling is automated, mislabeled profiles can result in age-inappropriate content or discriminatory ad targeting — showing certain job ads, housing offers, or loan products differently based on inferred demographics.
The model also has no way to distinguish “I was joking” from “I am genuinely interested.” Students sometimes search for absurd things on a dare. The profile does not have a sense of humor.
The reason students cannot explain any of this is not because they are incurious or too online. It is because the mechanisms are designed to be invisible. Understanding why the model gets things wrong is exactly what ISTE 1.3.b calls for — students need to “evaluate the accuracy, perspective, credibility and relevance of information, media, data or other resources.” Applying that standard to ad systems is as legitimate as applying it to a Wikipedia article.
What the 2025–2026 privacy rules changed
This is not purely abstract. Two significant legal developments in the last two years are worth a sentence each in class — partly because they validate why this lesson matters, and partly because students are directly affected.
The FTC’s amended COPPA rule took effect June 23, 2025, with a compliance window running into 2026. Under the amended rule, platforms must obtain opt-in parental consent before serving targeted ads based on behavioral data to children under 13 — a meaningful change from the prior opt-out default (Mayer Brown summary; National Law Review). This means the four-step pipeline described above now has a legal checkpoint for younger students, at least in theory.
Separately, Meta reportedly rolled out Teen Accounts in 2026 that remove interest-based and behavioral ad targeting for users under 18 (as reported by AuditSocials). Under-18 users in Teen Accounts see contextual ads only, not profile-based ones. That is a policy acknowledgment that the targeting pipeline operates differently for minors.
COPPA 2.0, which would go further and ban targeted ads to anyone under 17, passed the US Senate in July 2024 with broad bipartisan support but remains pending as of this writing. Whether it passes or not, its existence signals that legislators consider the behavioral profiling of minors a distinct category of concern.
You do not need to teach this as a policy class. A single sentence works: “The government recently made some of these practices illegal for kids under 13, which tells you something about how the industry was operating before.” That sentence usually generates more questions than a full lecture would.
A no-device lesson: Be the Ad Targeter

This activity runs 25 to 45 minutes depending on debrief depth. No devices, no logins, no lab time. The only materials are role cards you print in advance (or write on index cards) and a short set of three sample ads.
The setup. Divide the class into groups of four or five. Each group contains three roles: the Tracker, the Profiler, and the Model. The fourth student (or you, in a smaller group) plays the Auditor in the debrief round. Use a fictional persona — “Jordan” — with invented browsing history. Do not use real students’ names, real browsing habits, or anything that could identify an actual person. FERPA compliance means the fictional persona stays entirely invented.
Round 1 — the full pipeline (10 minutes).
- The Tracker receives five paper clue-cards describing Jordan’s behavior: “watched a 4-minute video about basketball shoes,” “hovered on a bike helmet product page for 30 seconds but did not click,” “searched for ‘good earbuds under $40,’” “read an article about a local sports team,” “loaded a page about scholarship applications.”
- The Profiler reads the clue-cards and writes a short audience-segment label: three to five words describing Jordan as an advertising target. Examples students often produce: “sports fan, budget-conscious teen.”
- The Model receives three sample ads (print three simple rectangles with product names — Ad A: basketball shoes $89; Ad B: earbuds $35; Ad C: college-prep workbook $12) and must pick one to show Jordan and write one sentence explaining the reasoning from the clues.
Round 2 — the thin-data debrief (10 minutes).
Replace the five clue-cards with two: “searched ‘how to get better at sports’” and “watched half of a cooking video.” The Profiler now has almost nothing concrete. The Model must still pick an ad. They will almost certainly guess wrong — or pick arbitrarily. This is the designed insight: real systems make exactly this kind of inference from thin, ambiguous data, and they do it at massive scale, confidently.
Ask the debrief question: “If a real advertising system saw only those two clues, what could go wrong?” Let students answer before you explain. The mislabeling problem usually surfaces on its own.
Debrief (5 to 15 minutes). The Auditor comes in here. Ask: “What did the Tracker collect that Jordan probably didn’t know was being collected?” (The hover data, the time-on-page data.) “What did the Profiler guess that isn’t in the cards?” (Age, income, gender.) “What would have to be true for the Model’s choice to be fair?” That last one is the equity question, and it usually produces the most interesting discussion.
Standards crosswalk
| Activity step | Standard |
|---|---|
| Round 1 — Tracker collects behavioral signals | ISTE 1.2.d — Manage personal data to maintain digital privacy and security |
| Round 1 — Profiler builds an audience segment | AI4K12 Big Idea #3 — Computers learn from data; AI4K12 Big Idea #5 — Societal Impact |
| Round 2 — Model picks from thin data, gets it wrong | ISTE 1.3.b — Evaluate the accuracy, perspective, credibility and relevance of information |
| Debrief — Auditor questions on fairness + consent | ISTE 1.2.b — Engage in positive, safe, legal and ethical behavior |
| Debrief discussion (whole class) | CCSS.ELA-LITERACY.SL.7.1 — Collaborative discussion |
| Reflection writing (optional extension) | CCSS.ELA-LITERACY.W.7.8 — Gather info from multiple sources, assess credibility |
If you want to extend into a second class period, this reflection prompt works well: “Find one ad you have seen recently. Write two to three sentences explaining which step of the pipeline you think delivered it, and what clue you think the system used.” That aligns to CCSS.ELA-LITERACY.W.7.8 and lets students connect the lesson to their own experience without sharing anything private in class.
For a deeper version of this activity — scenario-based discussion plus a family take-home guide — the AI Privacy & Surveillance Lesson | 4 Scenarios + Family Guide includes structured debrief questions, student handouts, and a parent-facing explainer built for the same grades. The Unplugged AI Activities | 10 No-Tech Lessons collection includes a related card sort on data and prediction that pairs well with Round 2.
Targeted ads connect directly to how recommendation algorithms work — but there is a distinction worth one sentence on the board: recommendation algorithms (like those on YouTube or Spotify) pick content to show you; ad targeting picks which ad to show you. The mechanism is similar; the incentive is different. See how recommendation algorithms work, explained for middle school for that comparison lesson.
The same profiling pipeline also shows up in credit-card fraud detection — the same behavioral-pattern logic, pointed at a different problem. How AI detects credit card fraud, for middle school is a useful companion if you want students to see the technology in a context that feels less sinister, which can shift the discussion productively.
Teaching this without a privacy-law degree
You do not need to know what RTB stands for. You do not need to have read the FTC’s amended rule. You do not need a background in machine learning. The lesson above requires a printer, index cards, and a willingness to let students argue through the debrief question before you give them the answer.
Here is what you do need to know: the pipeline is Track → Profile → Predict → Serve. The model guesses from patterns. Guesses from patterns can be wrong, and those errors are not random — they tend to land harder on students who are already navigating more complicated circumstances online. That is enough to run thirty minutes of meaningful advisory or ELA discussion.
The broader point is this: the privacy chaos that students are living in right now — the ads that follow them, the profiles that exist without their knowledge, the shadow data that accumulates before they are old enough to consent — is not a discipline problem. A Common Sense Media report from 2024 found that roughly 60% of middle and high school teachers do not cover all six digital-citizenship topics in a given year, often because they were never given the tools to do so. That is not a failure of supervision. It is a literacy gap, and a single 25-minute no-device lesson is a legitimate starting point.
If you want something more complete — a full lesson with a surveillance scenario set, a family guide, and student-facing handouts — the AI Surveillance and Privacy Lesson | Grades 6–8 is built for exactly this audience: ELA and social-studies teachers handed a digital-citizenship mandate and no curriculum. For a larger package that connects this lesson to how AI works more broadly — including the machine-learning foundations behind Step 3 — the How AI Works MEGA | 16 Lessons covers the full arc from data collection to societal impact across sixteen lessons for grades 6–12.
And if you want to start with something free before committing to anything, the free starter pack includes an introductory AI literacy lesson that pairs well as a pre-unit hook.
This post was drafted with AI assistance and human-finalized.
Quick questions
This is called retargeting. When you visit a product page, a small piece of tracking code records your device and reports back to an advertising network. That network then shows you the same ad across other apps and websites you visit later. No human is watching — it is an automated system that recognizes your device ID wherever it appears.
A shadow profile is a behavioral record that an advertising network builds about you using data from websites you never personally visited. If another site that shares data with the same ad network provides enough signals about your device ID, a profile forms without you ever having an account or logging in anywhere.
Under the FTC's amended COPPA rule, which took effect June 23, 2025, platforms must obtain opt-in parental consent before serving behaviorally targeted ads to children under 13. For users under 18, Meta rolled out Teen Accounts in 2026 that restrict interest-based ad targeting. COPPA 2.0, which would ban targeted ads to minors under 17, passed the US Senate in July 2024 but had not yet been signed into law as of this writing.
Get the free AI-Proof Assignment Toolkit
10 ways to redesign any assignment so an AI chatbot structurally can't do it — plus a redesign worksheet, a 45-minute lesson, the “Spot AI Work” card, and parent templates. One email, all 5 pieces.
Prefer the full breakdown? See everything inside the toolkit →