Title: hit counter code placement
Last modified: August 18, 2016

---

# hit counter code placement

 *  [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/hit-counter-code-placement/)
 * My site counter, Statcounter, says it’s code should be inserted after <body> 
   and before </body> tags. But I don’t see any such tags in the sidebar or main
   templates.
 * Can someone tell me into which template I should insert & where within the template?

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

 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/hit-counter-code-placement/#post-216682)
 * In Default Theme, I believe `<body>` is located in `header.php` and the closing`
   </body>` is in `footer.php`
    So, sidebar should be okay, it does not really matter
   because it won’t be visible from browser, I believe.
 * —-signature—
    Support my campaign [http://wordpress.org/support/topic/22918](http://wordpress.org/support/topic/22918)
 *  Thread Starter [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/hit-counter-code-placement/#post-217477)
 * I placed my statcounter code into my sidebar. But the full sidebar only displays
   on the main pg. Only archives & recent posts display on the individual post pgs.
   So because the statcounter code is not displaying anywhere other than main pg.
   it is only picking up hits on my main pg.
 * Can someone tell me where I should place the code so it counts hits on every 
   pg. I’d prefer inserting the code into only 1 place that would register every
   hit rather than on every pg.
 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/hit-counter-code-placement/#post-217478)
 * Well, you could put it in `header.php`, after the `<body>` tag.
    Or in `footer.
   php`, before the `</body>` tag.
 *  Thread Starter [richards1052](https://wordpress.org/support/users/richards1052/)
 * (@richards1052)
 * [20 years, 10 months ago](https://wordpress.org/support/topic/hit-counter-code-placement/#post-217479)
 * Thanks, it’s in the footer & displaying at the bottom of every pg. Hopefully,
   it will now pick up every hit. I’d noticed since I moved to wp a month ago my
   hits had gone down by 40%. Don’t know whether this is why or whether the googlebot
   hasn’t fully indexed my site.

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

The topic ‘hit counter code placement’ is closed to new replies.

## Tags

 * [body](https://wordpress.org/support/topic-tag/body/)
 * [js](https://wordpress.org/support/topic-tag/js/)
 * [tag](https://wordpress.org/support/topic-tag/tag/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [richards1052](https://wordpress.org/support/users/richards1052/)
 * Last activity: [20 years, 10 months ago](https://wordpress.org/support/topic/hit-counter-code-placement/#post-217479)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
