https://wordpress.org/plugins/code-snippets/
Use this instead of modifying functions.php
- easy, clean and organized.
Alternative - Woody ad snippets – Insert Header Footer Code, AdSense Ads
https://wordpress.org/plugins/insert-php/
Has options to add display logic
code-snippets