Show last authors
1
2 This demo pages allows to verify that your configuration is correct. When first accessing this page you will see different results depending on your configration:
3
4 * If you have properly setup "Server Authentication" a form with the list of accounts accessible to the "service account" should be visible
5 * If you have properly setup "Client ID Authentication" a button to authenticate on Google Analytics should be visible. If you click on it and authenticate, then the form with your list of accounts should show up.
6 * If the configuration is incorrect, either an error will display or nothing at all. You might be able to see an error in your Application Server log file or in the Javascript console of your browser
7
8 {{velocity}}
9 {{html clean=false}}
10 <div id="id-container"></div>
11 <div id="view-selector-container"></div>
12 {{/html}}
13
14 {{googleanalytics}}
15 /**
16 * Create a new ViewSelector instance to be rendered inside of an
17 * element with the id "view-selector-container".
18 */
19 var viewSelector = new gapi.analytics.ViewSelector({
20 container: 'view-selector-container'
21 });
22
23 // Render the view selector to the page.
24 viewSelector.execute();
25
26 /**
27 * Create a new DataChart instance with the given query parameters
28 * and Google chart options. It will be rendered inside an element
29 * with the id "chart-container".
30 */
31 var dataChart = new gapi.analytics.googleCharts.DataChart({
32 query: {
33 metrics: 'ga:sessions',
34 dimensions: 'ga:date',
35 'start-date': '30daysAgo',
36 'end-date': 'yesterday'
37 },
38 chart: {
39 container: 'chart-containerGACOUNT',
40 type: 'LINE',
41 options: {
42 width: '100%'
43 }
44 }
45 });
46
47 /**
48 * Render the dataChart on the page whenever a new view is selected.
49 */
50 viewSelector.on('change', function(ids) {
51 var url = "${xwiki.getURL("GoogleAnalytics.MacroDemos")}";
52 $("id-container").innerHTML = "Google Analytics report ID: " + ids + ". To see the macros for this report <a href='" + url + "?id=" + ids + "'>click here</a>.";
53 dataChart.set({query: {ids: ids}}).execute();
54 });
55 {{/googleanalytics}}
56 {{/velocity}}