The Metatags Contributed Module in Drupal provides users with the ability to insert various meta tags into their web pages. However, in certain situations, it may be necessary to alter metatags to improve website performance. To accomplish this, three hooks can be utilized to modify or change incoming metatags.
1. hook_metatags_alter:
Modify/Alter the meta tags for both content and non-content entities.
2. hook_metatags_attachments_alter:
Alter the meta tags for any page prior to the page attachment.