How can I add a analytics script into the header of my community?

Hi,

I am trying to add analytics script to the header.

Forum is installed without any additional themes. On themes tab it shows “No Items”, on Components tab it shows “Default”.

I tried in “Default” components edit “CSS/HTML” and add script to “head” section, but it does not reflect that code on the forum…

Any thoughts?

1 Like

Is it possible that under the Themes tab it shows No Items … so how can I edit default template ? :confused:

2 Likes

Hello Andrew! Welcome here :smiley: :wave:t5:

Are you trying to add Google Analytics or Plausible? If it is a different Analytics provider, you can use a theme component to include the Analytics code in the head part of your theme.

For info on theme components and how to create them, see here: Beginner's guide to using Discourse Themes as a primer.

If you are looking to add GA or Plausible, we have some topics on those already, see here: Setup Google Tag Manager for Analytics - howto / admins - Discourse Meta and Push custom events to Google Tag Manager and Analytics - howto / admins - Discourse Meta and Add Plausible Analytics tracking to Discourse.

1 Like

I have the same issue. Under Themes it shows “No Items” so I cannot add any components to a theme because I dont seem to have one. I read the Beginners guide to using Discourse Themes, however there seem to be themes installed already. I dont have any.

To start off with a theme, you need to install it, have you tried doing that? Check out How do I install a Theme or Theme Component? for info on how to do that.

2 Likes