Machine learning in marketing uses models trained on customer and campaign data to predict who will buy, churn or respond, which product fits and what an ad impression is worth, then acts on those predictions in ad platforms, CRMs and email tools. It is only as good as the consented data it learns from and the experiments that check it.

This guide covers the uses that matter in practice, with examples from Google, Meta, Microsoft and Amazon documentation: segmentation and lookalike audiences, propensity and churn scores, recommendations, lead scoring, automated bidding, marketing mix modelling, attribution, incrementality tests and generative AI. For each, it explains how it works and the data it needs. The second half covers what it takes: consent, a warehouse, measurement and the risks.

What machine learning does in marketing

Almost every use falls into one of three jobs. A model predicts (a score per customer, lead or auction), decides (a bid, a budget split, the next offer) or generates (a headline, an image variant). Predictions are worth something only when a system acts on them, and actions are worth something only if you can show they changed an outcome. That thread runs through this guide.

UseWhat the model predicts or decidesData it needsWhere it usually runs
Segmentation and lookalikesGroups of similar customers; people like your bestCustomer attributes and orders; a seed listWarehouse, ad platforms
Propensity and churn scoresProbability of buying or lapsing in a set windowEvent history with known outcomesGoogle Analytics 4, warehouse
RecommendationsThe item a person is likely to want nextUser and item interactionsWebsite, app, email
Predictive lead scoringWhich open leads will qualifyClosed leads, both won and lostCRM
Bidding and budget automationWhat each auction or impression is worthThe conversions and values you sendGoogle Ads, Meta Ads
Marketing mix modellingEach channel's contribution to salesAbout two years of weekly spend and salesMeridian, Robyn
Multi-touch attributionCredit for each tracked touchpointClick and view pathsGoogle Analytics, Google Ads
Incrementality testsThe sales a campaign causedA random holdout or matched regionsLift tools, GeoLift, GeoX
Generative AI for creativeNew copy, image and video variantsBrand assets, landing pages, approved claimsPerformance Max, Advantage+

Two things are worth knowing before the details. Much of the machine learning a marketing team uses already sits inside the tools it pays for, so the work is feeding those models good signals and checking their claims, not building models from scratch. And every use has a minimum amount of data below which it does not work, which the sections below spell out.

Customer segmentation and lookalike audiences

Segmentation groups customers who behave alike so that each group gets a different message, offer or budget. The machine learning approach is clustering: describe each customer with a handful of features, commonly recency, frequency and monetary value (RFM) plus product mix and preferred channel, and let an algorithm such as k-means find groups whose members are closer to each other than to anyone else. The algorithm does not name the groups. A person reads the averages, decides that one cluster is "lapsed high-value buyers", and chooses what to do about it. Good segments stay stable from month to month and differ enough to deserve different treatment; if they do neither, hand-written rules will do the job for less.

Lookalike audiences work the other way round: you hand the ad platform a seed list of your best customers and its model finds people who resemble them. On Meta, a lookalike source needs at least 100 people, Meta recommends 1,000 to 5,000, you choose the size as a percentage of the population where the ad set runs, and people in the source are excluded from the result. The seed matters more than the settings: your most profitable customers produce a different audience from everyone who ever bought once. Lookalikes are limited or unavailable for some ads about financial products, employment and housing, for reasons covered under risks below.

On Google Ads, the help centre points advertisers to optimized targeting in place of similar segments. It is turned on automatically, treats your first-party data segments as hints rather than limits, and may reduce or stop serving to them when it finds better-performing traffic elsewhere. That is efficient for conversions, and a surprise for teams who thought they were targeting their customer list.

Propensity and churn prediction

Propensity scoring is the core of predictive analytics in marketing. A propensity model scores each customer's probability of doing something within a fixed window: buying in the next seven days, upgrading, or not coming back. It is supervised learning. You take a snapshot of history, label each customer with what they did in the window that followed, and train a classifier (common choices are logistic regression and gradient-boosted trees) on features such as days since the last visit, recent orders, pages viewed, support tickets and discount use. The model then scores today's customers, the scores become a ranked list, and a business rule decides who near the top gets an offer, a call or nothing.

Event records flow from a database into a model gear, which ranks a column of customer cards by gauge level; only the orange top-risk card receives an offer envelope sent to a phone.
Fig. 1 The model only ranks customers. Who gets the offer is a business rule, and the rule is what you test.

