Adding statcounter code

I added my statcounter code but it appears to not work. Anyone know how to solve this?

No. No one can possibly help answer that question.

If you world like to answer a question that has an answer it should include the following: What did you do? What code did you add. Where did you add it? What happens when you try to run it? What do you do to try to run it? What did you expect to happen?


Let me rephrase: Has anyone got statcounter code working and tracking visitors on their discourse community?

Discourse comes out of the box with a dashboard and reports for various statistics. I believe many also have Google stats.

I see that. But not what I am looking for.

Still trying to get this to work.

This is the code:


Anyone know how I can add it?

You add that code in the </head> section of a theme component. You can read more about that here.

Discourse is a single page application. So, the implementation might differ from the documentation that Statcounter provided. Your implementation has to account for that; otherwise, you’ll only get the stats for the initial page view.

Here’s an example of how we send stats on page transitions for Google analytics (this is built-in, and it only starts working as soon as you add your Google analytics credentials in the admin settings).

You’ll also need to make sure that the scripts from Statcounter are (CSP) allowed either via your theme component or in your site settings.

1 Like