Title: Google Analytics Tracking Code
Last modified: August 30, 2016

---

# Google Analytics Tracking Code

 *  [markf1](https://wordpress.org/support/users/markf1/)
 * (@markf1)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/google-analytics-tracking-code-5/)
 * I have found several references to placing the Google analytics Tracking code
   after the <body> tag. This is contrary Googles instructions that the tracking
   code be put in just before the closing </head> tag.
 * For example from [http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/](http://www.wpbeginner.com/beginners-guide/how-to-install-google-analytics-in-wordpress/):
   
   How to Install Google Analytics in WordPress
 * There are 3 ways to install Google analytics in WordPress. Direct paste, functions.
   php, and plugins.
 * Direct Paste Method
 * Copy the code that you received in Step 4, and paste it in your theme’s header.
   php right after the <body> tag.
 * Can anyone confirm where I should put the trackingg code? Is it OK to have it
   in the <head> tag as google directs?

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

 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/google-analytics-tracking-code-5/#post-6288229)
 * In the head is where _Google Analytics by Yoast_ puts it, so I assume they have
   a very good reason for doing so.
 * That said, the Google Analytics js _does not change in any way how a page loads
   in a browser_, so it could be included in the body.
 * Also, since the next element after the closing head is the opening body tag, 
   I don’t really think it matters.
 * Perhaps you could ask the site referenced why they choose to do so.
 *  Thread Starter [markf1](https://wordpress.org/support/users/markf1/)
 * (@markf1)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/google-analytics-tracking-code-5/#post-6288246)
 * Thanks for your reply and info!

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

The topic ‘Google Analytics Tracking Code’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [markf1](https://wordpress.org/support/users/markf1/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/google-analytics-tracking-code-5/#post-6288246)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
