# הוסף איסוף מדדים אוטומטי עם Zapier

**URL:** https://meta.discourse.org/t/add-automated-metrics-collection-with-zapier/52519
**Category:** Administrators
**Tags:** how-to, tasks, zapier
**Created:** [4 בנובמבר,‏ 2016,‏ 8:04pm UTC](https://meta.discourse.org/t/add-automated-metrics-collection-with-zapier/52519 "2016-11-04T20:04:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![slagle](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@slagle](https://meta.discourse.org/u/slagle)
#### Post date: [4 בנובמבר,‏ 2016,‏ 8:04pm UTC](https://meta.discourse.org/t/add-automated-metrics-collection-with-zapier/52519/1 "2016-11-04T20:04:05Z")

</div>

Hey guys and gals!

I wanted to share with you all a way that I have been using to automate our metrics collection. I am using Zapier to do all of it and it has greatly simplified my life. 🙂

Anyways, since Zapier allows Multi-Step" zaps I am able to make a call into our site and pull json for each of the metrics I care about and then add them straight to a Google Sheets spreadsheet using Zapier. I then usee Google Data Studio to display the results.

Zapier has a action called “Code by Zapier” that allows you to run some short NodeJS scripts that can do anything you want really. So I use it to make a get request to the JSON pages for each of the metrics I track.

It looks something like this:

```
fetch('https://YOUR_ROOT_SITE_HERE/admin/reports/visits.json?api_key=YOUR_API_KEY_HERE')
  .then(function(res) {
    return res.json();
  })
  .then(function(json) {
    callback(null, json.report.data[json.report.data.length - 2]);
  })
  .catch(callback);

```

I then am able to take the data from the response and put it into a google sheet. Pretty simple really. 🙂

* * *

Here are my code samples for each metric that I pull. Each one pulls the previous day’s data.

**User Visits:**

```
fetch('https://YOUR_ROOT_SITE_HERE/admin/reports/visits.json?api_key=YOUR_API_KEY_HERE')
  .then(function(res) {
    return res.json();
  })
  .then(function(json) {
    callback(null, json.report.data[json.report.data.length - 2]);
  })
  .catch(callback);

```

**New Sign-Ups:**

```
fetch('https://YOUR_ROOT_SITE_HERE/admin/reports/signups.json?api_key=YOUR_API_KEY_HERE')
  .then(function(res) {
    return res.json();
  })
  .then(function(json) {
    callback(null, json.report.data[json.report.data.length - 2]);
  })
  .catch(callback);

```

**New Topics:**

```
fetch('https://YOUR_ROOT_SITE_HERE/admin/reports/topics.json?api_key=YOUR_API_KEY_HERE')
  .then(function(res) {
    return res.json();
  })
  .then(function(json) {
    callback(null, json.report.data[json.report.data.length - 2]);
  })
  .catch(callback);

```

**New Posts:**

```
fetch('https://YOUR_ROOT_SITE_HERE/admin/reports/posts.json?api_key=YOUR_API_KEY_HERE')
  .then(function(res) {
    return res.json();
  })
  .then(function(json) {
    callback(null, json.report.data[json.report.data.length - 2]);
  })
  .catch(callback);

```

---

<div class="post-metadata">

### Author: ![DiscourseMetrics](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discoursemetrics/32/55756_2.png) [@DiscourseMetrics](https://meta.discourse.org/u/DiscourseMetrics)
#### Post date: [19 בינואר,‏ 2017,‏ 2:20pm UTC](https://meta.discourse.org/t/add-automated-metrics-collection-with-zapier/52519/2 "2017-01-19T14:20:31Z")

</div>

Awesome!

Check out [DiscourseMetrics](https://www.discoursemetrics.com) if you’re insterested in a similar solution, but with a nice dashboard UI, weekly/monthly reports+++.

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [21 בינואר,‏ 2017,‏ 2:10pm UTC](https://meta.discourse.org/t/add-automated-metrics-collection-with-zapier/52519/3 "2017-01-21T14:10:33Z")

</div>

A post was split to a new topic: [DiscourseMetrics.com privacy policy?](https://meta.discourse.org/t/discoursemetrics-com-privacy-policy/56121)

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [23 ביוני,‏ 2017,‏ 1:35pm UTC](https://meta.discourse.org/t/add-automated-metrics-collection-with-zapier/52519/4 "2017-06-23T13:35:57Z")

</div>

> [@slagle](#):
>
> fetch(‘https://YOUR\_ROOT\_SITE\_HERE/admin/reports/visits.json?api\_key=YOUR\_API\_KEY\_HERE’)

How do I achieve this with discourse behind a reverse proxy (outer NGINX)? It seems like this fetch request is not making it through to the docker container:

 ![](https://global.discourse-cdn.com/meta/original/3X/0/e/0eecde6479e974ae3b466543ad517df277af3868.png)

Or am I wrong in assuming that this has so far been tested only with the basic setup, i.e. without a reverse proxy in front of the discourse container?
