Purchase and install StopTheMadness in the Mac App Store.
Open the Extensions tab of the Preferences window in Safari.
The "Enable Safari Extension…" command in StopTheMadness does this automatically.
Otherwise, you can open Safari manually and select "Preferences…" from the "Safari" menu in the main menu bar.
In the Extensions tab of the Safari Preferences window, check the box next to StopTheMadness to enable it.
If you're having trouble enabling the extension in Safari Preferences because the checkboxes don't respond to clicks, please see the Apple support document on this subject. For more details, see my article Safari bug: can't enable extensions on Catalina.
You only need to enable StopTheMadness once in Safari, and then it will remain enabled permanently. It will remain enabled even after you install new versions of StopTheMadness and Safari. If you ever need to disable StopTheMadness, just uncheck the box in Safari Preferences.
StopTheMadness preferences can be set in Safari by clicking the StopTheMadness icon in the toolbar of a Safari window. See Safari Support for more information. You don't need to keep the StopTheMadness app open, because Safari loads the StopTheMadness extension automatically.