library(knitr)
library(tidyverse)
library(lubridate)
library(DT)
library(ggplot2)
AW <- read.csv("AdWords.csv", header = T, stringsAsFactors = F)
FB <- read.csv("Facebook.csv", header = T, stringsAsFactors = F)

Google Analytics

DC <- read.csv("DoubleClick.csv", header = T, stringsAsFactors = F)
DC$Date <- as.Date(DC$Date, format = "%m/%d/%Y")
DC <- DC %>% mutate(Week = format(Date, format = "%W"))
DC$Week <- as.numeric(DC$Week)
Dates <- seq(as.Date("2017/8/22"), by = "week", length.out = 12)
Week <- seq(33,44,length.out = 12)
Time <- cbind.data.frame(Dates, Week)
DC <- inner_join(DC, Time)
DC <- DC %>% rename(WeekStarting = Dates)
DCDBM <- DC %>% group_by(WeekStarting, Medium) %>% summarise(Clicks = sum(Clicks), Impressions = sum(Impressions), CTR = round((Clicks/Impressions)*100,2))

kable(GA)
WeekStarting Medium Bounces Entrances AverageDuration BounceRate
2017-07-11 Display 0 2 0.28 0.0000000
2017-07-18 Display 2 2 0.00 1.0000000
2017-07-25 Display 2 20 11.26 0.1000000
2017-08-01 Display 2 2 0.00 1.0000000
2017-08-15 Display 4 6 0.18 0.6666667
2017-08-22 Display 102 171 3.82 0.5964912
2017-08-29 Display 122 231 2.60 0.5281385
2017-08-29 Video 8 31 8.83 0.2580645
2017-09-05 Display 108 125 1.42 0.8640000
2017-09-12 Display 106 151 0.86 0.7019868
2017-09-12 Video 8 8 0.00 1.0000000
2017-09-19 Display 171 228 2.61 0.7500000
2017-09-19 Video 2 6 1.21 0.3333333
2017-09-26 Display 176 225 7.01 0.7822222
2017-09-26 Video 10 10 0.00 1.0000000
2017-10-03 Display 155 232 3.42 0.6681034
2017-10-03 Video 8 14 1.86 0.5714286
2017-10-10 Display 141 207 7.01 0.6811594
2017-10-10 Video 14 18 0.04 0.7777778
2017-10-17 Display 109 137 3.09 0.7956204
2017-10-17 Video 14 22 0.43 0.6363636
2017-10-24 Display 139 170 2.85 0.8176471
2017-10-24 Video 0 4 0.00 0.0000000
2017-10-31 Display 136 140 6.65 0.9714286
2017-10-31 Video 2 6 0.76 0.3333333
2017-11-07 Display 134 158 0.06 0.8481013
2017-11-07 Video 4 4 0.00 1.0000000
kable(DCDBM)
WeekStarting Medium Clicks Impressions CTR
2017-08-22 Display 106 139072 0.08
2017-08-29 Display 170 261501 0.07
2017-08-29 Video 9 8822 0.10
2017-09-05 Display 199 313534 0.06
2017-09-05 Video 7 10171 0.07
2017-09-12 Display 853 641473 0.13
2017-09-12 Video 11 8685 0.13
2017-09-19 Display 707 697486 0.10
2017-09-19 Video 21 10607 0.20
2017-09-26 Display 377 568589 0.07
2017-09-26 Video 62 9763 0.64
2017-10-03 Display 340 662908 0.05
2017-10-03 Video 71 16638 0.43
2017-10-10 Display 397 692929 0.06
2017-10-10 Video 72 33705 0.21
2017-10-17 Display 397 651173 0.06
2017-10-17 Video 67 32183 0.21
2017-10-24 Display 452 695514 0.06
2017-10-24 Video 66 37977 0.17
2017-10-31 Display 469 730112 0.06
2017-10-31 Video 79 31773 0.25
2017-11-07 Display 454 756321 0.06
2017-11-07 Video 51 22869 0.22
DDDBM <- left_join(GA, DCDBM)
DDDBM <- DDDBM %>% select(WeekStarting, Medium, Clicks, Impressions, CTR, AverageDuration, BounceRate) %>% mutate(BounceRate = round(BounceRate,2))
kable(DDDBM)
WeekStarting Medium Clicks Impressions CTR AverageDuration BounceRate
2017-07-11 Display NA NA NA 0.28 0.00
2017-07-18 Display NA NA NA 0.00 1.00
2017-07-25 Display NA NA NA 11.26 0.10
2017-08-01 Display NA NA NA 0.00 1.00
2017-08-15 Display NA NA NA 0.18 0.67
2017-08-22 Display 106 139072 0.08 3.82 0.60
2017-08-29 Display 170 261501 0.07 2.60 0.53
2017-08-29 Video 9 8822 0.10 8.83 0.26
2017-09-05 Display 199 313534 0.06 1.42 0.86
2017-09-12 Display 853 641473 0.13 0.86 0.70
2017-09-12 Video 11 8685 0.13 0.00 1.00
2017-09-19 Display 707 697486 0.10 2.61 0.75
2017-09-19 Video 21 10607 0.20 1.21 0.33
2017-09-26 Display 377 568589 0.07 7.01 0.78
2017-09-26 Video 62 9763 0.64 0.00 1.00
2017-10-03 Display 340 662908 0.05 3.42 0.67
2017-10-03 Video 71 16638 0.43 1.86 0.57
2017-10-10 Display 397 692929 0.06 7.01 0.68
2017-10-10 Video 72 33705 0.21 0.04 0.78
2017-10-17 Display 397 651173 0.06 3.09 0.80
2017-10-17 Video 67 32183 0.21 0.43 0.64
2017-10-24 Display 452 695514 0.06 2.85 0.82
2017-10-24 Video 66 37977 0.17 0.00 0.00
2017-10-31 Display 469 730112 0.06 6.65 0.97
2017-10-31 Video 79 31773 0.25 0.76 0.33
2017-11-07 Display 454 756321 0.06 0.06 0.85
2017-11-07 Video 51 22869 0.22 0.00 1.00
ggplot(DDDBM, aes(x = WeekStarting, y = Clicks, group = Medium, color = Medium)) + geom_line(size=1) + theme_bw()  + scale_color_manual(values=c("blue", "orange"))

ggplot(DDDBM, aes(x = WeekStarting, y = Impressions, group = Medium, color = Medium)) + geom_line(size=1) + theme_bw()  + scale_color_manual(values=c("blue", "orange"))

ggplot(DDDBM, aes(x = WeekStarting, y = CTR, group = Medium, color = Medium)) + geom_line(size=1) + theme_bw()  + scale_color_manual(values=c("blue", "orange"))

ggplot(DDDBM, aes(x = WeekStarting, y = AverageDuration, group = Medium, color = Medium)) + geom_line(size=1) + theme_bw() + scale_color_manual(values=c("blue", "orange"))

ggplot(DDDBM, aes(x = WeekStarting, y = BounceRate, group = Medium, color = Medium)) + geom_line(size=1) + theme_bw()  + scale_color_manual(values=c("blue", "orange"))