SlideShare a Scribd company logo
100 150 00:01:20
120 300 00:02:15
●
●
●
●
●
●
require(RGoogleAnalytics)
client.id <- "xxxxxxxxxxxx.apps.googleusercontent.com"
client.secret <- "zzzzzzzzzzzz"
token <- Auth(client.id,client.secret)
# Save the token object for future sessions
save(token,file="./token_file")
# Get the Sessions by Month in 2014
query.list <- Init(start.date = "2014-01-01",
end.date = "2014-01-31",
dimensions = "ga:date",
metrics = "ga:sessions",
table.id = "ga:000000")
# Create the Query Builder object
ga.query <- QueryBuilder(query.list)
# Extract the data and store it in a data-frame
ga.data <- GetReportData(ga.query, token)
> head(ga.data)
date sessions
1 20140101 39
2 20140102 46
3 20140103 47
4 20140104 53
5 20140105 49
6 20140106 15
# Get the Sessions by dayOfWeek in 2013
query.list <- Init(start.date = "2013-01-01",
end.date = "2013-12-31",
dimensions = "ga:dayOfWeek,ga:date",
metrics = "ga:sessions",
table.id = "ga:000000")
# Processing Query to ga.data
...
ggplot(data = ga.data, aes(x = dayOfWeek, y = sessions)) +
geom_boxplot()
# Get the Sessions by date in 2013-2015
query.list <- Init(start.date = "2013-01-01",
end.date = "2015-12-31",
dimensions = "ga:date",
metrics = "ga:sessions",
table.id = "ga:000000")
# Processing Query to ga.data
...
# Plot for calendar
calendar_sessions <- ggplot(data, aes(monthweek, weekdayf,
fill = sessions)) +
geom_tile(colour = "white") +
facet_grid(year~monthf) +
scale_fill_gradient(high="#D61818",low="#B5E384") +
labs(title = "Kalendarz") +
xlab("Tydzien miesiaca") +
ylab("")
# View calendar
calendar_sessions
install.packages("devtools")
devtools::install_github("twitter/AnomalyDetection")
library(AnomalyDetection)
# Processing Query to ga.data
...
# Anomaly detection
res = AnomalyDetectionTs(ga.data, max_anoms=0.02,
direction='both', plot=TRUE)
res$plot
...
library(forecast)
...
forecast <- forecast.HoltWinters(forecastmodel, h=26)
# 26 days in future
...
●
●
●
○
●
○
<script>
dataLayer = [{
'level': 'advanced',
'fingerprint' : '123456'
}];
</script>
https://goo.gl/1X84fY
# Get the Sessions by Month in 2014
query.list <- Init(start.date = "2014-01-01",
end.date = "2014-12-31",
dimensions = "ga:dimension01,
ga:contentGroup01",
metrics = "ga:contentGroupUniqueViews01",
table.id = "ga:000000")
# Create the Query Builder object
ga.query <- QueryBuilder(query.list)
# Extract the data and store it in a data-frame
ga.data <- GetReportData(ga.query, token)
> head(ga.data)
Beginner Intermediate Advanced
191352 0 2 42
990977 0 4 32
770561 0 4 48
898022 0 5 21
277510 0 6 31
644227 0 6 44
# K-Means Cluster Analysis
fit <- kmeans(ga.data, 3) # 3 clusters
...
# Append cluster assignment
data.fit <- data.frame(ga.data, fit$cluster)
head(data.fit)
> data.fit
Beginner Intermediate Advanced fit.cluster
266876 9 45 4 1
965265 9 51 7 1
...
981924 19 10 8 2
732529 19 16 1 2
...
377795 2 7 38 3
918083 2 8 28 3
> fit$centers
Beginner Intermediate Advanced
1 7.011765 38.42353 5.023529 # level: intermediate
2 25.530435 10.06087 4.713043 # level: beginner
3 3.628571 5.90000 32.657143 # level: advanced
# 3d chart
install.packages("plotly")
library(plotly)
result <- data.frame(df, fit$cluster)
plot_ly(result, x = result$level1, y = result$level2, z =
result$level3, type = "scatter3d", mode = "markers",
color=factor(result$fit.cluster))
Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.
Google Analytics + R. Praktyczne przykłady.

