Visitor counter for WordPress
On a self-hosted WordPress the counter goes into a Custom HTML block – in a post, on a page or in the footer widget area. The script works there as long as your user role may post unfiltered HTML, which administrators can.
Step by step
- Pick a design on Stats4U and copy the code from the HTML tab.
- In WordPress open the post, the page or Appearance → Widgets, click + and add a “Custom HTML” block.
- Paste the code into that block – not into a Paragraph block, which shows code as text instead of running it.
- Save or update, then open the published page.
The code
Tab for this platform: HTML
<script src="https://www.stats4u.net/s4u.js"
data-id="12345" data-style="3903" async></script>In this example the counter number is 12345 and the design is a sample. The wizard gives you your own number and the design you pick.
Good to know
- On the free WordPress.com plan, script, iframe and embed are removed from the Custom HTML block without any message. Use the HTML <img> or the Markdown tab there – a plain picture goes through on every plan.
- Without the unfiltered_html capability (an editor on a multisite network, for example) WordPress removes the script tag when saving. The HTML <img> tab works for every role.
Guides for other platforms
- WixEmbed HTML in the Wix Editor or Embed Code in Wix Studio – and why Wix shows a different address in your statistics.
- BloggerThe HTML/JavaScript gadget puts the counter on every page of the blog.
- Google SitesInsert → Embed → Embed code in the new Google Sites.
- chomikuj.plThe profile description accepts pictures but no scripts – so the HTML <img> version goes in.
- GitHub PagesStraight into the HTML file or the Jekyll layout – Markdown pages work too.
- JimdoThe Widget/HTML element in Jimdo Creator – and why the newer Jimdo website builder has no place for it.
- NeocitiesInto the HTML of your page, with 88×31 buttons for your button wall.
- Forums & profilesBBCode for forum signatures and game profiles, HTML <img> where HTML is allowed.