From spreadsheet of ad results to testable next moves

APIKeyClaudeFree · Updated 2026-11-22 · 8 min read

Marketing desk with printed charts and a laptop
Prepared numbers give the model something solid to reason over.

Marketers and small business owners increasingly ask whether a language model can look at past ad performance and tell them what to do next: which creatives to pause, which audiences to expand, what new copy to test. The honest answer is yes, partly. A model is good at spotting patterns in well-prepared summaries and at drafting new ad variations. It is bad at arithmetic over thousands of rows and has no idea what your platform's algorithm will do tomorrow.

This guide shows a workflow that plays to those strengths. You export results, compute the numbers yourself in a few lines of Python, give the model a compact table, and ask for hypotheses and copy ideas you can then test. It works with any OpenAI-compatible API, including the keyless one described on this site, and with paid providers when you need higher quality.

Frequently asked questions

Can a language model optimise ad campaigns on its own?

No. It can suggest hypotheses and write variations, but it cannot see live auction data, cannot run experiments and does not know your margins. Treat its output as a list of ideas to test, not as decisions.

Why compute metrics in code instead of asking the model?

Models make arithmetic mistakes, especially across many rows, and they may silently skip data that does not fit in context. Pandas or a spreadsheet gives exact numbers; the model then reasons over those numbers.

What is a good metric set to send the model?

Per ad or ad set: spend, impressions, clicks, click-through rate, conversions, cost per conversion and, if you have it, revenue. Add the creative's headline and primary text so the model can relate wording to results.

How does a model's suggestion differ from a statistically valid finding?

A model notices that ads mentioning price did better. A valid finding requires enough data and a controlled comparison. Small differences on low spend are often noise, which models do not reliably flag.

Which model is better for this, a free one or a frontier model?

For summarising a small table and drafting copy, a mid-sized model often works. For nuanced strategy over many segments, frontier models such as Claude reason more carefully. Start cheap and upgrade if the suggestions feel shallow.

Is it safe to send campaign data to an API?

Aggregated metrics and ad copy are usually low risk. Do not send customer lists, emails or anything personally identifying. Check what the provider logs before sending business-sensitive figures.

How much data fits in one request?

With a 32,000-token context, a summary table of a few hundred rows plus instructions fits comfortably. Thousands of raw rows do not, which is another reason to aggregate first.

Step by step

  1. Export and clean — Download two to four weeks of results at ad level, rename columns, drop zero-spend rows and convert values to numbers.
  2. Compute metrics in code — Calculate CTR, CPC and CPA with pandas, flag rows with too few clicks and keep a compact table of top, bottom and typical ads.
  3. Prompt for observations and tests — Send the table with the goal, metric definitions and a fixed output structure, telling the model not to recalculate.
  4. Verify each claim — Check every observation against the table, discard those based on thin data and treat explanations as hypotheses.
  5. Run controlled tests — Launch variations that change one element, record results in a test log and feed the log back into later reviews.

What a model can and cannot do with ad data

Language models are strong at three things that matter here: reading a table and describing what stands out, linking those patterns to the words in the ads, and producing new text in a given style. These are exactly the parts of campaign review that eat a marketer's time.

They are weak at three others: exact calculation over large data, judging statistical significance and predicting platform behaviour. A model has no access to your ad account, cannot see the auction and does not know what changed in the platform this week. Designing the workflow around these limits is what makes the result useful.

Good use: pattern description

"Ads with a question in the headline had higher click-through but lower conversion rate" is the kind of observation a model makes well, provided the numbers it sees are correct.

Bad use: budget decisions on autopilot

Letting a model move budget directly is risky. It may overreact to a lucky day or recommend pausing an ad that is still in its learning phase. Keep a human in the loop for spend.

Step one: export and clean the data

Every ad platform lets you export results as CSV. Choose a date range long enough to have meaningful numbers, typically two to four weeks, and a breakdown level you can act on, such as ad or ad set. Include the creative text columns if the export offers them.

Before analysis, clean the obvious issues. Rename columns to short, consistent names. Remove rows with zero spend. Convert currency strings to numbers. These steps take minutes in a spreadsheet or a few lines of code and prevent the model from misreading formatted values.

Keep identifiers, drop personal data

Ad names and IDs help you act on suggestions later. Anything about individual customers does not belong in the export you send.

Pick one attribution setting and keep it

Platforms count conversions differently depending on the attribution window. Mixing exports made with different settings produces numbers that look comparable but are not. Note the setting in the file name so every later run uses the same basis.

Scale weighing coins beside a notebook
Compute spend and cost metrics exactly in code.

Step two: compute the metrics yourself

Use code for every number. Click-through rate, cost per click, conversion rate and cost per conversion are simple ratios, and computing them yourself guarantees they are right. Then flag rows with too little data to judge, for example fewer than a set number of clicks, so the model does not draw conclusions from noise.

Sort the table by the metric you care most about and keep only the top and bottom performers plus a few typical ones. A compact table of thirty to sixty rows gives the model enough contrast without flooding the context.

Why the enough_data flag matters

Telling the model which rows are statistically thin is the single most effective way to stop it from building a strategy on two lucky conversions. Choose a threshold that suits your volume.

import pandas as pd

