Filter statistics by country

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 :smiley:

1 Like

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 :slight_smile:

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.


1 Like