Visitor Tracker in WordPress (Real-Time Count + Smooth Admin Pop-up)
Published on 25 August 2025
Visitor Tracker in WordPress Want a lightweight way to see how many people are on your site right now—and get a subtle pop-up when someone new arrives? This tutorial gives you a clean PHP snippet you can drop into a snippets plugin. It tracks all visitors, updates counts in real time, and shows a floating pop-up and sticky counter button to administrators.
What you’ll get
- Real-time online visitors count (updates every 5 seconds)
- Smooth pop-up for admins when a new visitor arrives
- Persistent “Online: X” button for quick glance
- Works without heavy analytics plugins
- Uses WordPress transients (no custom tables)
Requirements
- WordPress with jQuery enabled on the front end (default in most themes)
- A snippets plugin like “Code Snippets” or “WPCode”
- Administrator role to see the pop-up and button
Step-by-step setup
- Copy the full code below
- Open your snippets plugin → Add New
- Paste the code, set it to run on the Frontend (and Backend optional), save and activate
- Load any page as an admin—you’ll see the floating online count button in the bottom right