We just switched our community to Discourse and I am wondering if it is in some way possible to add custom JS code to the 404 pages as we want to track which old URLs are still visited e.g. add a different/dedicated Google Analytics tracker to these pages.
Mini plugin required for this? Or is there a simpler way?
You can add some JS code that detects if the current page is a 404 (many elements there you can use to detect) and after detection it runs whatever you want. Should be doable in a theme-component.