Support Forum

Tracking hits on the forum

PS Paul Smith
Paul Smith
Member

I need to add the following code to my site to track hits so that my site can be displayed on another site which ranks all sites in my niche according to popularity. I currently have the code in a WordPress widget but hits on my forum aren’t being tracked. This is affecting my ranking.

I have looked in the help section on the site that displays the ranking about found the following comment…

“Please place only one copy of the image code on each page. If you are using Blogger, WordPress, or something of that ilk, place it on the page template.”

Where do I find the page template and is there any particular part of the template where the following code should be added?

<a href=”http://www.ukwrs.co.uk/index.php?id=788″><img src=”http://www.ukwrs.co.uk/button.php?id=788″></a>

The forum is here…

http://livingonanarrowboat.co.uk/forum/

5 Answers

New Answer

BR Brandon
Brandon
Member

Since the SP header and footer are used on every page I would put it in one of those. Probably the footer file spFoot.php toward the bottom.

You can echo it like this.

echo '<a href="http://www.ukwrs.co.uk/index.php?id=788"><img src="http://www.ukwrs.co.uk/button.php?id=788"></a>';
PS Paul Smith
Paul Smith
Member

Sorry for being a bit of a dimwit, but where do I find the spFoot.php file? Is it just a case of pasting the above code into it?

YS Yellow Swordfish
Yellow Swordfish
Member

You need to be a little careful here. The instruction is actually referring to your WordPress template and this begs the question – have you already used this code for the rest of your site and, if so, where did you put it?

If you want it to count ALL pages of your site – not just the forum views – then it really needs to be placed in your WordPress theme. If you ONLY want to count forum page views then placing it in the forum template – as Brandon suggested above – will be fine.

If the former – then I would suggest the footer.php file in your WP theme and you can edit this in the WP Admin > Themes >Editor.

If the latter then yes – use the spFoot.php which can be found in the /templates folder of the Simple:Press theme you are using and can be edited using the SP theme editor under forum admin > Themes.

I would recommend the former so that you actually track hits to ALL pages on your site. But if you opt for just the forum then as always we recommend that you create your own SP theme so that any customisation is not lost during a future update. (http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/)

PS Paul Smith
Paul Smith
Member

Great information. Thanks for that. I want to track all hits on the site, not just the forum, so I now need to find out how to add the code to the Thesis theme footer. Thank you.

YS Yellow Swordfish
Yellow Swordfish
Member

Well – if you put it within a php code block then as Brandon had it above should work. If outside a php code block – i.e., in an HTML block then remove the echo and the starting and ending quotes.