1. Install the Insert Headers and Footers plugin by WPBeginner. You can do this by going to your WordPress “Plugins” page, clicking “Add New”, and searching for the plugin name.
2. Once installed and activated, in your WordPress menu go to Settings > Insert Headers and Footers.
See the screenshot below for an example: