What is the proper way to add third party script snippets to head tag?
Your issue seems to be related with hook_page_attachments() not called from mytheme.theme file. If you look to the answer, it's written -


  It appears that this function is only callable from a module, as it is
  listed in Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8
  module but not listed as a valid method in Adding stylesheets (CSS)
  and JavaScript (JS) to a Drupal 8 theme.


I verified with the current documentation &amp; that's correct. You can use hook_page_attachments_alter, which has documented in above given document for Adding stylesheets and JS to a Drupal 8 theme.