Sub topic 1
The Marketing Research and Reporting Workflow
Prerequisites
Assume you know impressions, clicks, conversions, and spend. You should also be able to read basic Python, JSON, and simple API examples. An API is an interface that lets one program request data or an action from another program.
The marketing research and reporting workflow
A reporting workflow turns business questions into evidence and decisions:
- Define the question, audience, date range, and success metrics.
- Retrieve data from approved sources.
- Clean and calculate metrics.
- Compare results with goals or earlier periods.
- Draft findings, explanations, and recommendations.
- Verify every important claim.
- Obtain approval before publishing or acting.
What an AI agent is and how it differs from a chatbot
An AI agent is a system in which a language model chooses actions, calls tools, observes results, and continues until it reaches a defined stopping condition. A chatbot usually produces a response directly from the conversation. An agent can perform a sequence of operations, such as retrieving campaign data, calculating totals, and drafting a report.
The model should interpret questions and explain results. Deterministic software should retrieve records and perform arithmetic.
Where language models go wrong
Language models can invent facts, use stale knowledge, misunderstand metric definitions, or perform arithmetic incorrectly. They may also present an unsupported conclusion with confident wording. Treat model output as a draft until it is tied to source data and checked.
> callout warning > Never let a model invent missing campaign values. Require it to report unavailable data and identify the source and date for each important claim. >
Data sources: ad platforms, analytics, CRM and the web
Ad platforms provide impressions, clicks, spend, and conversions. Analytics systems describe sessions, events, and site behavior. A CRM contains leads, opportunities, customers, and revenue. The web can provide public competitor or market information, but its pages may change and should be stored with retrieval dates.
Use least-privilege access: give each workflow only the fields and systems it needs. Remove personal data unless it is required and approved.
Giving the agent tools
A tool is a named operation with a defined input and output. For example, a metrics tool can accept campaign rows and return computed values:
def campaign_metrics(rows):
impressions = sum(row["impressions"] for row in rows)
clicks = sum(row["clicks"] for row in rows)
spend = sum(row["spend"] for row in rows)
conversions = sum(row["conversions"] for row in rows)
return {
"ctr": clicks / impressions if impressions else None,
"cpc": spend / clicks if clicks else None,
"cpa": spend / conversions if conversions else None,
}The agent can request this tool, but the tool performs the arithmetic.
Exercise
Which task should remain outside the language model: explaining a campaign trend or calculating CPA?
Show answer
Calculate CPA with deterministic code, then let the model explain the verified result.