1

Google Analytics provides a server-side API 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.)

1 Answer 1

4

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

1
  • 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
    Oct 25, 2015 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.