Introduction

Regork is always seeking new ways to boost revenue, and one powerful tool at its disposal is using coupons to drive sales. However, the effectiveness of coupons varies widely across different customer segments, meaning that marketing resources may be inefficiently allocated without a clear understanding of which demographics respond best. By analyzing Regork’s internal data, including customer transactions, demographics, and coupon redemptions, we can gain key insights into which household segments find coupons most valuable. This analysis will allow the CEO to make better-informed decisions about where to focus marketing efforts, ultimately increasing sales, improving customer satisfaction, and maximizing the return on marketing investments. Based on these findings, we will recommend refining coupon strategies for key demographics and exploring alternative strategies for less responsive groups.

Packages and Libraries Used

The libraries and packages we used include:

library(completejourney)
## Welcome to the completejourney package! Learn more about these data
## sets at http://bit.ly/completejourney.
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
library(ggplot2)
library(lubridate)
library(viridis)
## Loading required package: viridisLite

Data Import, Cleaning, and Merging

We imported and merged multiple datasets, including transactions, demographics, and coupon redemptions. These datasets were linked using key identifiers like household_id and campaign_id. We cleaned the data by checking for missing values in critical fields such as transaction timestamps, household information, and campaign data. To ensure consistency, we created new variables like campaign_start_month, campaign_end_month, and transaction_month, which allowed us to track customer interactions with campaigns over time. Merging these datasets enabled us to assess how customer segments respond to coupon campaigns and which demographic groups demonstrate the highest engagement.

transactions <- get_transactions()
promotions <- get_promotions()
products <- products
demographics <- demographics
coupons <- coupons
coupon_redemptions <- coupon_redemptions
campaign_descriptions <- campaign_descriptions
campaigns <- campaigns

household_campaign <- inner_join(demographics, campaigns, by = "household_id")


household_campaign <- inner_join(campaign_descriptions, household_campaign, "campaign_id")
household_campaign <- inner_join(transactions, household_campaign, "household_id", relationship = "many-to-many")


household_campaign <- household_campaign %>%
  mutate(campaign_start_month = month(start_date, label = FALSE)) %>%
  mutate(campaign_end_month = month(end_date, label = FALSE)) %>%
  mutate(transaction_month = month(transaction_timestamp, label = FALSE))

Transactions Completed by Household Income and Campaign type

To better track campaign engagement, we created new variables such as campaign_start_month, campaign_end_month, and transaction_month. These allowed us to analyze the timing of transactions and campaign performance over specific periods. Additionally, we visualized how different income groups respond to various campaign types (Type A, B, and C) by calculating total transactions completed by household income.

campaigntype <- household_campaign %>%
  ggplot(aes(x = income, fill = campaign_type)) +
  geom_bar() +
  scale_y_continuous() +
  labs(
    x = "Household Income",
    y = "Transactions Completed",
    fill = "Campaign Type",
    title = "Transactions Completed by Household Income and Campaign Type",
    subtitle = "Determining which campaigns are most effective based on household income."
  ) +
  theme_minimal() +  # Optional: Use a minimal theme for a cleaner look
  theme(axis.text.x = element_text(angle = 45, hjust = 1))  

campaigntype

This chart reveals that middle-income households, particularly those earning between 50K and 74K, generate the highest number of transactions. Type A campaigns, which offer personalized coupon recommendations, are especially effective for this income group. While Type B and C campaigns also drive engagement, Type A consistently leads across most income segments, emphasizing the importance of personalized promotions.

Coupon Redemption Rate by Income and Household Size

We introduced the coupon_redemption_rate variable, which was calculated by dividing the number of coupon redemptions by total transactions for each income and household size combination. This metric helped uncover which groups engage most with coupon-based promotions.

heatmapdata <- merge(demographics, coupon_redemptions, by = "household_id") %>%
  merge(transactions, by = "household_id")

heatmapdata_2 <- heatmapdata %>%
  group_by(income, household_size) %>%
  summarize(
    coupon_redemptions = n(),
    total_transactions = n_distinct(basket_id),
    .groups = 'drop'
  ) %>%
  mutate(coupon_redemption_rate = coupon_redemptions / total_transactions * 100)

heatmap <- ggplot(heatmapdata_2, aes(x = income, y = household_size, fill = coupon_redemption_rate)) +
  geom_tile() +
  scale_fill_viridis(option = "plasma", name = "Coupon Redemption Rate (%)") +
  labs(x = "Income", 
       y = "Household Size", 
       title = "Coupon Redemption Rate by Income and Household Size")+
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

heatmap

