2016-09-19 150 views
0

有可能從自定義圖表發送數據到谷歌分析? 我想將我的數據傳遞給谷歌analytisc,所以我可以拉數據並將其合併到我的谷歌分析圖表。發送數據到谷歌分析

或者有可能創建一個自定義指標?這裏展示我的自定義指標,例如:Metrics

例如,這是我的自定義圖表:

<!DOCTYPE html> 
<html> 
<body> 

<div id="chart_div"></div> 

<script> 

function drawChart() { 
    var data1 = new google.visualization.DataTable(); 
    data1.addColumn('number', 'X'); 
    data1.addColumn('number', 'Y 1'); 

    data1.addRows([ 
     [1, 3], 
     [2, 6], 
     [5, 5], 
     [6, 8], 
     [8, 2], 
     [9, 5], 
     [10, 5], 
     [12, 4], 
     [13, 8] 
    ]); 

    var data2 = new google.visualization.DataTable(); 
    data2.addColumn('number', 'X'); 
    data2.addColumn('number', 'Y 2'); 

    data2.addRows([ 
     [1, 5], 
     [3, 1], 
     [4, 3], 
     [5, 9], 
     [6, 4], 
     [8, 5], 
     [9, 7], 
     [11, 7], 
     [16, 3] 
    ]); 

    var joinedData = google.visualization.data.join(data1, data2, 'full', [[0, 0]], [1], [1]); 

    var chart = new google.visualization.LineChart(document.querySelector('#chart_div')); 
    chart.draw(joinedData, { 
     height: 300, 
     width: 600, 
     interpolateNulls: true 
    }); 
} 
google.load('visualization', '1', {packages:['corechart'], callback: drawChart}); 
</script> 
</body> 
</html> 

回答