{"id":21043,"date":"2026-10-02T23:18:41","date_gmt":"2026-10-02T21:18:41","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=21043"},"modified":"2026-10-02T23:19:05","modified_gmt":"2026-10-02T21:19:05","slug":"stats4u-wordpress-plugin-how-it-works","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/","title":{"rendered":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests"},"content":{"rendered":"<p>Stats4U is a visitor counter by LW IT Solutions: a small image on the website that counts page views, plus statistics on <a href=\"https:\/\/www.stats4u.net\/\">stats4u.net<\/a> with where visitors came from, time on page, scroll depth and the visitors online right now. No account is needed; the counter number is enough. For WordPress there is a dedicated plugin. It has been listed in the <a href=\"https:\/\/wordpress.org\/plugins\/stats4u\/\">WordPress.org plugin directory<\/a> since 29 September 2026, in version 1.6.0, and its source code is public on <a href=\"https:\/\/github.com\/LW-IT-Solutions\/Stats4U-Wordpress\">GitHub<\/a>.<\/p>\n<p>This post shows how the plugin works: how it reads a pasted counter code, how it places the counter right below the footer of any theme, how it waits for a consent tool, and what the browser then sends to stats4u.net. Everything was measured again on 2 October 2026 on a local test installation with WordPress 7.1.2, PHP 8.4 and Twenty Twenty-Five, using the plugin from the directory. The end covers the way through the WordPress.org review and lists all links.<\/p>\n<h2>From pasted code to counter<\/h2>\n<p>Under \u201cSettings \u2192 Stats4U\u201d, a wizard leads through the setup in five steps: counter, appearance, placement, consent, done. The custom configuration offers all settings on one page instead. The first step takes the code that the creator on stats4u.net produces. There are three ways to get it: an existing code, a button that opens the creator and brings the code back at its end, or a new counter number on request. The last two run from the administrator\u2019s browser, not from the server.<\/p>\n<p>The creator knows several formats, and the plugin accepts all of them. The table shows what <code>stats4u_code_lesen()<\/code> made of twelve inputs:<\/p>\n<table>\n<thead>\n<tr>\n<th>Pasted<\/th>\n<th>Result<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>HTML, image with link<\/td>\n<td>number, design, dark mode and size 150%<\/td>\n<\/tr>\n<tr>\n<td>BBCode<\/td>\n<td>number, design, dark mode<\/td>\n<\/tr>\n<tr>\n<td>Markdown<\/td>\n<td>number, design, language German<\/td>\n<\/tr>\n<tr>\n<td>script code with <code>s4u.js<\/code><\/td>\n<td>number, design, dark mode, counting \u201cunique visitors\u201d, language Polish<\/td>\n<\/tr>\n<tr>\n<td>image address alone<\/td>\n<td>number and design<\/td>\n<\/tr>\n<tr>\n<td>old long form <code>?action=pic&amp;s4uid=\u2026<\/code><\/td>\n<td>number and design<\/td>\n<\/tr>\n<tr>\n<td>the number only, also with <code>#<\/code><\/td>\n<td>number, design unchanged<\/td>\n<\/tr>\n<tr>\n<td>address of the statistics page <code>\/live\/&lt;number&gt;<\/code><\/td>\n<td>number<\/td>\n<\/tr>\n<tr>\n<td>statistics page with a custom name<\/td>\n<td>note: paste the code or the number<\/td>\n<\/tr>\n<tr>\n<td>globe widget <code>globe.js<\/code><\/td>\n<td>note: the plugin shows image counters<\/td>\n<\/tr>\n<tr>\n<td>any other text<\/td>\n<td>note: code not recognised<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>What the page then carries is no longer the image alone but the service\u2019s official script, the same <code>&lt;script src=\"https:\/\/www.stats4u.net\/s4u.js\" data-id=\"\u2026\" async&gt;<\/code> that the creator produces. Up to version 1.4.0, the plugin placed only the image. That was lighter, but with an image from another server a browser sends only the site\u2019s domain, neither the page nor where the visitor came from. Only the script delivers these details, plus time on page, scroll depth and \u201conline now\u201d. A single function decides what stands at the counter\u2019s place:<\/p>\n<pre><code>\/\/ stats4u.php (excerpt)\nfunction stats4u_zaehler_teile($e) {\n    $daten = stats4u_skript_daten($e);\n    if (stats4u_cmp($e) === null) {\n        return array('skript' =&gt; array('src' =&gt; STATS4U_SKRIPT, 'async' =&gt; true) + $daten);\n    }\n    stats4u_wartet(true);\n    return array('platzhalter' =&gt; $daten);\n}\n\nfunction stats4u_html() {\n    $e = stats4u_einstellungen();\n    if ($e['id'] === '') { return ''; }\n    $t = stats4u_zaehler_teile($e);\n    if (isset($t['skript'])) {\n        return '&lt;span class=\"stats4u-zaehler\"&gt;' . trim(wp_get_script_tag($t['skript'])) . '&lt;\/span&gt;';\n    }\n    return '&lt;span class=\"stats4u-zaehler\" data-stats4u=\"' . esc_attr(wp_json_encode($t['platzhalter'])) . '\"&gt;&lt;\/span&gt;';\n}<\/code><\/pre>\n<p>Without a consent tool, this is a script tag built with <code>wp_get_script_tag()<\/code>, which escapes every attribute. With a tool, it is an empty placeholder that carries the counter\u2019s settings as JSON. More on that below.<\/p>\n<h2>Right below the footer of any theme<\/h2>\n<p>By default, the counter appears directly below the theme\u2019s footer. That sounds simple, but WordPress has no hook \u201cafter the footer\u201d. The usual hook, <code>wp_footer<\/code>, sits just before <code>&lt;\/body&gt;<\/code>. Up to version 1.3.0 the counter hung there, and on a page whose <code>body<\/code> is laid out as a flexbox it ended up as a column beside the content, halfway down. Since 1.3.1, the plugin buffers the output from the end of <code>wp_head<\/code>, looks for the footer in the buffer and places the counter behind it. An element counts as the footer if it identifies itself as one:<\/p>\n<pre><code>\/\/ stats4u.php (excerpt)\nfunction stats4u_ist_seitenfuss($name, $tag) {\n    if (preg_match('\/(?&lt;![\\w-])role\\s*=\\s*[\"\\']?contentinfo\\b\/i', $tag)) { return true; }\n    if (preg_match('\/(?&lt;![\\w-])itemtype\\s*=\\s*[\"\\']?[^\"\\'&gt;]*WPFooter\/i', $tag)) { return true; }\n    $namen = array('colophon', 'footer', 'site-footer', 'main-footer', 'page-footer', 'global-footer',\n                   'elementor-location-footer');\n    if ($name === 'footer') { $namen[] = 'wp-block-template-part'; }\n    foreach (array('id', 'class') as $attr) {\n        if (preg_match('\/(?&lt;![\\w-])' . $attr . '\\s*=\\s*(?:\"([^\"]*)\"|\\'([^\\']*)\\'|([^\\s&gt;]+))\/i', $tag, $m)) {\n            $wert = strtolower(($m[1] ?? '') . ($m[2] ?? '') . ($m[3] ?? ''));\n            if (array_intersect(preg_split('\/\\s+\/', trim($wert)), $namen)) { return true; }\n        }\n    }\n    return false;\n}<\/code><\/pre>\n<p>Among several candidates, the last outermost one wins, so that with themes that wrap a <code>&lt;footer&gt;<\/code> in another footer area the counter sits below the whole bar. Without a recognisable footer, the counter goes to the end of the page. Until the script has drawn the image, a CSS rule with <code>:has()<\/code> hides the empty box, so no margin is left as a gap. Since version 1.6.0, the callback of the output buffer does this work; the plugin no longer prints the buffered page itself. That change came from the WordPress.org review.<\/p>\n<p>On the test installation, the counter landed in the described place for every setting. \u201cBelow the footer\u201d put it directly after <code>&lt;\/footer&gt;<\/code>, \u201cinside the footer\u201d just before it, \u201cat the end of the page\u201d before the final scripts. \u201cBelow the content\u201d put it on single pages only, not on the front page. The corners fixed it at the bottom right or left, and \u201cnowhere automatically\u201d left it out. For custom places there are the block \u201cStats4U counter\u201d and the shortcode <code><span class=\"stats4u-zaehler\" data-stats4u=\"{&quot;data-id&quot;:&quot;4189938433&quot;,&quot;data-style&quot;:&quot;950&quot;,&quot;data-params&quot;:&quot;form=pill&amp;pal=ocean&amp;dark=auto&quot;,&quot;data-lang&quot;:&quot;en&quot;}\"><\/span><\/code>, in a template as <code>do_shortcode( '<span class=\"stats4u-zaehler\" data-stats4u=\"{&quot;data-id&quot;:&quot;4189938433&quot;,&quot;data-style&quot;:&quot;950&quot;,&quot;data-params&quot;:&quot;form=pill&amp;pal=ocean&amp;dark=auto&quot;,&quot;data-lang&quot;:&quot;en&quot;}\"><\/span>' )<\/code>. Block and shortcode on the same page gave two counters, the block with its own alignment.<\/p>\n<h2>Only after consent<\/h2>\n<p>A site with a consent tool selects it in the fourth step. The list has 27 entries: 25 tools, CookieYes additionally in its legacy mode, and the WP Consent API, plus any tool that blocks scripts through attributes of its own. The counter\u2019s place then holds an empty <code>span<\/code> with the settings in <code>data-stats4u<\/code>. At the end of the page sits a small release script that the tool runs only after consent and that then puts the official <code>s4u.js<\/code> into every placeholder. Measured, it looked like this:<\/p>\n<table>\n<thead>\n<tr>\n<th>Tool<\/th>\n<th>Release script in the HTML<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Complianz<\/td>\n<td><code>&lt;script type=\"text\/plain\" data-category=\"statistics\"&gt;<\/code><\/td>\n<\/tr>\n<tr>\n<td>Cookiebot<\/td>\n<td><code>&lt;script type=\"text\/plain\" data-cookieconsent=\"statistics\"&gt;<\/code><\/td>\n<\/tr>\n<tr>\n<td>consented.eu<\/td>\n<td><code>&lt;script type=\"text\/plain\" data-consented=\"stats4u\"&gt;<\/code><\/td>\n<\/tr>\n<tr>\n<td>CookieYes<\/td>\n<td><code>&lt;script data-cookieyes=\"cookieyes-analytics\" src=\"\u2026\/freigabe.js\"&gt;<\/code><\/td>\n<\/tr>\n<tr>\n<td>WP Consent API<\/td>\n<td>inline script that asks <code>wp_has_consent()<\/code> and listens for changes<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In none of these cases did <code>s4u.js<\/code> appear directly in the HTML. For tools that release only scripts with an address of their own, such as CookieYes, the plugin includes the file <code>freigabe.js<\/code>. With the WP Consent API, the script first checks whether a consent type is set at all, because without a type <code>wp_has_consent()<\/code> returns <code>true<\/code> even after a refusal. For a tool that is not in the list, custom attributes can be entered. Only <code>type<\/code>, <code>class<\/code> and <code>data-*<\/code> get through:<\/p>\n<pre><code>\/\/ stats4u.php (excerpt)\nfunction stats4u_eigene_attribute($roh) {\n    $aus = array('type' =&gt; 'text\/plain');\n    if (preg_match_all('\/([a-zA-Z][a-zA-Z0-9_.:-]*)\\s*=\\s*(?:\"([^\"]*)\"|\\'([^\\']*)\\'|([^\\s\"\\'&gt;]+))\/', (string) $roh, $m, PREG_SET_ORDER)) {\n        foreach ($m as $a) {\n            $name = strtolower($a[1]);\n            if (!preg_match('\/^(data-[a-z0-9_.:-]+|class|type)$\/', $name)) { continue; }\n            $wert = $a[2] !== '' ? $a[2] : ((isset($a[3]) &amp;&amp; $a[3] !== '') ? $a[3] : ($a[4] ?? ''));\n            $aus[$name] = substr(preg_replace('\/[^A-Za-z0-9 _.:\\\/,#-]\/', '', $wert), 0, 80);\n        }\n    }\n    return $aus;\n}<\/code><\/pre>\n<p>An entered <code>onload=\"alert(1)\"<\/code> was missing from the output; what remained was <code>type=\"text\/plain\"<\/code> and <code>data-category=\"statistics\"<\/code>.<\/p>\n<figure class=\"lw-diagram\">\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/wp-stats4u-plugin-en.png?v=20261002\" width=\"1120\" height=\"580\" alt=\"From pasted code to counted visit\"><figcaption>The Stats4U plugin places the official counter script where chosen; counting happens in the browser, and the WordPress server never contacts stats4u.net<\/figcaption><\/figure>\n<h2>What the browser sends to stats4u.net<\/h2>\n<p>For this measurement, a Chrome with a fresh profile paused every request. Only the script file <code>s4u.js<\/code> itself was allowed to load. Every other request to stats4u.net was logged and then aborted, so no test count reached the service. The page stayed open for 70 seconds, then the browser navigated away.<\/p>\n<table>\n<thead>\n<tr>\n<th>When<\/th>\n<th>Request<\/th>\n<th>Content<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>on load<\/td>\n<td><code>s4u.js<\/code><\/td>\n<td>13,237 bytes transferred, Brotli, cached for an hour, no <code>Set-Cookie<\/code><\/td>\n<\/tr>\n<tr>\n<td>on load<\/td>\n<td><code>action=cfg<\/code>, GET<\/td>\n<td>the counter number only: the counter\u2019s settings<\/td>\n<\/tr>\n<tr>\n<td>on load<\/td>\n<td><code>action=pic<\/code>, image<\/td>\n<td>counter number, design, dark mode, language, page address, referrer and a random number against caching; this request counts<\/td>\n<\/tr>\n<tr>\n<td>after 60 s<\/td>\n<td><code>action=ping<\/code>, POST<\/td>\n<td>the counter number only, for \u201conline now\u201d<\/td>\n<\/tr>\n<tr>\n<td>on leaving<\/td>\n<td><code>action=puls<\/code>, beacon<\/td>\n<td>counter number, page address, visible seconds, scroll depth and load time<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>After loading, the browser held no cookies and nothing in local storage. The script turned the counter into a link to its statistics page, <code>https:\/\/www.stats4u.net\/live\/&lt;number&gt;<\/code>. The service sets this link, not the plugin; a counter set to \u201cnot public\u201d on stats4u.net links to the service\u2019s home page. The WordPress server itself never contacts stats4u.net: the plugin\u2019s code contains not a single HTTP call. The preview on the settings page and in the editor carries the parameter <code>rl=1<\/code> and does not count.<\/p>\n<h2>Multilingual and without full reloads<\/h2>\n<p>When the counter\u2019s language is set to \u201cthe language of each page\u201d, the plugin takes it from the locale of each request. With Polylang, the counter carried <code>data-lang=\"en\"<\/code> on the English front page, <code>de<\/code> on the German one and <code>pl<\/code> on the Polish one. Themes that switch pages without a full reload count only the first page unless they help. For them there is the event <code>s4u:seiteweg<\/code>, which closes the time on the old page, and, after consent, the function <code>window.stats4uAn()<\/code>, which fills new placeholders. This website uses exactly that: it runs Stats4U 1.6.0 with consented.eu, and its page switching without reload fires <code>s4u:seiteweg<\/code> before every swap.<\/p>\n<h2>Through the WordPress.org review<\/h2>\n<p>The first submission was put on hold on 26 September 2026. The review team asked for every value to be escaped at output, including HTML that a function returns, and for no translation files in the package. Version 1.6.0 does both. Every output goes through <code>esc_html()<\/code>, <code>esc_attr()<\/code>, <code>esc_url()<\/code>, <code>wp_kses()<\/code> or <code>wp_print_script_tag()<\/code>, and the callback of the output buffer places the counter below the footer. The 18 translations that shipped in the package up to 1.5.0 now sit in the GitHub repository as templates; translation happens on <a href=\"https:\/\/translate.wordpress.org\/projects\/wp-plugins\/stats4u\/\">translate.wordpress.org<\/a>, and WordPress loads the language packs by itself. On 29 September 2026, the review team approved Stats4U.<\/p>\n<p>On deletion, the plugin removes its option and the remembered view of its settings page. Measured: an option of 236 bytes and the view were present before, both gone afterwards. The counter on stats4u.net and its statistics remain.<\/p>\n<h2>All links<\/h2>\n<ul>\n<li><a href=\"https:\/\/wordpress.org\/plugins\/stats4u\/\">Stats4U in the WordPress.org plugin directory<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/LW-IT-Solutions\/Stats4U-Wordpress\">Source code on GitHub<\/a>, with README and the translation templates<\/li>\n<li><a href=\"https:\/\/translate.wordpress.org\/projects\/wp-plugins\/stats4u\/\">Translation on translate.wordpress.org<\/a><\/li>\n<li><a href=\"https:\/\/www.stats4u.net\/\">stats4u.net<\/a>, with the creator for new counters<\/li>\n<li><a href=\"https:\/\/www.stats4u.net\/privacy-embed\">Paragraph for a site\u2019s own privacy policy<\/a>, per counter number and in 19 languages<\/li>\n<li><a href=\"https:\/\/www.stats4u.net\/terms\">Terms of use<\/a> and <a href=\"https:\/\/www.stats4u.net\/privacy\">privacy policy<\/a> of Stats4U<\/li>\n<\/ul>\n<div class=\"lw-faq\">\n<h2>Questions and answers<\/h2>\n<h3>Does Stats4U set a cookie?<\/h3>\n<p>No. In the measurement with a fresh browser profile, the browser held no cookie and nothing in local storage after loading, and the response with <code>s4u.js<\/code> carried no <code>Set-Cookie<\/code>. As with any request to another server, the browser\u2019s IP address and user agent reach stats4u.net. A suggested paragraph for the privacy policy is at stats4u.net\/privacy-embed.<\/p>\n<h3>What happens if stats4u.net is unreachable?<\/h3>\n<p>Then the counter is missing from the page, and nothing else. The script loads asynchronously and does not hold up the page. Until it has drawn an image, a CSS rule hides the empty box, so no gap is left.<\/p>\n<h3>Do visits in the preview or the editor count?<\/h3>\n<p>No. The preview on the settings page and in the block editor loads only the counter image with the parameter <code>rl=1<\/code>, which means \u201cdisplay only\u201d. Up to version 1.1.0, every look at the settings page counted as a visit; that is fixed.<\/p>\n<h3>Does deleting the plugin also delete the counter?<\/h3>\n<p>No. On deletion, the plugin removes its option and the remembered view of its settings page, and nothing else. The counter on stats4u.net belongs to the site owner and keeps its statistics.<\/p>\n<\/div>\n<div class=\"lw-quellen\">\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/wordpress.org\/plugins\/stats4u\/\" target=\"_blank\" rel=\"noopener noreferrer\">Stats4U 1.6.0 in the plugin directory<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/github.com\/LW-IT-Solutions\/Stats4U-Wordpress\" target=\"_blank\" rel=\"noopener noreferrer\">Stats4U-Wordpress, source code on GitHub<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/plugins\/wordpress-org\/detailed-plugin-guidelines\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress.org: Detailed Plugin Guidelines<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/wordpress.org\/plugins\/wp-consent-api\/\" target=\"_blank\" rel=\"noopener noreferrer\">WP Consent API<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_get_script_tag\/\" target=\"_blank\" rel=\"noopener noreferrer\">wp_get_script_tag()<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_print_inline_script_tag\/\" target=\"_blank\" rel=\"noopener noreferrer\">wp_print_inline_script_tag()<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/www.php.net\/manual\/en\/function.ob-start.php\" target=\"_blank\" rel=\"noopener noreferrer\">PHP: ob_start()<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Navigator\/sendBeacon\" target=\"_blank\" rel=\"noopener noreferrer\">MDN: Navigator.sendBeacon()<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/:has\" target=\"_blank\" rel=\"noopener noreferrer\">MDN: :has()<\/a>, retrieved 02.10.2026<\/li>\n<li><a href=\"https:\/\/www.stats4u.net\/privacy-embed\" target=\"_blank\" rel=\"noopener noreferrer\">Stats4U: paragraph for the privacy policy<\/a>, retrieved 02.10.2026<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Stats4U has been in the WordPress.org plugin directory since 29 September 2026. Measured on a test site: how it reads the counter code, places the counter below any footer, waits for consent and what the browser sends.<\/p>\n","protected":false},"author":1,"featured_media":21049,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[91040,91279,91312,91252,91096],"class_list":["post-21043","post","type-post","status-publish","format-standard","hentry","category-wordpress-plugins-tricks","tag-consent-management","tag-prywatnosc-danych-pl","tag-javascript","tag-web-analytics","tag-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How the Stats4U WordPress plugin works: counter code, placement, consent and requests | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"How the Stats4U plugin reads counter codes, places the counter below any theme footer, waits for consent and what the browser sends. With all links.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How the Stats4U WordPress plugin works: counter code, placement, consent and requests | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"How the Stats4U plugin reads counter codes, places the counter below any theme footer, waits for consent and what the browser sends. With all links.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"-0001-11-30T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-02T21:19:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"How the Stats4U WordPress plugin works: counter code, placement, consent and requests\",\"datePublished\":\"-0001-11-30T00:00:00+00:00\",\"dateModified\":\"2026-10-02T21:19:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/\"},\"wordCount\":1779,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png\",\"keywords\":[\"Consent Management\",\"Data Privacy\",\"JavaScript\",\"Web Analytics\",\"WordPress\"],\"articleSection\":[\"WordPress Plugins &amp; Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/\",\"name\":\"How the Stats4U WordPress plugin works: counter code, placement, consent and requests | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png\",\"datePublished\":\"-0001-11-30T00:00:00+00:00\",\"dateModified\":\"2026-10-02T21:19:05+00:00\",\"description\":\"How the Stats4U plugin reads counter codes, places the counter below any theme footer, waits for consent and what the browser sends. With all links.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png\",\"width\":1200,\"height\":630,\"caption\":\"How the Stats4U WordPress plugin works: counter code, placement, consent and requests\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/wordpress-plugins-tricks\\\/stats4u-wordpress-plugin-how-it-works\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How the Stats4U WordPress plugin works: counter code, placement, consent and requests\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests | Lukas Wojcik","description":"How the Stats4U plugin reads counter codes, places the counter below any theme footer, waits for consent and what the browser sends. With all links.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/","og_locale":"en_US","og_type":"article","og_title":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests | Lukas Wojcik","og_description":"How the Stats4U plugin reads counter codes, places the counter below any theme footer, waits for consent and what the browser sends. With all links.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"-0001-11-30T00:00:00+00:00","article_modified_time":"2026-10-02T21:19:05+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests","datePublished":"-0001-11-30T00:00:00+00:00","dateModified":"2026-10-02T21:19:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/"},"wordCount":1779,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png","keywords":["Consent Management","Data Privacy","JavaScript","Web Analytics","WordPress"],"articleSection":["WordPress Plugins &amp; Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/","name":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png","datePublished":"-0001-11-30T00:00:00+00:00","dateModified":"2026-10-02T21:19:05+00:00","description":"How the Stats4U plugin reads counter codes, places the counter below any theme footer, waits for consent and what the browser sends. With all links.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/fi-21043-stats4u-wordpress-plugin-how-it-works-b.png","width":1200,"height":630,"caption":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/wordpress-plugins-tricks\/stats4u-wordpress-plugin-how-it-works\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How the Stats4U WordPress plugin works: counter code, placement, consent and requests"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/21043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=21043"}],"version-history":[{"count":1,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/21043\/revisions"}],"predecessor-version":[{"id":21058,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/21043\/revisions\/21058"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/21049"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=21043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=21043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=21043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}