Custom javascript in <head> disappear

Discourse Version: 2.4.1

i updated discourse to the latest version,then i found some javascript added in <head> doesn’t show in html source
for example,the google analytics script was added in edit CSS/HTLM

Why does this happen,i’m very confused

if i make the <script> wrong ,such as <script123> , then those code will show

if i change it back to normal <script>, disappear again

It does not “disappear” it’s still there. What happens is that we pull all inline scripts and put them in one file for your theme.

discourse/theme_field.rb at master · discourse/discourse · GitHub

So, if you search the page-source for theme-javascript you should see something like this

This file will contain all of your inline scripts.

Also, Discourse has native support for Google Analytics, so why not use that?
Search the settings for Analytics


ok,thanks,i will try it