# Google Analytics

**URL:** <https://meta.discourse.org/t/google-analytics/74004>\
**Category:** Data & reporting\
**Tags:** analytics\
**Created:** [2017 年 11 月 13 日午後 6:02 UTC](https://meta.discourse.org/t/google-analytics/74004 "2017-11-13T18:02:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Bas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bas/32/294929_2.png) [@Bas](https://meta.discourse.org/u/Bas)\
**Post date:** [2017 年 11 月 22 日午前 9:48 UTC](https://meta.discourse.org/t/google-analytics/74004/4 "2017-11-22T09:48:56Z")

</div>

Ah, that’ll require some json and Google app script trickery 🙂

You can get the data in json from here: [https://meta.discourse.org/about.json](https://meta.discourse.org/about.json)

Here’s an example: [https://docs.google.com/spreadsheets/d/1eR6JX7r28nkoOTM-A0eLdFIDFwEn0vYpm9RJTtrO5cg/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1eR6JX7r28nkoOTM-A0eLdFIDFwEn0vYpm9RJTtrO5cg/edit?usp=sharing)

Use this (or prettier, this is just a quick fix) code in the google script:

```javascript
function discourseStats(url) {
  var url = url||'https://meta.discourse.org';
  url = url + '/about.json';
  var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
  var data = JSON.parse(response);
  var stats = data.about.stats; 
  var array = []
  for (key in stats){
    array.push([key, stats[key]])
  } 
  return array;
}

```

---

_[View the full topic](https://meta.discourse.org/t/google-analytics/74004)._