Google Analytics 4 ships three of these models ready-made. Its predictive metrics are purchase probability (a user active in the last 28 days makes a purchase in the next 7), churn probability (a user active in the last 7 days is not active in the next 7) and predicted revenue over the next 28 days. They come with a data floor: over a seven-day period in the last 28 days, at least 1,000 returning users must have met the condition and at least 1,000 must not, and model quality has to hold over time. Below that, the metrics do not appear; if quality drops later, Analytics stops updating them. Scores are recalculated once a day and can be used to build predictive audiences.

A model in your own warehouse gives you what GA4 cannot: your definition of churn (a cancelled subscription, not a quiet week on the website), features from orders, billing and support systems, and scores written back to your CRM or email platform.

The score is not the decision. A churn score says who is likely to leave, not who will stay because of an offer. Some high-risk customers leave whatever you send, and some would have stayed anyway, so a discount sent to the whole top of the list partly pays people for doing nothing. Uplift modelling targets that gap by estimating the difference an action makes for each customer, and it learns from the results of an earlier randomized test. At minimum, send the retention offer to a random part of the high-risk group and compare it with the rest.

Recommendations

Recommendation models choose which product, article or offer to show each person: the "frequently bought together" block, the next-episode row, the product grid in a follow-up email. Most combine two approaches. Collaborative filtering learns from interactions alone (people who bought or viewed this item also engaged with that one) and needs no understanding of what the items are. Content-based methods use item attributes such as category, brand, price band and description, which lets them recommend a new product nobody has clicked yet: the cold-start problem that collaborative filtering cannot solve on its own.

The data floor here is interactions. Amazon Personalize, a managed recommendation service, will not train until it has at least 1,000 item interactions and 25 users with at least two interactions each. That is the minimum to train, not a promise of useful results. The honest benchmark is a best-seller list: run the recommender against a simple popularity rule in an A/B test, and keep it only if revenue or engagement per visitor rises.

Predictive lead scoring

In B2B marketing the scarce resource is sales time, so the model ranks open leads by their chance of turning into an opportunity. It learns from leads that were already closed either way, using fields such as source, industry, company size, pages visited, emails opened and time to first response. Rule-based scoring, where a demo request earns more points than a whitepaper download, is the baseline the model has to beat.

Microsoft's Dynamics 365 Sales shows what the minimum looks like. Its predictive lead scoring will not build a model until at least 40 qualified and 40 disqualified leads were created and closed in the training window you pick, from three months to two years. It can retrain automatically every 15 days, and it marks a model as not ready to publish when its accuracy, measured as the area under the curve (AUC), falls below a threshold. Whichever CRM you use, check the same three things: enough closed outcomes of both kinds, a retraining schedule, and a visible accuracy measure.

The score earns more when it flows back to advertising. If ad platforms only see form fills, they optimize for form fills, junk included. Google's enhanced conversions for leads sends hashed (SHA-256) first-party data from your lead forms and matches it with the lead outcomes you import later, so measurement, and the bidding that relies on it, reflects the leads your sales team actually qualified.

Bidding and budget automation in ad platforms

This is where most marketers use machine learning every day, often without calling it that.

Google Ads Smart Bidding. Smart Bidding is Google's name for bid strategies that use its AI to optimize for conversions or conversion value in every auction, which it calls auction-time bidding. The strategies are Target CPA, Target ROAS, Maximize conversions and Maximize conversion value. At each auction the model weighs signals no person could adjust by hand at that grain: device, location and location intent, time of day, remarketing list membership, browser, operating system and the actual search query rather than only the matched keyword. Google notes that some strategies need a minimum volume of historical conversion data, and from June 2026 it is relabelling strategies (for example, "Maximize conversions with a Target CPA" becomes "Target CPA") without changing how they bid.

Performance Max. Performance Max is a goal-based campaign type that reaches all Google Ads inventory, including YouTube, Display, Search, Discover, Gmail and Maps, from one campaign. You supply conversion goals, creative assets grouped into asset groups, and audience signals; Google's models decide where to serve and which combinations of assets to show. A Search campaign with an exact-match keyword still takes priority over Performance Max when a query matches that keyword.

Meta Advantage+. Meta describes Advantage+ as a suite that uses AI to optimize in real time and match ads to the people most likely to act. Its end-to-end campaigns for sales, app promotion and leads automate audience, placement and budget together; Advantage+ sales campaigns were formerly called Advantage+ shopping campaigns, as Meta's April 2025 explainer notes. Single-step options automate one piece, such as Advantage+ audience or Advantage+ campaign budget.

All three share one weak point: they optimize towards the conversion you send them, and they report their own results. Set a cheap micro-conversion as the goal, and the model finds people who do that cheap thing. Send revenue, qualified leads or margin as the conversion value, and it looks for those instead. The platform's report then credits its own campaigns, which is why the measurement sections below matter.

Marketing mix modelling with Meridian and Robyn

Marketing mix modelling (MMM, often spelled marketing mix modeling) answers the budget question directly: how much did each channel contribute to sales, and where should the next dollar go? It is a regression on aggregated time series, usually weekly. Sales, leads or sign-ups sit on one side; spend or impressions per channel, plus prices, promotions, seasonality and holidays, sit on the other. Because it uses totals rather than people, it needs no cookies or user-level data, which keeps it working as tracking individuals becomes harder. Its output splits each week's sales into a baseline, what would have sold without marketing, and a contribution from each channel.

Two transformations make it specific to marketing. Adstock models carry-over: an ad seen this week still has some effect next week, fading over time. Saturation models diminishing returns: each extra dollar in a channel buys less response than the one before, which Robyn, for example, models with a Hill function. The fitted curves are what turn the model into a budget planner.

Icons for a television, a search magnifier, a phone feed and an envelope feed a model box that splits a weekly bar chart into a grey baseline and stacked channel layers, one layer orange.
Fig. 2 A mix model never looks at a single customer. It explains weekly totals, which is why it survives consent loss and why it needs experiments to stay honest.

The two best-known open-source frameworks come from the ad platforms themselves:

Google MeridianMeta Robyn
MethodBayesian causal inference, sampled with MCMC (NUTS)Ridge regression, with evolutionary hyperparameter search (Nevergrad)
LanguagePython 3.11 to 3.13; at least one GPU recommendedR, plus a Python beta translated with the help of LLMs
Distinctive partsGeo-level models, reach and frequency, experiments as priorsAdstock and saturation search, trend and season decomposition, budget allocator
CalibrationExperiment results as priors; Meridian GeoX for geo testsRecommends Conversion Lift or GeoLift results as ground truth
LicenceApache 2.0MIT

Meridian became available to all marketers on January 29, 2025, with a partner program of more than 20 measurement firms and an MMM Data Platform that supplies Google media data such as impressions, clicks, cost and search query volume. Robyn, from Meta Marketing Science, describes itself as experimental and semi-automated, and as best suited to advertisers with granular digital and direct-response data.

MMM has the heaviest data needs of anything in this guide. Robyn's analyst's guide to MMM asks for at least two years of weekly history (four to five years if only monthly data exists) and about ten observations for every input variable. It also sets aside at least four weeks just for collecting data, because spend from every channel, prices, promotions and outcomes rarely sit in one place. Neither framework can separate two channels that always rise and fall together; that is what experiments are for, and both are built to take experiment results as inputs.

Multi-touch attribution and its limits

Multi-touch attribution (MTA) works on individual journeys: it takes the tracked clicks and views before each conversion and divides the credit among them. The machine learning version is data-driven attribution. Google's data-driven attribution compares the paths of customers who convert with the paths of those who do not, and gives more credit to the interactions that raise the chance of converting. It is the default for most Google Ads conversion actions, and Google recommends at least 200 conversions and 2,000 ad interactions in 30 days for it to work well.

Its limits are structural:

  • It sees only what it can track. Google Ads' data-driven model looks at interactions with your Search, YouTube, Display and Demand Gen ads, not at the email, social post or TV spot that came before them. Each ad platform reports from its own view of the journey, so adding up platform-reported conversions can count the same sale more than once.
  • Paths are broken. Safari has blocked cross-site cookies by default since March 2020, visitors who refuse consent drop out of user-level tracking, and journeys cross devices. Chrome did not remove third-party cookies after all: in April 2025 Google said Chrome would keep its current third-party cookie choice and would not roll out a new standalone prompt. The paths that MTA sees are still a partial sample.
  • Credit is not cause. Attribution shows which ads sat on converting paths, not whether the sale would have happened without them. In eBay's paid search experiments, published in Econometrica in 2015, brand-keyword ads had no measurable short-term benefit and returns from paid search were a fraction of non-experimental estimates. A comparison of 12 lift studies at Facebook found that common observational methods often failed to reproduce the experimental results, even with thousands of behavioural variables.

