SELECT COUNT (DISTINCT(user_pseudo_id)) AS total_users
FROM your-project-table
,
UNNEST (event_params) AS event_param
WHERE event_name = 'page_view'
AND event_param.key = 'medium'
AND event_param.value.string_value = 'organic'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googleAnalyticsR) | |
ga_auth(json_file = "C:\\folder-where-your-json-is-located\\service-key.json") | |
account_list$viewId | |
#pls change id | |
id <- 1234567 | |
data <- google_analytics(id, | |
date_range = c("2021-01-01","2021-05-02"), | |
metrics=c("sessions","bounceRate", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
translation <- | |
gl_translate( | |
data$comments, | |
target = "en", | |
format = c("text"), | |
source = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#visualize in ggplot | |
ggplot(R1, aes(channel_name, value, fill = variable)) + | |
geom_bar(stat='identity', position='dodge') + | |
ggtitle('TOTAL CONVERSIONS') + | |
theme(axis.title.x = element_text(vjust = -2)) + | |
theme(axis.title.y = element_text(vjust = +2)) + | |
theme(title = element_text(size = 16)) + | |
theme(plot.title=element_text(size = 20)) + | |
ylab("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean(data_strings_removed$br) | |
sd(data_strings_removed$br) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##geom_histogram | |
ggplot(data=diamonds)+ | |
geom_histogram(mapping=aes(x = carat), | |
binwidth = 0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom JS to get age of user in Adobe Launch | |
var x=_satellite.getVar('dataLayer var: DOB'); | |
var dobYear = x.getFullYear(); | |
var curYear = new Date().getFullYear(); | |
var age = curYear - dobYear; | |
return age; |
#Standard SQL
SELECT
event_date,
COUNT (DISTINCT(user_pseudo_id)) AS user_counts FROM
analyticslog-app-plus-web.analytics_240627631.*
WHERE
event_date BETWEEN '20200801' AND '20200831'
GROUP BY event_date
ORDER BY event_date ASC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gadata %>% | |
group_by(as.factor(dayofWeek)) %>% | |
summarise(Min = min(sessions), | |
Max = max(sessions), | |
Median = median(sessions), | |
IQRange = IQR(sessions)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create boxplot with data | |
boxplot <- ggplot(data,aes(x=channel, | |
y= revPerSessionUSD)) + | |
geom_boxplot()+ | |
ggtitle("Revenue Per Session - For Full Year") | |
#show viz | |
boxplot |