| 开发者 | lwitsolutions |
|---|---|
| 更新时间 | 2026年10月1日 01:29 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[stats4u].By default right below your theme's footer: behind the element that the theme
marks as its site footer (<footer>, role="contentinfo", site-footer,
the footer part of a block theme, an Elementor footer ...). Tested with
Twenty Twenty-Four and -Five, Astra, GeneratePress, Hello Elementor, Kadence,
Neve, OceanWP and themes whose page body is a flex or grid container. If a
theme has no recognisable footer, the counter goes to the end of the page.
You can also choose "inside the footer", "below the content of posts and
pages", a fixed corner, or place it yourself with the block or the shortcode.
Write <?php echo do_shortcode( '[stats4u]' ); ?> where it should appear -
in footer.php, for example. A shortcode typed into a PHP file as plain text is
not processed. Set Where to show it to "nowhere automatically", otherwise the
counter appears twice. The settings page shows the same line under
Placement.
Up to version 1.4.0 the plugin used the image alone. It was lighter, but your statistics got almost nothing from it: a browser sends only your site's domain along with an image from another server, not the page, and nothing about where the visitor came from or how long they stayed. The script sends the page and the referrer with every count and adds time on page, scroll depth and the "online now" figure.
The script sets no cookie and stores nothing on the device; what it sends is listed under External services. Which duties apply to your site is a question for your jurisdiction; a description for your privacy policy is at https://www.stats4u.net/privacy-embed. If your site uses a consent tool anyway, choose it under Consent and the counter waits for the visitor's consent.
If it supports the WP Consent API, choose that. If it blocks scripts that
carry a certain attribute, choose "another tool" and enter what it wants on
such a script, for example type="text/plain" data-category="statistics".
Tools that decide per service (Usercentrics, Klaro!, Real Cookie Banner, Axeptio, consented.eu, Civic) need Stats4U as a service in their own settings. Create it in the statistics category and enter its name under Category or service - the settings page tells you which name it expects. Until the service exists, those tools never release the counter.
With a consent tool, visitors who decline are not counted - so yes, the
numbers will be lower than without one. The same happens with optimisation
plugins that hold back JavaScript until the first click or scroll: visitors
who do neither are not counted. Exclude stats4u.net/s4u.js there.
Then the counter counts the first page only, unless the theme lets the
Stats4U script run again for each new page - the way the navigation of
stats4u.net itself does: before swapping the page, fire the event
s4u:seiteweg on document (it closes the time on the old page), and
afterwards insert the counter's script tag again. With a consent tool,
window.stats4uAn() fills new placeholders after the swap; it exists only
once the visitor agreed.
Create or change it on stats4u.net and paste the new code - or use "Create a free counter on stats4u.net": when you come back, the settings page shows the new design at once, and Save Changes puts it on your site. The plugin keeps your placement and consent settings; only the counter changes. Pasting just a number keeps the design and changes only the counter.
Your server does not. Your browser loads the preview image on the settings page and in the block editor, marked so that it is not counted.
Then the counter is missing from your page, and nothing else. The script loads asynchronously and does not hold up your page.
The Stats4U script links every counter to its statistics page, so visitors can click through to your numbers - the same on every site that uses the code from stats4u.net. If your statistics should stay private, set the counter to "not public" on stats4u.net: the link then goes to the Stats4U home page instead of your numbers.
No. Deleting the plugin removes its option and the remembered view of its settings page from your database, and nothing else. The counter belongs to you and keeps its history - your numbers should not disappear because you tried a plugin and removed it again.
data-private, data-alias and data-screen from a pasted script code are
kept.