More Related Content

Similar to Google Analytics + R. Praktyczne przykłady.

Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Dan Robinson
 
Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015
Johann de Boer
 
Seeking the truth from mobile analytics
Seeking the truth from mobile analyticsSeeking the truth from mobile analytics
Seeking the truth from mobile analytics
Mouhcine El Amine
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
Ludmila Nesvitiy
 
OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...
OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...
OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...
Altinity Ltd
 
Cómo usar google analytics
Cómo usar google analyticsCómo usar google analytics
Cómo usar google analytics
Paradigma Digital
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
Rubén Martínez
 
D3.js - A picture is worth a thousand words
D3.js - A picture is worth a thousand wordsD3.js - A picture is worth a thousand words
D3.js - A picture is worth a thousand words
Apptension
 
Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...
Miguel González-Fierro
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attribute
Richard Martens
 
MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
supergigas
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
Paradigma Digital
 
AdWords Scripts and MCC Scripting
AdWords Scripts and MCC ScriptingAdWords Scripts and MCC Scripting
AdWords Scripts and MCC Scripting
marcwan
 
Javascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and SinonJavascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and Sinon
Lars Thorup
 
SQL PASS 2017 - Building one million predictions per second using SQL Server ...
SQL PASS 2017 - Building one million predictions per second using SQL Server ...SQL PASS 2017 - Building one million predictions per second using SQL Server ...
SQL PASS 2017 - Building one million predictions per second using SQL Server ...
Amit Banerjee
 
2019 WIA - Data-Driven Product Improvements
2019 WIA - Data-Driven Product Improvements2019 WIA - Data-Driven Product Improvements
2019 WIA - Data-Driven Product Improvements
Women in Analytics Conference
 
Simplify Feature Engineering in Your Data Warehouse
Simplify Feature Engineering in Your Data WarehouseSimplify Feature Engineering in Your Data Warehouse
Simplify Feature Engineering in Your Data Warehouse
FeatureByte
 
Metrics stack 2.0
Metrics stack 2.0Metrics stack 2.0
Metrics stack 2.0
Dieter Plaetinck
 
Google
GoogleGoogle
Google
soon
 
Connecting Your Customers – Building Successful Mobile Games through the Powe...
Connecting Your Customers – Building Successful Mobile Games through the Powe...Connecting Your Customers – Building Successful Mobile Games through the Powe...
Connecting Your Customers – Building Successful Mobile Games through the Powe...
Amazon Web Services
 

Similar to Google Analytics + R. Praktyczne przykłady. (20)

Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
 
Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015Digital analytics with R - Sydney Users of R Forum - May 2015
Digital analytics with R - Sydney Users of R Forum - May 2015
 
Seeking the truth from mobile analytics
Seeking the truth from mobile analyticsSeeking the truth from mobile analytics
Seeking the truth from mobile analytics
 
Protractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applicationsProtractor framework – how to make stable e2e tests for Angular applications
Protractor framework – how to make stable e2e tests for Angular applications
 
OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...
OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...
OSA Con 2022 - Building Event Collection SDKs and Data Models - Paul Boocock ...
 
Cómo usar google analytics
Cómo usar google analyticsCómo usar google analytics
Cómo usar google analytics
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 
D3.js - A picture is worth a thousand words
D3.js - A picture is worth a thousand wordsD3.js - A picture is worth a thousand words
D3.js - A picture is worth a thousand words
 
Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...Running Intelligent Applications inside a Database: Deep Learning with Python...
Running Intelligent Applications inside a Database: Deep Learning with Python...
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attribute
 
MCC Scripts update
MCC Scripts updateMCC Scripts update
MCC Scripts update
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 
AdWords Scripts and MCC Scripting
AdWords Scripts and MCC ScriptingAdWords Scripts and MCC Scripting
AdWords Scripts and MCC Scripting
 
Javascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and SinonJavascript unit testing with QUnit and Sinon
Javascript unit testing with QUnit and Sinon
 
SQL PASS 2017 - Building one million predictions per second using SQL Server ...
SQL PASS 2017 - Building one million predictions per second using SQL Server ...SQL PASS 2017 - Building one million predictions per second using SQL Server ...
SQL PASS 2017 - Building one million predictions per second using SQL Server ...
 