Use attribution for what it does well: fast comparisons of keywords, audiences and creatives inside one platform. Do not use it to split the budget between platforms.

Incrementality tests: measuring what marketing caused

An incrementality test, or lift test, measures what attribution cannot: the sales that happened because of the marketing. You randomly withhold the ads, email or offer from part of the audience, run the campaign as normal for everyone else, and compare the outcomes. The incremental effect is the difference between the groups, not the conversions in the exposed group.

A grid of grey tokens is split by a dashed line; phones deliver ads only to the left group. Each group fills a shopping basket, and only the extra boxes in the left basket are orange.
Fig. 3 Incremental sales are the gap between the two baskets, not the size of the first one.

Two designs cover most needs:

  • User-level holdouts. People are randomly assigned to see or not see the campaign. Platform tools such as Meta Conversion Lift work this way, and email and CRM programs are the easiest place to start, because you control the send list.
  • Geo experiments. Regions, not people, are assigned to treatment and control, which works without tracking individuals and suits TV, radio and out-of-home. Meta's open-source GeoLift uses synthetic control methods and includes power calculators for choosing markets. Google's Meridian GeoX supports holdback, go-dark and heavy-up designs and converts the results into priors for a Meridian model.

To run a first holdout test:

  1. Write the decision down first: the metric (sales, qualified leads, revenue per customer) and what result would make you cut, keep or grow the channel.
  2. Size the test with a power calculation, so the holdout is large enough to detect the effect you expect over the test period.
  3. Randomize and keep the holdout clean. Exclude it from every channel you are testing, including retargeting.
  4. Run it through at least one full purchase cycle, so delayed sales are counted.
  5. Compare the groups on the business metric, then feed the result into your mix model as calibration.

Generative AI for creative and copy

Generative models are the newest layer, and the one many people now mean by AI in marketing: instead of predicting who sees an ad, they produce the ad. In Performance Max, text customization writes extra headlines and descriptions from your landing page, domain and current ads; Final URL expansion can swap in a more relevant landing page with a matching dynamic headline; and auto-generated videos add video assets. Google states that you remain responsible for the accuracy and compliance of dynamically generated assets. Meta's Advantage+ creative includes generative tools that adjust aspect ratios and ad copy and add motion to images.

Three rules keep this useful. Brief the tools with approved claims, prices and brand terms. Have a person review every variant that makes a factual claim before it runs, because the advertiser answers for it. And test generated creative against your own in a controlled experiment rather than trusting an in-campaign comparison. For AI-written pages meant to rank in search, the rules come from Google Search and are different: see AI-generated content in SEO.

Most of the models above learn from data about people, so the first question is not which algorithm to use but whether you may use the data, and whether it is any good.

GDPR (EU and EEA). The GDPR defines profiling as automated processing that evaluates or predicts personal aspects such as preferences, interests, behaviour, location or movements, so a churn or propensity score is profiling. Article 21 gives people the right to object at any time to processing for direct marketing, including the profiling behind it, after which that processing must stop. Article 22 restricts decisions based solely on automated processing that have legal or similarly significant effects, which becomes relevant when a model's output does more than choose an ad or an email.

PIPEDA (Canada). PIPEDA applies to private-sector organizations that collect, use or disclose personal information in commercial activities; Alberta, British Columbia and Quebec have their own substantially similar laws for activity inside the province. The Privacy Commissioner's policy position on online behavioural advertising accepts opt-out consent only under conditions: the purpose is explained clearly, not buried in a privacy policy; opting out is easy, immediate and persistent; and the data is limited to non-sensitive information, which excludes health, financial data, ethnic origin and sexual orientation, among others. It adds that organizations should avoid knowingly tracking children and should not use techniques people cannot control, such as device fingerprinting.

