Skip to content
Duplicate of Next marketing campaign
Where to focus a marketing campaign?
install.packages(c("patchwork", "ggrepel", "showtext", "scales", "knitr", "tidyverse"))
📖 Background
The task it for our team to develop our marketing campaign. The marketing manager wants to target those segments that have donated the most in the past year. We need results for the upcoming meeting with the CEO.
💾 The data
Exploring the data
- "category" - "Sports", "Fashion", "Technology", etc.
- "device" - the type of device used.
- "gender" - gender of the user.
- "age range" - one of five age brackets.
- "amount" - how much the user donated in Euros.
library(tidyverse)
df <- readr::read_csv('./data/crowdfunding.csv')
knitr::kable(df[1:5, ], caption = "Crowdfunding donations")
library(patchwork)
library(ggrepel)
library(showtext)
library(scales)
showtext_auto()
font_add_google('Patrick Hand')
crow <- df %>%
mutate(device2 = case_when(df$device == "android" ~ "Android",
df$device == "iOS" ~ "IOS" ))
💪 Visualization
The top three categories in terms of total donations are games, sports and technology, for all categories, iOS devices provide more than double the donation amount in all categories. The campaign should target our donor base, given that we should take care of our existing customers, since acquiring new donors from other age brackets probably costs more.
#####Main Plot------
main <- crow %>%
group_by(age, category) %>%
summarize(Donation = sum(amount)) %>%
ggplot()+
geom_col(aes(x=fct_reorder(age, desc(Donation)), y=Donation, fill=category),
position="dodge2", alpha=0.8)+
scale_fill_brewer(palette= "PuBuGn")+
coord_polar()+
theme_minimal()+
#Titles and labels
xlab("")+ylab("Amount of Donations")+
labs(title="Donations by Age Bracket")+
scale_y_continuous(labels = scales::number_format(big.mark=","))+
#Annotations
#annotate('text', x = 0.5,y = 110000, label = "76 Goles",color = "black")+
#Theme
theme(legend.title = element_blank(),
legend.position = "bottom",
plot.title= element_text(hjust=0.5, colour = '#18094a'),
axis.text = element_text(face = 'bold', colour = '#334959'),
axis.text.y = element_text(size=14),
axis.title.y = element_text(size=14,hjust= 0.8),
plot.background = element_rect(colour = "white", fill = "white"),
panel.grid = element_line(colour = "grey10", size=0.1, linetype="dotted"))
##### Plot of Top Categories----
#Plot
categories <- crow %>%
group_by(category) %>%
summarise(Donation = sum(amount)) %>%
ggplot()+
geom_col(aes(y = fct_reorder(category, desc(Donation)), x = Donation, fill = category),
position = "dodge2", alpha=0.8)+
#Data Labels
geom_text(aes(y = fct_reorder(category, desc(Donation)), x = Donation,
label = scales::comma(Donation), hjust=-0.3))+
#Theme
scale_fill_brewer(palette= "PuBuGn")+
labs(title = "Donations by Categories")+
ylab("")+ xlab("")+
scale_x_continuous(labels = scales::number_format(big.mark=","), limits = c(0, 250000))+
theme_minimal()+
theme(legend.position= "none",
axis.text = element_text(face = 'bold', colour = '#334959'),
plot.title= element_text(hjust=0.5, colour = '#18094a'),
panel.grid = element_line(colour = "grey10", size=0.1, linetype="dotted"))
##### Plot of Device Differences-----
#Plot
device <- crow %>%
group_by(category, device2) %>%
summarise(Donation = sum(amount)) %>%
ggplot()+
geom_col(aes(x = fct_reorder(category, desc(Donation)), y = Donation, fill = category),
position = "dodge2", alpha=0.8)+
scale_fill_brewer(palette= "PuBuGn")+
facet_grid(~device2)+
coord_polar()+
theme_minimal()+
#Data Labels
labs(title= "Device Distribution")+
xlab("")+ylab("Amount of Donations")+
#Theme
scale_y_continuous(labels = scales::number_format(big.mark=","))+
theme(legend.position = "none",
plot.title= element_text(hjust=0.5, colour = '#18094a'),
panel.grid = element_line(colour = "grey10", size=0.1, linetype="dotted",),
axis.text.y = element_text(face = 'bold', colour = '#334959',hjust= 0.8),
axis.title.y = element_text(size=12,hjust= 0.8),
axis.text.x = element_blank(),
strip.text.x = element_text(size = 12, colour = "black"))
##### Compose Plot-------
Plot_CF <- (main|categories/device)+
plot_layout(guides="collect")+
plot_annotation(title = "Crowdfunding Donations",
subtitle = "A 2020 analysis for marketing segmentation purposes ",
theme = theme(plot.title = element_text(size = 24, hjust = 0.5,
family='Big Shoulders Stencil Display',
color = "black"),
plot.subtitle = element_text(size = 12, hjust = 0.5, family="Dosis",
color = "black"),
plot.caption = element_text(size = 14, colour = '#016450'),
plot.background = element_rect(fill = "white", colour = "white"),
panel.background = element_rect(fill = "white"),
legend.position = "bottom"
))
ggsave("plot.png", Plot_CF, dpi = 200)