<p>I don't know of any off-the-shelf plugins that do it, but it seems like it'd be simple enough to set up, based on existing code.</p>

<p>Craft includes Guzzle which will make calling GA (or any web service) pretty easy. Trevor Davis' <a href="https://github.com/davist11/craft-guzzle" rel="nofollow">craft-guzzle</a> has some code you could use as a starting point.  Just perusing the GA docs, you'll need to do use <code>POST</code> instead of <code>GET</code> but some of plumbing is already done.</p>

CC BY-SA 3.0
2015-10-25T23:40:00.033Z
Good thought; thanks! Currently i can't get any damn analytics even using Cloudflare, which is IN THEORY adding Analytics to every request (but apparently excludes RSS or something?)
adrienne
CC BY-SA 3.0
2015-10-10T00:28:08.867Z
2015-10-10T00:28:08.867Z
RitterKnight
<p>Google Analytics provides a <a href="https://developers.google.com/analytics/devguides/collection/protocol/v1/" rel="nofollow">server-side API</a> for sending data to their servers; this is the generally approved way of tracking views of a page that can't include Javascript, such as an RSS feed. You just send a specially formatted http request to Google's servers when the page is requested.</p>

<p>Has anyone got a plugin or other solution for sending either (a) GA requests specifically or (b) just HTTP requests in general from a Craft template? If so, then I can set that template not to cache, and get at least some rough idea of how many views I've got on the feed. (And if not, I'll break down and write my own plugin, but I'm hoping not to have to.)</p>

<templating><plugins><analytics>
Adding Google Analytics to an RSS feed via server-side tracking?
# Adding Google Analytics to an RSS feed via server-side tracking?

(Asked by: username_0 on 2015-10-09)

Google Analytics provides a [server-side API](https://developers.google.com/analytics/devguides/collection/protocol/v1/) for sending data to their servers; this is the generally approved way of tracking views of a page that can't include Javascript, such as an RSS feed. You just send a specially formatted http request to Google's servers when the page is requested.

Has anyone got a plugin or other solution for sending either (a) GA requests specifically or (b) just HTTP requests in general from a Craft template? If so, then I can set that template not to cache, and get at least some rough idea of how many views I've got on the feed. (And if not, I'll break down and write my own plugin, but I'm hoping not to have to.)

**Tags:** templating, plugins, analytics

---

## 1 answers

### Answer by username_1 on 2015-10-10. Score: 4 | Accepted answer

I don't know of any off-the-shelf plugins that do it, but it seems like it'd be simple enough to set up, based on existing code.

Craft includes Guzzle which will make calling GA (or any web service) pretty easy. Trevor Davis' [craft-guzzle](https://github.com/davist11/craft-guzzle) has some code you could use as a starting point. Just perusing the GA docs, you'll need to do use `POST` instead of `GET` but some of plumbing is already done.

> **Comments:**
> **username_0**: Good thought; thanks! Currently i can't get any damn analytics even using Cloudflare, which is IN THEORY adding Analytics to every request (but apparently excludes RSS or something?)  

---

