Is there a way to filter statistics by the country? Does anyone have a Plugin for this perhaps?
I’m getting inquiries from all around the world and would like to know which country was the moste active every month.
Thanks 
I don’t that exists as yet, traffic by country. It’s been requested a few times but the the answer appears to be use google analytics.
It would be awesome to that feature built directly in discourse through, one stop shop ![]()
I wrote some code in my theme to send events into GA4 (and two other services) that can be filtered by country.
I can post the full file, if anyone wants to drop it in your theme, but it’s kind of messy. Here’s a sample:
api.onAppEvent("topic:created", (post, composerModel) => {
if (post) {
sendPHogEvent("topic_created", {});
sendClickyEvent("#topic_created", "topic_created", "click");
sendGA4Event({
action: "topic_created",
});
}
});
api.onAppEvent("post:created", (post) => {
if (post) {
sendPHogEvent("post_created", {});
sendClickyEvent("#post_created", "post_created", "click");
sendGA4Event({
action: "post_created",
});
}
});
Since I don’t want Google tracking and GDPR questions, I’m currently using https://openpanel.dev/ – it’s pretty nice. Open source & self-hostable, or hosted starting at $2.50/mo.
Interesting. I thought that by adding the GA ID in the discourse settings it would automatically send everything required for GA do all the analytics. Isn’t that the purpose of GA analytics or am I missing something here?
I’m not sure. I just checked and I think I’m manually loading GA. Maybe that feature didn’t exist when I built the site and I missed it?
In any case, I’m sending events into three kinds of analytics.

