library(dplyr)
library(knitr)
library(ggplot2)

Gmail and YouTube

GA <- read.csv("file:///G:/Filemaker Practice/FilemakerGA.csv", header = T, stringsAsFactors = F)
AW <- read.csv("file:///G:/Filemaker Practice/FilemakerAW.csv", header = T, stringsAsFactors = F)
AdWordsJoin <- left_join(AW, GA)
AdWordsJoin$Week.of.Date <- as.Date(AdWordsJoin$Week.of.Date, format = "%d-%b-%y")
AdWordsJoin$Impressions <- as.numeric(gsub(",", "", AdWordsJoin$Impressions))
AdWordsJoin$Time.On.Page <- as.numeric(gsub(",", "", AdWordsJoin$Time.On.Page))
# ggplot(AdWordsJoin, aes(x = Week.of.Date, y = Impressions)) + geom_line(size = 1, color = "darkblue") +facet_wrap(~AD) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))
# ggplot(AdWordsJoin, aes(x = Week.of.Date, y = Unique.Pageviews)) + geom_line(size = 1, color = "darkblue") +facet_wrap(~AD) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))

Facebook & Instagram

FB <- read.csv("file:///G:/Filemaker Practice/FilemakerFB.csv", header = T, stringsAsFactors = F)
FBJoin <- left_join(FB, GA)
FBJoin$Week.of.Date <- as.Date(FBJoin$Week.of.Date, format = "%d-%b-%y")
FBJoin$Impressions <- as.numeric(gsub(",", "", FBJoin$Impressions))
FBJoin$Time.On.Page <- as.numeric(gsub(",", "", FBJoin$Time.On.Page))
# ggplot(FBJoin, aes(x = Week.of.Date, y = Impressions))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))
# ggplot(FBJoin, aes(x = Week.of.Date, y = Unique.Pageviews))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))

Goodway

GW <- read.csv("file:///G:/Filemaker Practice/FilemakerGoodway.csv", header = T, stringsAsFactors = F)

GWJoin <- left_join(GW, GA) 
GWJoin$Week.of.Date <- as.Date(GWJoin$Week.of.Date, format = "%d-%b-%y")
GWJoin$Impressions <- as.numeric(gsub(",", "", GWJoin$Impressions))
GWJoin$Time.On.Page <- as.numeric(gsub(",", "", GWJoin$Time.On.Page))
# ggplot(GWJoin, aes(x = Week.of.Date, y = Impressions))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))
# ggplot(GWJoin, aes(x = Week.of.Date, y = Unique.Pageviews))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))
LI <- read.csv("file:///G:/Filemaker Practice/FilemakerLinkedIn.csv", header = T, stringsAsFactors = F)

LIJoin <- inner_join(LI, GA)

# ggplot(LIJoin, aes(x = Week.of.Date, y = Impressions))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))
# ggplot(LIJoin, aes(x = Week.of.Date, y = Unique.Pageviews))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
#   theme(strip.background =element_rect(fill="#F6A704")) +
#   theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))
vebdors <- read.csv("file:///G:/Filemaker Practice/Vendor.csv", header = T, stringsAsFactors = FALSE)
Joined <- left_join(vebdors, GA)
innerJoined <- inner_join(vebdors, GA) %>% mutate(CTR = round(Clicks/Impressions, 2), Week.of.Date = as.Date(Week.of.Date, format = "%d-%b-%y"))
dim(innerJoined)
## [1] 245  33
dim(Joined)
## [1] 479  32
Joined <- Joined %>% mutate(CTR = round(Clicks/Impressions, 2), Week.of.Date = as.Date(Week.of.Date, format = "%d-%b-%y"))
ggplot(innerJoined, aes(x = Week.of.Date, y = Impressions))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
  theme(strip.background =element_rect(fill="#F6A704")) +
  theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))

ggplot(innerJoined, aes(x = Week.of.Date, y = CTR))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
  theme(strip.background =element_rect(fill="#F6A704")) +
  theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))

ggplot(innerJoined, aes(x = Week.of.Date, y = Unique.Pageviews))+ geom_line(size = 1, color = "darkblue") +facet_wrap(~AD, ncol = 4) + theme_bw() +
  theme(strip.background =element_rect(fill="#F6A704")) +
  theme(strip.text = element_text(colour = 'darkblue', size = 6, face = "bold"))