library(tidyverse)
library(visdat)
library(GGally)
library(recipes)
library(workflows)
library(parsnip)
library(rsample)
library(yardstick)
library(broom)
library(janitor)
library(gridExtra)
library(cowplot)
library(gt)
library(htmltools)
marketing_campaign <- read_csv('marketing_data.csv')
In today’s competitive business landscape, understanding the impact of marketing efforts is crucial for optimizing resthece allocation and driving customer engagement.
This report presents a comprehensive analysis of recent marketing campaigns, leveraging data-driven insights to assess their performance and identify areas of improvement. By examining key metrics and customer behaviors.
The analysis focuses on several critical aspects:
Customer Demographics: Understanding the characteristics of customers who responded positively to the campaigns
Campaign Performance: Evaluating the success rate of different marketing campaigns
Income Analysis: Investigating the relationship between customer income levels and campaign effectiveness
Purchase Behavior: Analyzing factors that influenced customer purchases following the marketing efforts
This report analyzes marketing campaign data obtained from Kaggle. The dataset used is:
The dataset provides a comprehensive view of various marketing campaign metrics and customer attributes, which will be explored in detail throughout this report.
marketing_campaign$education <- as.factor(marketing_campaign$education)
marketing_campaign$marital_status <- as.factor(marketing_campaign$marital_status)
marketing_campaign$country <- as.character(marketing_campaign$country)
#cleaning the income column
marketing_campaign$income <- gsub("[\\$,]", "", marketing_campaign$income)
marketing_campaign$income <- as.numeric(marketing_campaign$income)
unique(marketing_campaign$country)
## [1] "SP" "CA" "US" "AUS" "GER" "IND" "SA" "ME"
country_lookup <- c("SP" = "Spain",
"CA" = "Canada",
"US" = "United States",
"AUS" = "Australia",
"GER" = "Germany",
"IND" = "India",
"SA" = "South Africa",
"ME" = "Mexico")
marketing_campaign$country_full <- country_lookup[marketing_campaign$country]
marketing_campaign$country_full <- as.factor(marketing_campaign$country_full)
marketing_campaign$dt_customer <- mdy(marketing_campaign$dt_customer)
class(marketing_campaign$dt_customer)
## [1] "Date"
data_date <- mdy("12/31/2023")
marketing_campaign$customer_stay <- interval(marketing_campaign$dt_customer, data_date) / years(1)
marketing_campaign <- marketing_campaign |>
relocate(customer_stay, .after = dt_customer)
marketing_campaign$age <- 2023 - marketing_campaign$year_birth
marketing_campaign <- marketing_campaign |>
relocate(age, .after = year_birth)
#checking for missing values
vis_miss(marketing_campaign)
To handle missing values in the income column, median imputation was applied. This method was chosen as it is less sensitive to extreme values compared to the mean, ensuring that the imputation process does not inflate or distort the central tendency of the data. This approach provides a balanced way to manage missing data while maintaining the integrity of the overall data set for further analysis.
#Impute median given the range of the values
median_income <- median(marketing_campaign$income, na.rm = TRUE)
marketing_campaign$income[is.na(marketing_campaign$income)] <- median_income
vis_miss(marketing_campaign)
#remove unnecessary columns
marketing_campaign <- marketing_campaign |>
select(-id, -year_birth, -country)
The initial exploration of the marketing campaign data revealed several interesting patterns and relationships among different variables.
Bar graphs were used to visualize the distribution of marital status, education levels, and country representation in the dataset. The visualizations provide a clear breakdown of these demographic categories, offering insights into the most common marital statuses, education backgrounds, and country affiliations within the dataset. Any notable trends or disparities are easily observable in the graphs.
The majority of entries in the dataset are from Spain. Most individuals in the dataset are married. Bachelor’s degree is the most common education level among the customers.
In the analysis of the income data from the marketing campaign, a box plot was drawn to visualize the distribution of income across the dataset. This revealed the presence of a few outliers, which may indicate extreme values or anomalies in the data. These outliers can have a significant impact on the analysis, potentially skewing results or misrepresenting trends.
Q1 <- quantile(marketing_campaign$income, 0.25)
Q3 <- quantile(marketing_campaign$income, 0.75)
IQR <- Q3 - Q1
lower_bound <- Q1 - 1.5 * IQR
upper_bound <- Q3 + 1.5 * IQR
outliers <- marketing_campaign$income[marketing_campaign$income < lower_bound |
marketing_campaign$income > upper_bound]
## [1] "Number of outliers: 8"
## [1] "Outlier Values:"
## [1] 157146 160803 666666 162397 157733 153924 156924 157243
marketing_campaign <- marketing_campaign[marketing_campaign$income <= upper_bound, ]
In analyzing the demographics of the participants, two key variables
stand out: age
and income
. Based on a boxplot
analysis, the median age of the participants is approximately 50 years.
While the dataset includes a few outliers representing much older
individuals, they were not excluded from the analysis as their presence
is minimal and does not significantly affect the overall
distribution.
Additionally, the median income of the participants is $51,382, indicating a moderately affluent group. This income level is particularly relevant when analyzing engagement with various marketing campaigns, as participants with higher incomes tend to have more disposable income, which may influence their purchasing decisions and responsiveness to campaigns
Individuals with basic level education reported the lowest incomes. Those with PhD degrees showed the highest incomes. A box plot analysis revealed some extremely high income outliers among PhD holders.
A box plot analysis of income by marital status revealed interesting patterns:
Individuals who identified their marital status as ‘Absurd’ showed the highest median income. Those with a marital status of ‘Alone’ demonstrated the lowest median income.
American customers appear to have higher than average incomes compared to other nationalities in the dataset.
marketing_campaign |>
tabyl(marital_status, education) |>
adorn_totals("col") |>
adorn_percentages("row") |>
adorn_pct_formatting(digits = 2) |>
adorn_ns() |>
adorn_title()
Inferences:
The combination of an older median age and relatively high median income suggests that this demographic may have greater financial stability and thus, more capacity for discretionary spending. This insight could inform how marketing campaigns are tailored, particularly in emphasizing premium products or services.
While there are some significantly older participants, their limited number suggests that they may not skew the overall effectiveness of campaigns, though their unique needs and preferences could warrant specialized marketing efforts.
One of the primary objectives of this analysis was to identify how
customers engage with online purchasing platforms and web-based content.
By evaluating the Num Web Purchases
and
Num Web Visits
columns, I explored technology adoption
patterns.
The median number of web purchases across participants was 4, with some participants making as many as 27 purchases. Interestingly, the data revealed a consistency in web purchases across countries and education levels, with only Germany exhibiting a notably lower median than other countries. This insight highlights the need for targeted digital strategies in specific regions.
A similar trend emerged with web visits, where the median was 6, but with notable outliers. The most surprising finding was that participants with PhDs, often associated with higher income and education levels, had the lowest number of web visits. Meanwhile, those from Australia and Absurd marital status also recorded significantly fewer web visits. These trends reveal varying degrees of digital engagement across different customer segments, shedding light on how marketing strategies can be customized.
A central question in this analysis was: How effective are the marketing campaigns in reaching and converting participants? By examining five distinct campaigns, we observed varying levels of success, both across demographics and education levels.
Campaign 1
had a conversion rate of 6.45%, with married
participants and those with college degrees showing the highest
responsiveness. Conversely, participants with a ‘Basic’ education and
those from Mexico showed no conversions.Campaign 1 Acceptance by Marital Status | ||
marital_status | Not Accepted | Accepted |
---|---|---|
Married | 92.68% | 7.32% |
Together | 94.44% | 5.56% |
Single | 93.54% | 6.46% |
Divorced | 94.81% | 5.19% |
Widow | 93.51% | 6.49% |
Alone | 100.00% | 0.00% |
Absurd | 50.00% | 50.00% |
YOLO | 100.00% | 0.00% |
Campaign 1 Acceptance by Education | ||
education | Not Accepted | Accepted |
---|---|---|
Graduation | 92.70% | 7.30% |
PhD | 93.78% | 6.22% |
Master | 95.12% | 4.88% |
2n Cycle | 93.10% | 6.90% |
Basic | 100.00% | 0.00% |
Campaign 1 Acceptance by Country | ||
country_full | Not Accepted | Accepted |
---|---|---|
Spain | 92.86% | 7.14% |
South Africa | 94.03% | 5.97% |
Canada | 93.26% | 6.74% |
Australia | 95.62% | 4.38% |
India | 95.24% | 4.76% |
Germany | 94.17% | 5.83% |
United States | 93.52% | 6.48% |
Mexico | 100.00% | 0.00% |
Campaign 2
performed poorly, with a conversion rate of
only 1.34%. The most notable group to respond were Divorced participants
and those holding a PhD, while Alone and Absurd marital statuses
remained unresponsive.Campaign 2 Acceptance by Marital Status | ||
marital_status | Not Accepted | Accepted |
---|---|---|
Married | 99.19% | 0.81% |
Together | 97.92% | 2.08% |
Single | 98.96% | 1.04% |
Divorced | 97.84% | 2.16% |
Widow | 98.70% | 1.30% |
Alone | 100.00% | 0.00% |
Absurd | 100.00% | 0.00% |
YOLO | 100.00% | 0.00% |
Campaign 2 Acceptance by Education | ||
education | Not Accepted | Accepted |
---|---|---|
Graduation | 98.58% | 1.42% |
PhD | 97.93% | 2.07% |
Master | 99.46% | 0.54% |
2n Cycle | 99.01% | 0.99% |
Basic | 100.00% | 0.00% |
Campaign 2 Acceptance by Country | ||
country_full | Not Accepted | Accepted |
---|---|---|
Spain | 98.53% | 1.47% |
South Africa | 98.81% | 1.19% |
Canada | 97.75% | 2.25% |
Australia | 100.00% | 0.00% |
India | 98.64% | 1.36% |
Germany | 98.33% | 1.67% |
United States | 100.00% | 0.00% |
Mexico | 100.00% | 0.00% |
Campaign 3
had a higher conversion rate of 7.30%. The
Alone marital status recorded a 33.3% success rate, albeit with a very
small sample size, which skews the result. Surprisingly, participants
with a ‘Basic’ education led the conversion rate across education
levels.Campaign 3 Acceptance by Marital Status | ||
marital_status | Not Accepted | Accepted |
---|---|---|
Married | 92.68% | 7.32% |
Together | 93.58% | 6.42% |
Single | 92.08% | 7.92% |
Divorced | 91.34% | 8.66% |
Widow | 94.81% | 5.19% |
Alone | 66.67% | 33.33% |
Absurd | 100.00% | 0.00% |
YOLO | 100.00% | 0.00% |
Campaign 3 Acceptance by Education | ||
education | Not Accepted | Accepted |
---|---|---|
Graduation | 93.06% | 6.94% |
PhD | 91.70% | 8.30% |
Master | 93.50% | 6.50% |
2n Cycle | 92.61% | 7.39% |
Basic | 88.89% | 11.11% |
Campaign 3 Acceptance by Country | ||
country_full | Not Accepted | Accepted |
---|---|---|
Spain | 92.40% | 7.60% |
South Africa | 93.73% | 6.27% |
Canada | 93.26% | 6.74% |
Australia | 94.38% | 5.62% |
India | 91.16% | 8.84% |
Germany | 91.67% | 8.33% |
United States | 92.59% | 7.41% |
Mexico | 66.67% | 33.33% |
Campaign 4
achieved a conversion rate of 7.48%, with
widows showing a success rate of 12.99%, the highest among marital
statuses. Meanwhile, German participants had the highest success rate
across countries at 9.17%.Campaign 4 Acceptance by Marital Status | ||
marital_status | Not Accepted | Accepted |
---|---|---|
Married | 92.68% | 7.32% |
Together | 92.53% | 7.47% |
Single | 93.12% | 6.88% |
Divorced | 92.21% | 7.79% |
Widow | 87.01% | 12.99% |
Alone | 100.00% | 0.00% |
Absurd | 100.00% | 0.00% |
YOLO | 100.00% | 0.00% |
Campaign 4 Acceptance by Education | ||
education | Not Accepted | Accepted |
---|---|---|
Graduation | 92.79% | 7.21% |
PhD | 90.66% | 9.34% |
Master | 91.60% | 8.40% |
2n Cycle | 95.07% | 4.93% |
Basic | 100.00% | 0.00% |
Campaign 4 Acceptance by Country | ||
country_full | Not Accepted | Accepted |
---|---|---|
Spain | 91.85% | 8.15% |
South Africa | 94.03% | 5.97% |
Canada | 91.01% | 8.99% |
Australia | 96.25% | 3.75% |
India | 92.52% | 7.48% |
Germany | 90.83% | 9.17% |
United States | 94.44% | 5.56% |
Mexico | 100.00% | 0.00% |
Campaign 5
showed Absurd marital status with a success
rate of 50%, albeit with a very small sample size, which skews the
result. Widows and Spanish participants also recorded impressive
conversion rates, while Mexican participants continued to demonstrate
minimal engagement.Campaign 5 Acceptance by Marital Status | ||
marital_status | Not Accepted | Accepted |
---|---|---|
Married | 92.33% | 7.67% |
Together | 92.36% | 7.64% |
Single | 93.54% | 6.46% |
Divorced | 94.37% | 5.63% |
Widow | 89.61% | 10.39% |
Alone | 100.00% | 0.00% |
Absurd | 50.00% | 50.00% |
YOLO | 100.00% | 0.00% |
Campaign 5 Acceptance by Education | ||
education | Not Accepted | Accepted |
---|---|---|
Graduation | 92.35% | 7.65% |
PhD | 91.91% | 8.09% |
Master | 92.41% | 7.59% |
2n Cycle | 95.07% | 4.93% |
Basic | 100.00% | 0.00% |
Campaign 5 Acceptance by Country | ||
country_full | Not Accepted | Accepted |
---|---|---|
Spain | 91.85% | 8.15% |
South Africa | 93.73% | 6.27% |
Canada | 92.13% | 7.87% |
Australia | 91.88% | 8.12% |
India | 95.92% | 4.08% |
Germany | 93.33% | 6.67% |
United States | 95.37% | 4.63% |
Mexico | 100.00% | 0.00% |
The classic RFM (Recency, Frequency, and Monetary value) model is critical in understanding customer behavior. Although direct RFM columns were not part of the dataset, we can infer this analysis by looking at web visits, purchases, and the income levels of participants.
Participants with higher income (such as married Canadians and those with PhDs) generally had more frequent web visits and purchases. Conversely, participants from countries like India and Australia, and those with a ‘Basic’ education, recorded lower interaction rates, indicating that these segments may require further nurturing to increase engagement. Customer stay is another important indicator of loyalty and engagement. Married participants had the longest customer stay, whereas those with a Basic education or Alone marital status had shorter stay durations.
While the dataset did not directly capture the use of open-source tools, customer interaction with digital marketing campaigns may hint at broader adoption trends. For instance, participants more engaged in web-based activities, such as frequent web purchases and visits, are likely to be more tech-savvy. Thus, these segments could be more inclined to use open-source platforms or digital resources.
Insight: PhD holders, often assumed to be early tech adopters, exhibited low web visits. This finding suggests that companies need to better align their digital marketing strategies with this high-potential segment, potentially by offering more personalized and sophisticated online experiences.
Conclusion: Insights to Action The data paints a vivid picture of customer behavior and campaign effectiveness. From technology adoption trends to visitor data handling practices, we can draw several actionable insights:
Regional and educational differences play a significant role in how customers engage with online platforms and respond to marketing campaigns. Certain customer segments, such as married Canadians and PhD holders, consistently demonstrate higher engagement and responsiveness, highlighting their potential as key target markets.
On the flip side, low engagement from participants with Basic education, as well as those from Mexico and Australia, suggests that these groups may benefit from tailored strategies to boost interaction. This analysis not only uncovers what works in current marketing campaigns but also serves as a roadmap for refining strategies and driving higher engagement in future efforts.