-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
96 lines (73 loc) · 2.27 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Google Analytics Embed</title>
</head>
<body>
<h1>Video Playback Report</h1>
<!-- Step 1: Create the containing elements. -->
<section id="auth-button"></section>
<h3>Timeline of Videos Played</h3>
<p>This chart shows a timeline of events in the last 14 days with an event category of "BrightCove Player" and an event action of "Media Play."</p>
<br />
<section id="timeline"></section>
<h3>Events Table</h3>
<p>This table shows videos played (event label) in the last 14 days with a category of "BrightCove Player" and an action of "Media Play."</p>
<br />
<section id="events-table"></section>
<!-- Step 2: Load the library. -->
<script>
(function(w,d,s,g,js,fjs){
g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(cb){this.q.push(cb)}};
js=d.createElement(s);fjs=d.getElementsByTagName(s)[0];
js.src='https://apis.google.com/js/platform.js';
fjs.parentNode.insertBefore(js,fjs);js.onload=function(){g.load('analytics')};
}(window,document,'script'));
</script>
<script>
gapi.analytics.ready(function() {
// Step 3: Authorize the user.
var CLIENT_ID = '9729366503-7dgu0eua0rlvpactmr8s0jr6249iqhjl.apps.googleusercontent.com';
var viewId = 'ga:119773904';
gapi.analytics.auth.authorize({
container: 'auth-button',
clientid: CLIENT_ID,
});
// Step 4: Create the timeline chart.
var timeline = new gapi.analytics.googleCharts.DataChart({
reportType: 'ga',
query: {
'ids': viewId,
'dimensions': 'ga:date',
'metrics': 'ga:uniqueEvents',
'start-date': '14daysAgo',
'end-date': 'yesterday',
'filters':'ga:eventCategory=~BrightCove Player;ga:eventAction=~Media Play'
},
chart: {
type: 'LINE',
container: 'timeline'
}
});
timeline.execute();
var eventsTable = new gapi.analytics.googleCharts.DataChart({
reportType: 'ga',
query: {
'ids': viewId,
'dimensions': 'ga:eventAction,ga:eventLabel',
'metrics': 'ga:uniqueEvents',
'start-date': '14daysAgo',
'end-date': 'yesterday',
'filters':'ga:eventCategory=~BrightCove Player;ga:eventAction=~Media Play'
},
chart: {
type: 'TABLE',
container: 'events-table'
}
});
eventsTable.execute();
});
</script>
</body>
</html>