Google's consent requirements for EEA traffic. As part of stricter enforcement of its EU user consent policy, Google requires advertisers who want measurement, ad personalization and remarketing for users in the EEA to collect consent and pass it to Google. Sites that run their own banner must implement consent mode v2, and Google warned that offline audiences such as Customer Match lists would degrade from March 2024 unless advertisers moved to the updated APIs or attested to consent. Consent mode carries two signals for advertising use, ad_user_data and ad_personalization, alongside the storage signals ad_storage and analytics_storage. In basic mode, Google tags do not load until the visitor chooses; in advanced mode, they load and send cookieless pings while consent is denied, which gives Google an advertiser-specific model for the conversions it cannot observe, instead of a general one.

Important

Consent mode passes the visitor's choice to Google; it does not make the choice lawful. Obtaining valid consent (the banner, its wording and the records) stays your responsibility under the GDPR, PIPEDA or whichever law applies to you.

A warehouse the models can trust

Ad platforms train on the events you send them. Your own models train on whatever you can join together: web and app events, orders, returns, subscriptions, CRM stages and support tickets. That join is the unglamorous core of machine learning in marketing, and it belongs in a warehouse, not in spreadsheets exported from each tool.

A common starting point is GA4's BigQuery export, which sends raw events to BigQuery once a day and, with streaming export, continuously through the day; standard properties are limited to 1 million events a day in the daily export. From there the work is engineering: a customer ID that matches across systems, tests that fail loudly when a feed goes stale, one agreed definition of "active" and "churned", and feature tables rebuilt on a schedule so that training and scoring read the same logic. Watch for leakage: a field that is only filled in after the outcome, such as a cancellation reason, makes a model look brilliant in testing and useless in production.

Our data platform service covers this layer: ingestion pipelines, a governed warehouse or lakehouse with tests and lineage, and the features and datasets that machine learning reads. For the reporting side of the same stack, see building data analytics software, and for lakes, streaming and what a data platform costs to run, big data analytics explained.

How to tell whether a model is helping

A model's accuracy (AUC, precision, forecast error) says how well it ranks or predicts. It does not say whether acting on its output made money. Prove that the same way as for any campaign, with a holdout:

  1. Define the action and the business metric, for example "retention offer to the highest-scored customers" and "revenue per customer over the following quarter".
  2. Keep a random holdout group the model does not touch: eligible customers who get the previous treatment, or none.
  3. Compare the two groups on the business metric, never on the model's own score.
  4. Backtest before launch on a period the model never saw, and check that no feature leaks the outcome.
  5. Monitor and retrain. Behaviour, prices and tracking change, and a model trained on last year's journeys drifts. GA4 stops updating its predictions when model quality drops; your own models need the same kind of guard.
  6. Keep a small holdout permanently, so you notice when the lift disappears.

Risks: bias, privacy and trusting platform numbers

Bias in targeting and delivery. Optimization can discriminate even when the advertiser does not intend it. A 2019 study, published in the Proceedings of the ACM on Human-Computer Interaction, ran real ads on Facebook with neutral targeting and found delivery skewed along gender and racial lines for employment and housing ads, driven by the ads' content and budgets as well as the platform's relevance predictions. In June 2022 the US Department of Justice settled with Meta in its first case challenging algorithmic bias under the Fair Housing Act: Meta agreed to stop using its Special Ad Audience tool for housing ads and to build a new delivery system for them, under court oversight. The same risk applies to your own targeting: a model or a lookalike seeded with past customers tends to reproduce whoever you reached before. Check who a model leaves out, especially for credit, jobs, housing, insurance and health, and see fairness in AI decision-making for the methods.

Privacy beyond the legal minimum. Models infer things people never told you, such as a health condition from purchases or financial strain from payment patterns. Even where an inference is lawful, using it in targeting can cost more trust than it earns. Exclude sensitive inferences by design, keep features to what the purpose needs, and honour an objection or opt-out everywhere the customer's data flows, including audiences already uploaded to ad platforms.

Over-trusting platform-reported results. Every ad platform reports conversions through its own attribution, and its bidding optimizes towards that same measure. The eBay and Facebook studies above show how far correlation-based numbers can drift from causal ones. Treat in-platform ROAS as a steering signal, and make budget decisions on experiments and a calibrated mix model.

Start with one use, one business metric and one holdout, and add the next model only when the first has shown lift. Where a model or an AI step belongs inside a marketing workflow, with an evaluation before every change and a person approving what matters, that is the work of our AI and automation service.