Hello,

Yes you can add the code my editing the header.php file.

Navigate to Appearance > Editor and select header.php.

Enter the code before the closing tag.

Or you can use a plugin like Yoast SEO which will do all that for you.

Yoast SEO