简体   繁体   中英

Sending data to google analytics

It is possible to send a data from custom chart to google analytics? I want to pass my data to google analytisc so i can pull the data and merge it to my google analytics chart.

or it is possible to create a custom metrics? and display my custom metrics here for example: Metrics

For example this is my custom chart:

<!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>

You totally can! Have you checked out the data import section in GA? There's some caveats to it but you, but that should tackle everything you're wanting to do.

https://support.google.com/analytics/answer/3191589?hl=en

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM