Google Analytics code can be added to the Astra theme with the Astra Hooks plugin. It provides hooks so that you can insert custom code at various locations on the website without editing the theme’s core files. Ensure this plugin is activated on your website.
Please follow the steps to add Google Analytics code-
- From the WordPress dashboard navigate to Appearance > Customizer > Hooks > Header > wp_head.
- Add the code with wp_head action.
- Publish it.