How to use API to pull metrics from Discourse into Google Analytics?


(Kate M) #1

Hello all — I am not a developer, so please forgive any ignorance, but I am looking to determine if it’s possible to use the Discourse API or webhooks to pull metrics Discourse is tracking in my community forum into Google Analytics and/or Google Data Studio? Specifically, I want to track new topics, new replies, new users and cumulative users. Thanks in advance for any help!


(Sam Saffron) #2

You can pull topic listings off the API and you can even run custom reports if needed using data explorer.

A great place to start would be to create an admin api key and then, for example, look at /admin/reports/topics when clicking refresh in chrome dev tools you will see it hits:

/admin/reports/topics.json?start_date=2017-07-11&end_date=2017-08-10&category_id=all&group_id=&_=1502472121727

So you can use that particular endpoint to get topic stats (you can similarly get user stats and so on)


(Chris Handy) #3

I’d be interested in collaborating with someone on the how to: on this. I’m not sure I understand what to do, but tracking these events is something I’d really like to do. I’m a cowboy coding marketing guy with enough chops to follow docs but not to figure it out on my own.


(Kate M) #4

Thanks for the help @sam!