2019 WIA - Data-Driven Product Improvements
2019 WIA - Data-Driven Product Improvements2019 WIA - Data-Driven Product Improvements
2019 WIA - Data-Driven Product Improvements
 
Simplify Feature Engineering in Your Data Warehouse
Simplify Feature Engineering in Your Data WarehouseSimplify Feature Engineering in Your Data Warehouse
Simplify Feature Engineering in Your Data Warehouse
 
Metrics stack 2.0
Metrics stack 2.0Metrics stack 2.0
Metrics stack 2.0
 
Google
GoogleGoogle
Google
 
Connecting Your Customers – Building Successful Mobile Games through the Powe...
Connecting Your Customers – Building Successful Mobile Games through the Powe...Connecting Your Customers – Building Successful Mobile Games through the Powe...
Connecting Your Customers – Building Successful Mobile Games through the Powe...
 

More from Michal Brys

Find signal in noise.
Find signal in noise.Find signal in noise.
Find signal in noise.
Michal Brys
 
Poznaj lepiej użytkowników Twojego serwisu z Google Analytics
Poznaj lepiej użytkowników Twojego serwisu z Google AnalyticsPoznaj lepiej użytkowników Twojego serwisu z Google Analytics
Poznaj lepiej użytkowników Twojego serwisu z Google Analytics
Michal Brys
 
Google Tag Manager - first steps
Google Tag Manager - first stepsGoogle Tag Manager - first steps
Google Tag Manager - first steps
Michal Brys
 
Online dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure CampOnline dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure Camp
Michal Brys
 
A/B testing. Content experiments in Google Analytics
A/B testing. Content experiments in Google AnalyticsA/B testing. Content experiments in Google Analytics
A/B testing. Content experiments in Google Analytics
Michal Brys
 
Google tools for data analyst
Google tools for data analystGoogle tools for data analyst
Google tools for data analyst
Michal Brys
 
Google Analytics: dowiedz się więcej o użytkownikach swojego serwisu www
Google Analytics: dowiedz się więcej o użytkownikach swojego serwisu wwwGoogle Analytics: dowiedz się więcej o użytkownikach swojego serwisu www
Google Analytics: dowiedz się więcej o użytkownikach swojego serwisu www
Michal Brys
 
Odkrywanie wzorców zachowań użytkowników Internetu.
Odkrywanie wzorców zachowań użytkowników Internetu.Odkrywanie wzorców zachowań użytkowników Internetu.
Odkrywanie wzorców zachowań użytkowników Internetu.Michal Brys
 

More from Michal Brys (8)

Find signal in noise.
Find signal in noise.Find signal in noise.
Find signal in noise.
 
Poznaj lepiej użytkowników Twojego serwisu z Google Analytics
Poznaj lepiej użytkowników Twojego serwisu z Google AnalyticsPoznaj lepiej użytkowników Twojego serwisu z Google Analytics
Poznaj lepiej użytkowników Twojego serwisu z Google Analytics
 
Google Tag Manager - first steps
Google Tag Manager - first stepsGoogle Tag Manager - first steps
Google Tag Manager - first steps
 
Online dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure CampOnline dashboard using Google Analytics API Measure Camp
Online dashboard using Google Analytics API Measure Camp
 
A/B testing. Content experiments in Google Analytics
A/B testing. Content experiments in Google AnalyticsA/B testing. Content experiments in Google Analytics
A/B testing. Content experiments in Google Analytics
 
Google tools for data analyst
Google tools for data analystGoogle tools for data analyst
Google tools for data analyst
 
Google Analytics: dowiedz się więcej o użytkownikach swojego serwisu www
Google Analytics: dowiedz się więcej o użytkownikach swojego serwisu wwwGoogle Analytics: dowiedz się więcej o użytkownikach swojego serwisu www
Google Analytics: dowiedz się więcej o użytkownikach swojego serwisu www
 
Odkrywanie wzorców zachowań użytkowników Internetu.
Odkrywanie wzorców zachowań użytkowników Internetu.Odkrywanie wzorców zachowań użytkowników Internetu.
Odkrywanie wzorców zachowań użytkowników Internetu.
 

Recently uploaded

“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 

Recently uploaded (20)

