Title: google analytics &#8211; where to put code?
Last modified: August 18, 2016

---

# google analytics – where to put code?

 *  [motionid](https://wordpress.org/support/users/motionid/)
 * (@motionid)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/)
 * Wanting to use google analytics.
    Wondering where I should put the code so I 
   can see the results. Anyone know? Cheers, Sean.

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

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282930)
 * In header template.
 *  [chaaban](https://wordpress.org/support/users/chaaban/)
 * (@chaaban)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282931)
 * someone just asked this question today …
 * [http://wordpress.org/support/topic/49392](http://wordpress.org/support/topic/49392)
 * also google tell you where to place it :
 * >  Copy the following code block into every webpage you want to track.
   >  Click
   > in the box below to select all code. Next, copy it. Then, paste the code segment
   > after the <head>, <meta> tags and before the </head> tag on each page you are
   > planning to track.
 * in your themes header.php should be fine …
 *  [NuclearMoose](https://wordpress.org/support/users/nuclearmoose/)
 * (@nuclearmoose)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282932)
 * This raises an important point about the structure of WordPress and its theme
   system.
 * If I wanted to use Google Analytics, or any other kind of web service that requires
   a similar call to a remote script, then I have to duplicate the call in all of
   the themes I wish to use. Is there a way to set this up so that I can store my
   links to remote services like this external to the themes? This is too much maintenance
   to bother with, otherwise.
 *  [estjohn](https://wordpress.org/support/users/estjohn/)
 * (@estjohn)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282934)
 * could you put the code itself in a .js file or a php file and have it called 
   somwhere in your header? then when called, would run whateve ryou put in the 
   file whether it is that or another?
 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282935)
 * Too much maintenance if you switch theme everyday. In that case, a plugin that
   utilize the hook `wp_head` can maintain a single source that could be included
   in any active theme.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282939)
 * If you don’t want to edit your theme, try one of these plugins:
 * [http://mycvs.org/archives/2005/11/14/google-analytics-wordpress-plugin/](http://mycvs.org/archives/2005/11/14/google-analytics-wordpress-plugin/)
 * [http://blog.thedt.net/2005/11/14/google-analytics-plugin/](http://blog.thedt.net/2005/11/14/google-analytics-plugin/)

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

The topic ‘google analytics – where to put code?’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 6 replies
 * 7 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/google-analytics-where-to-put-code/#post-282939)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
