Sunday, January 9, 2022

Customer Journey Analysis using R-Part 1

Customer Journey Analysis


Introduction

Customers are the single most important entity in any value chain.Everything and anything under the sun is designed to please customer so that they buy products,use medicines/drugs and what not. They are the ones who actually move the needle and hence it is important to understand what is their different touchpoints with the external stimulus.In other words, how exactly they move in their lets say shopping experience helps companies fine tune the touchpoints to better identify selling opportunities.In this blog, we will take a small dummy example to understand how different customers go through the marketing campaigns driven by a company

We will be using ggplot2 and ggalluvial libraries to create the journey plots or the Sankey Charts

package.name<-c("dplyr","ggplot2","ggalluvial")

for(i in package.name){

  if(!require(i,character.only = T)){

    install.packages(i)
  }
  library(i,character.only = T)

}

Creating the Data Set

This is a sample data of 20 customers and how various marketing channels are used to target it

set.seed(42)
individual <- as.character(rep(1:20,each=5))
timeperiod <- paste0(rep(c(0, 18,36,54,72),20),"_week")
Type <- factor(sample(c("Email", "Freebees", "Coupon",  "Freebees","Vouchers"), 100, replace=T))
d <- data.frame(individual, timeperiod, Type)
head(d)
  individual timeperiod     Type
1          1     0_week    Email
2          1    18_week Vouchers
3          1    36_week    Email
4          1    54_week    Email
5          1    72_week Freebees
6          2     0_week Freebees
  • There are 20 customers in this data
  • Each customer is targeted in 0,18,36,54 and 72nd
  • Email,Vouchers,Freebees and Coupons are the channels used to target customers


Creating the Journey Plot

ggplot(d, aes(x = timeperiod, stratum = Type, alluvium = individual, fill = Type, label = Type)) +
  scale_fill_brewer(type = "qual", palette = "Set2") +
  geom_flow(color = "darkgray") +
  geom_stratum() +
  theme(legend.position = "bottom") +
  ggtitle("Channels across observation period")
Warning: The `.dots` argument of `group_by()` is deprecated as of dplyr 1.0.0.


Final Note

We saw how a simple Sankey chart can be used to understand thow external stimulus impacts a customers journey.In the next blog we will look at plotly library and how we can leverage the hovering functionality of the package to create enhanced user experience

My Youtube Channel

3 comments:

  1. 888sport Casino Review & Bonus - DrMCD
    888Sport Casino is operated by 시흥 출장샵 Betsoft Solutions and is 과천 출장마사지 licensed by the Malta 김포 출장샵 Gaming Authority 경주 출장마사지 under the 경상남도 출장샵 Gaming Control (GCCG) Code of Malta. 888Sport Casino

    ReplyDelete
  2. "If your car is making a clicking noise when you turn, it could indicate a problem with your CV joints." pre purchase inspection

    ReplyDelete
  3. IsraFace - израильтяне, это еврейская соцсеть, где зарегистрированы евреи и еврейки и русский еврей из США, Белоруссии. Загружайте классные кадры, видосики, объединяйтесь в сообщества, ведите блог, навещайте форум, начинайте еврейские знакомства.

    ReplyDelete

Web Scraping Tutorial 4- Getting the busy information data from Popular time page from Google

Popular Times Popular Times In this blog we will try to scrape the ...