“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 

Google Analytics + R. Praktyczne przykłady.

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. 100 150 00:01:20 120 300 00:02:15
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30. require(RGoogleAnalytics) client.id <- "xxxxxxxxxxxx.apps.googleusercontent.com" client.secret <- "zzzzzzzzzzzz" token <- Auth(client.id,client.secret) # Save the token object for future sessions save(token,file="./token_file")
  • 31.
  • 32. # Get the Sessions by Month in 2014 query.list <- Init(start.date = "2014-01-01", end.date = "2014-01-31", dimensions = "ga:date", metrics = "ga:sessions", table.id = "ga:000000") # Create the Query Builder object ga.query <- QueryBuilder(query.list) # Extract the data and store it in a data-frame ga.data <- GetReportData(ga.query, token)
  • 33. > head(ga.data) date sessions 1 20140101 39 2 20140102 46 3 20140103 47 4 20140104 53 5 20140105 49 6 20140106 15
  • 34.
  • 35. # Get the Sessions by dayOfWeek in 2013 query.list <- Init(start.date = "2013-01-01", end.date = "2013-12-31", dimensions = "ga:dayOfWeek,ga:date", metrics = "ga:sessions", table.id = "ga:000000") # Processing Query to ga.data ... ggplot(data = ga.data, aes(x = dayOfWeek, y = sessions)) + geom_boxplot()
  • 36.
  • 37. # Get the Sessions by date in 2013-2015 query.list <- Init(start.date = "2013-01-01", end.date = "2015-12-31", dimensions = "ga:date", metrics = "ga:sessions", table.id = "ga:000000") # Processing Query to ga.data ...
  • 38. # Plot for calendar calendar_sessions <- ggplot(data, aes(monthweek, weekdayf, fill = sessions)) + geom_tile(colour = "white") + facet_grid(year~monthf) + scale_fill_gradient(high="#D61818",low="#B5E384") + labs(title = "Kalendarz") + xlab("Tydzien miesiaca") + ylab("") # View calendar calendar_sessions
  • 39.
  • 40. install.packages("devtools") devtools::install_github("twitter/AnomalyDetection") library(AnomalyDetection) # Processing Query to ga.data ... # Anomaly detection res = AnomalyDetectionTs(ga.data, max_anoms=0.02, direction='both', plot=TRUE) res$plot
  • 41.
  • 43.
  • 44.
  • 45.
  • 47.
  • 48.
  • 49.
  • 51. <script> dataLayer = [{ 'level': 'advanced', 'fingerprint' : '123456' }]; </script> https://goo.gl/1X84fY
  • 52.
  • 53.
  • 54. # Get the Sessions by Month in 2014 query.list <- Init(start.date = "2014-01-01", end.date = "2014-12-31", dimensions = "ga:dimension01, ga:contentGroup01", metrics = "ga:contentGroupUniqueViews01", table.id = "ga:000000") # Create the Query Builder object ga.query <- QueryBuilder(query.list) # Extract the data and store it in a data-frame ga.data <- GetReportData(ga.query, token)
  • 55. > head(ga.data) Beginner Intermediate Advanced 191352 0 2 42 990977 0 4 32 770561 0 4 48 898022 0 5 21 277510 0 6 31 644227 0 6 44
  • 56. # K-Means Cluster Analysis fit <- kmeans(ga.data, 3) # 3 clusters ... # Append cluster assignment data.fit <- data.frame(ga.data, fit$cluster) head(data.fit)
  • 57. > data.fit Beginner Intermediate Advanced fit.cluster 266876 9 45 4 1 965265 9 51 7 1 ... 981924 19 10 8 2 732529 19 16 1 2 ... 377795 2 7 38 3 918083 2 8 28 3
  • 58. > fit$centers Beginner Intermediate Advanced 1 7.011765 38.42353 5.023529 # level: intermediate 2 25.530435 10.06087 4.713043 # level: beginner 3 3.628571 5.90000 32.657143 # level: advanced
  • 59. # 3d chart install.packages("plotly") library(plotly) result <- data.frame(df, fit$cluster) plot_ly(result, x = result$level1, y = result$level2, z = result$level3, type = "scatter3d", mode = "markers", color=factor(result$fit.cluster))