Title: GA code
Last modified: February 7, 2024

---

# GA code

 *  [rjoyner](https://wordpress.org/support/users/rjoyner/)
 * (@rjoyner)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/ga-code-5/)
 * How can I add Google Analytics code the header/php? With astra I used hooks, 
   but don’t see an option like that. And, I’d like to avoid plugin. Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Mohsin Ghouri](https://wordpress.org/support/users/mohsinbsf/)
 * (@mohsinbsf)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/ga-code-5/#post-17425404)
 * Hi [@rjoyner](https://wordpress.org/support/users/rjoyner/),
 * Thanks for getting in touch with us.
 * I am afraid we don’t have any option through which you can add Google Analytics
   code, however, you can add it by using the below code in functions.php
 *     ```wp-block-code
       function add_head_meta() {
        // Put the google analytics code here
       }
       add_action( 'wp_head', 'add_head_meta');
       ```
   
 * I would suggest you to add the code by creating the child theme so that it can
   work even after updates.
 * Have a nice day!
 *  Thread Starter [rjoyner](https://wordpress.org/support/users/rjoyner/)
 * (@rjoyner)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/ga-code-5/#post-17428743)
 * thanks, but that crashed the site. Can you add any other info that may avoid 
   this?
 *  [Mohsin Ghouri](https://wordpress.org/support/users/mohsinbsf/)
 * (@mohsinbsf)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/ga-code-5/#post-17432620)
 * Hi [@rjoyner](https://wordpress.org/support/users/rjoyner/),
 * Sorry for the inconvenience caused to you.
 * I am not able to replicate the issue on my site. I request you open a support
   ticket from here:[https://wpspectra.com/support/](https://wpspectra.com/support/)
   so that our support dev can help better.
 * Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘GA code’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/spectra-one/1.2.1/screenshot.png)
 * Spectra One
 * [Support Threads](https://wordpress.org/support/theme/spectra-one/)
 * [Active Topics](https://wordpress.org/support/theme/spectra-one/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/spectra-one/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/spectra-one/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Mohsin Ghouri](https://wordpress.org/support/users/mohsinbsf/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/ga-code-5/#post-17432620)
 * Status: not resolved