df = pd.read_csv("ads_export.csv")
df = df.rename(columns={"Amount spent": "spend", "Link clicks": "clicks",
                        "Impressions": "impr", "Results": "conv",
                        "Headline": "headline", "Ad name": "ad"})
df = df[df["spend"] > 0].copy()

df["ctr"] = (df["clicks"] / df["impr"] * 100).round(2)
df["cpc"] = (df["spend"] / df["clicks"].where(df["clicks"] > 0)).round(2)
df["cpa"] = (df["spend"] / df["conv"].where(df["conv"] > 0)).round(2)
df["enough_data"] = df["clicks"] >= 100

ranked = df.sort_values("cpa", na_position="last")
compact = pd.concat([ranked.head(15), ranked.tail(15)]).drop_duplicates()
cols = ["ad", "headline", "spend", "impr", "clicks", "ctr", "conv", "cpa", "enough_data"]
table = compact[cols].to_csv(index=False)
print(table)

Step three: write a focused analysis prompt

Give the model a clear role, the business goal and the table. State what the metrics mean, which ones matter most and what kind of answer you want. Ask it to separate observations from recommendations and to say when data is insufficient.

Asking for a fixed structure makes the output easier to review and compare across weeks. Three to five observations, each tied to specific ads, then a short list of test ideas, each with a hypothesis.

Tell it not to recalculate

Models sometimes "helpfully" recompute a ratio and get it wrong. An explicit instruction to use the table as given prevents conflicting numbers in the answer.

from openai import OpenAI

client = OpenAI(base_url="https://api.apikeyclaudefree.com/v1", api_key="not-needed")

prompt = f"""You review paid social ad results for a small online shop.
Goal: lower cost per acquisition (cpa) while keeping volume.
Only use rows where enough_data is True for conclusions; mention others as 'too early'.

Return:
1. Observations (3-5), each naming the ads involved.
2. Test ideas (3), each as: hypothesis, what to change, metric to watch.
Do not recalculate numbers; use the table as given.

<table>
{table}
</table>"""

resp = client.chat.completions.create(
    model="free-ai",
    messages=[{"role": "user", "content": prompt}],
    temperature=0.3,
)
print(resp.choices[0].message.content)
Magnifying glass over printed figures
Verify each observation against the source table.

Step four: verify every claim against the table

Read the observations with the table open. For each claim, find the rows it refers to and confirm the numbers support it. Models occasionally attribute a result to the wrong ad, generalise from one row, or describe a trend that is not there. Catching these takes a few minutes and is the difference between a useful review and a confident mistake.

Pay special attention to explanations. A model might say an ad did well "because of urgency in the headline". That is a hypothesis, not a fact. It becomes useful only when you test it.

Compare with last period

Running the same prompt on each period's export and comparing the answers shows which observations persist. Patterns that hold across several periods are much more trustworthy than a single week's insight.

  • Does the named ad exist and do its numbers match?
  • Is the observation based on rows with enough data?
  • Is a causal explanation presented as certain?
  • Would the recommendation change spend significantly? If so, test small first.

Step five: turn hypotheses into controlled tests

The value of the exercise lies in the tests you run afterwards. Pick one or two hypotheses, create variations that change only the element in question, and run them against the current best ad with a fair budget split. Record the hypothesis and the result.

A model is also handy here as a copywriter. Give it the winning ad's text and the hypothesis, and ask for five variations that change only that element. Review them for accuracy, tone and platform policy before launching.

Keep a test log

A simple sheet with date, hypothesis, variant, spend and outcome builds institutional memory. After a few months, you can feed the log itself to the model and ask what has consistently worked.

Watch the claims in generated copy

Generated ad text may promise discounts, delivery times or results you do not offer. Every factual claim in a variant must be checked against reality before it goes live.

Two seedlings growing side by side
Controlled tests turn hypotheses into evidence.

Choosing a model and staying within limits

A compact analysis like this uses a few thousand tokens per run, well within free tiers. The keyless endpoint on this site serves free-ai, an independent open-weight model of about 35B parameters. It is not Claude, and the site is not affiliated with Anthropic, so do not expect Claude's depth on complex strategy questions.

If your account spans many campaigns, markets and products, a frontier model will usually give sharper, more nuanced observations. Get a key through the provider's official console rather than cheap resellers, which put your business data through unknown servers, as explained in who can read prompts sent through a proxy. For very large exports, read what a given context size can hold before deciding how much to aggregate.

Automating the weekly run

Once the prompt is stable, schedule the script weekly and send the output to email or chat. Keep the human verification step; automation should save reading time, not replace judgement.

Limits worth stating plainly

No model, free or paid, can guarantee better ad results. Platforms change delivery algorithms, seasons shift demand and competitors change bids. A model sees only the table you gave it. Used as a fast analyst and copy assistant, it saves time and surfaces ideas. Used as an oracle, it will eventually mislead you.

Also remember that advertising platforms have their own policies on claims, targeting and sensitive categories. Generated text does not know them reliably, so a final human check against the platform's rules is required.

Small accounts need patience

With modest budgets, many ads never reach enough clicks for a clear verdict. In that case, ask the model for fewer, bolder test ideas and run each one longer. Chasing tiny differences on low spend mostly measures luck.

Weekly planner on a desk
A weekly review keeps the analysis useful and checked.
Try the free API

Send a test prompt to the keyless free-ai endpoint from the chat box on the home page, no sign-up or key required.

Read also