Skip to Content
Course content

168: Campaign Response Analysis

Click on the "Edit" button in the top corner of the screen to edit your slide content.

How do I actually calculate the response rate across different customer segments?

When I'm looking at a campaign, I don't care about the overall average as much as I care about the variance. If your overall response rate is 2%, but one specific segment is at 15%, that's where the real story is. In R, the cleanest way to do this is using dplyr to group your data and then taking the mean of your binary response column (assuming 1 is "responded" and 0 is "didn't").

Let's say we're analyzing a "Summer Garden Sale" email blast. We have a dataset called campaign_data with columns for segment (e.g., 'Homeowner', 'Renter', 'Commercial') and responded.

library(dplyr)

response_summary <- campaign_data %>%
  group_by(segment) %>%
  summarise(
    total_sent = n(),
    response_rate = mean(responded),
    count_responded = sum(responded)
  ) %>%
  arrange(desc(response_rate))

print(response_summary)

I always include the total_sent count. Why? Because a 100% response rate is meaningless if you only sent the email to two people. Always keep the sample size in sight.

How can I tell if a difference in response rates is actually significant or just random noise?

You'll see this happen all the time: the 'Homeowner' segment has a 4.2% response rate and the 'Renter' segment has 3.8%. It looks better, but is it statistically better? You can't just eyeball this. Since we're dealing with proportions, I usually reach for prop.test().

Here is how I'd compare two specific groups from our garden campaign:

# Let's pull the numbers for Homeowners vs Renters
homeowner_resps <- sum(campaign_data$responded[campaign_data$segment == "Homeowner"])
homeowner_total <- sum(campaign_data$segment == "Homeowner")

renter_resps <- sum(campaign_data$responded[campaign_data$segment == "Renter"])
renter_total <- sum(campaign_data$segment == "Renter")

# Run the proportion test
test_result <- prop.test(x = c(homeowner_resps, renter_resps), 
                         n = c(homeowner_total, renter_total))

print(test_result$p.value)

If that p-value is below 0.05, you can feel reasonably confident that the difference is real. If it's higher, I'd tell my stakeholders that the segment difference is likely just noise and not a reliable lever for future campaigns.

What's the best way to model which factors actually drove the response?

Once you've found that a segment differs, you usually want to know why. Maybe it's not just the segment, but a combination of age, previous spend, and the time of day the email was sent. For binary outcomes (Yes/No), linear regression is out; you need Logistic Regression using glm().

I like to use the binomial family here. It gives us the log-odds of a response, which we can then interpret.

# Modeling response based on age, total_spend, and segment
response_model <- glm(responded ~ age + total_spend + segment, 
                      data = campaign_data, 
                      family = "binomial")

summary(response_model)

When you look at the summary, don't get bogged down in the raw coefficients—they're hard to read. Instead, I usually wrap the coefficients in exp() to get the Odds Ratios. An odds ratio of 1.2 for total_spend means that for every unit increase in spend, the odds of responding increase by 20%. That's a number a marketing manager actually understands.




📋 Practical Task

Analyzing the Winter Clearance Campaign Efficiency

You have been handed a dataset winter_campaign_df containing 5,000 rows. The columns are customer_id, age_group ('18-30', '31-50', '51+'), discount_level ('10%', '20%', '30%'), and converted (1 if they bought something, 0 if not).

Your task is to write a script that:

  • Calculates the conversion rate for each discount_level, sorted from highest to lowest.
  • Performs a prop.test to determine if the difference in conversion rates between the '10%' and '30%' discount groups is statistically significant (p < 0.05).
  • Builds a logistic regression model to see if age_group and discount_level are significant predictors of converted.
  • Prints the Odds Ratios for the model coefficients.
Rating
0 0

There are no comments for now.

to be the first to leave a comment.