This heatmap highlights that households with 3 members and an income between 150K and 174K exhibit the highest coupon redemption rates. Larger households (5+ members) with lower incomes also have strong coupon engagement, particularly benefiting from personalized campaigns. However, wealthier households (earning over 200K) show less engagement with coupons, indicating that they may respond better to different marketing strategies beyond discounts.

#Coupon Redemptions Over Time Based on Income We introduced the variable redemptions, which represents the total number of coupon redemptions grouped by income bracket and month. This variable helps us analyze trends in coupon usage over time for different income demographics.

household_redemptions <- coupon_redemptions %>%
  left_join(demographics, by = "household_id") %>%
  mutate(month = factor(month(redemption_date), levels = 1:12, labels = month.abb))

household_redemptions_grouped <- household_redemptions %>%
  group_by(income, month) %>%
  summarise(redemptions = n())
## `summarise()` has grouped output by 'income'. You can override using the
## `.groups` argument.
household_redemptions_grouped <- household_redemptions_grouped %>%
  drop_na(income)

custom_palette <- c("#E41A1C", "#4DAF4A", "#377EB8", "#FF0199", "#FF7F00", "#00FFFF",
                    "#A65628", "#984EA3", "#000080", "#808000", "#800080", "#008080",
                    "#C0C0C0")

redemptionsovertime <- household_redemptions_grouped %>%
  ggplot(aes(x = month, y = redemptions, color = income, group = income)) +  # Added group = income
  geom_line() +
  scale_color_manual(values = custom_palette) +
  labs(
    x = "Redemption Month",
    y = "Total Redemptions",
    fill = "Income",
    title = "Coupon Redemptions Over Time Based on Income",
    subtitle = "Determining which campaigns have been more popular throughout the year in varying income demographics."
  ) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

redemptionsovertime

The graph reveals significant redemption spikes for the 50K–74K bracket, especially around May, August, and November. These peaks suggest that households within these income ranges are particularly responsive to promotions during these months, likely coinciding with seasonal campaigns or sales events. On the other hand, income groups below 25K and those above 250K show consistently lower engagement with coupon redemptions across the year, indicating less responsiveness to discount-based marketing strategies. This information can guide marketers to focus coupon-driven campaigns more on middle-income groups and explore alternative promotions for other segments.

Key Findings and Recommendations

The analysis shows that middle-income households (particularly those earning 50K–74K) respond most to Type A campaigns, leading to the highest number of transactions, while households with 3 members earning between 150K and 174K have the highest coupon redemption rates. Larger households with lower incomes also engage strongly with coupon-based promotions. Additionally, the line graph reveals significant seasonal spikes in coupon redemptions for households earning 50K–74K, particularly around May, August, and November, suggesting responsiveness to seasonal promotions. In contrast, households earning below 25K and above 250K show consistently lower engagement with coupons, indicating that discount-based strategies may not be as effective for these groups. Based on these insights, Regork should focus its coupon-driven campaigns on middle-income households during key promotional months, while refining personalized campaigns for the 35K–45K and 125K–175K income groups. Additionally, alternative strategies such as loyalty programs or premium discounts should be explored for lower- and higher-income segments that are less responsive to coupons.

Conclusion

In conclusion, this analysis provided valuable insights into the effectiveness of coupon campaigns across different income demographics. Middle-income households, particularly those earning 35K–45K, and households with 3 members in the 125K–175K income range were found to be the most responsive to personalized and coupon-driven campaigns. Seasonal trends also play a crucial role, with coupon redemptions peaking during specific months like April, July, and November. However, lower-income households (under 25K) and higher-income households (over 250K) demonstrated less engagement with coupon promotions, suggesting that alternative marketing strategies should be considered for these segments. By implementing these findings, Regork can enhance its marketing efficiency by focusing on high-response demographics, tailoring campaigns to specific times of the year, and diversifying promotions for less responsive groups to boost overall sales and customer satisfaction.

Limitations and Future Work

One limitation of this analysis is that it primarily focuses on income and household size as the main demographic factors, potentially overlooking other important variables like age, geographic location, or shopping behaviors, which could further influence coupon redemption patterns. Additionally, the analysis does not account for external factors such as economic conditions, competitive promotions, or seasonal effects beyond the observed months. Future work could involve expanding the dataset to include these variables, as well as investigating coupon usage across different product categories to refine targeting strategies further. Analyzing the effectiveness of non-coupon-based promotions, such as loyalty rewards or membership programs, would also provide insights into how Regork can engage segments like high-income households that respond less to traditional coupons. Moreover, evaluating the long-term impact of coupon campaigns on customer retention could offer a more comprehensive understanding of promotion-driven customer loyalty.