Title: Google analytics code &#8211; where to enter it
Last modified: March 26, 2018

---

# Google analytics code – where to enter it

 *  [secretfocus](https://wordpress.org/support/users/secretfocus/)
 * (@secretfocus)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/google-analytics-code-where-to-enter-it/)
 * Havihg problem placing the <meta name=”google etc…….. into the theme head section,
   header.php. to verify my site on webmaster tools.
 * I get the pop up: “Unable to communicate back with site to check for fatal errors,
   so the PHP change was reverted. You will need to upload your PHP file change 
   by some other means, such as by using SFTP”.
 * At this point I am lost. Any help would be welcome.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fgoogle-analytics-code-where-to-enter-it%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [saurabh.dhariwal](https://wordpress.org/support/users/saurabhdhariwal/)
 * (@saurabhdhariwal)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/google-analytics-code-where-to-enter-it/#post-10115434)
 * Hello secretfocus,
 * You have to add that google analystics into **header.php** file between <head
   > tag.
 * Example.
 *     ```
       <head>
       	<?php
       	/**
       	 * Hook - photo_perfect_action_head.
       	 *
       	 * @hooked photo_perfect_head -  10
       	 */
       	do_action( 'photo_perfect_action_head' );
       	?>
   
       	<?php wp_head(); ?>
       	<meta name=”google etc……
       </head>
       ```
   
 * or
 * Add below code into your current active theme’s **functions.php** file
 *     ```
       function google_analytics_code() {
       	?>
       	<meta name=”google etc……
       	<?php
       }
   
       add_action('photo_perfect_action_head', 'google_analytics_code');
       ```
   
 * **Note : All Changes you done in ****funtions.php or header.php** or other file
   are gone when you update theme. So prefer [Child Theme](https://codex.wordpress.org/Child_Themes)
 * Hope this will helps you.
 * Thanks !

Viewing 1 replies (of 1 total)

The topic ‘Google analytics code – where to enter it’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/photo-perfect/2.2.1/screenshot.
   png)
 * Photo Perfect
 * [Support Threads](https://wordpress.org/support/theme/photo-perfect/)
 * [Active Topics](https://wordpress.org/support/theme/photo-perfect/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/photo-perfect/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/photo-perfect/reviews/)

## Tags

 * [google verification](https://wordpress.org/support/topic-tag/google-verification/)

 * 1 reply
 * 2 participants
 * Last reply from: [saurabh.dhariwal](https://wordpress.org/support/users/saurabhdhariwal/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/google-analytics-code-where-to-enter-it/#post-10115434)
 * Status: not resolved