Track page views reliably using a 1x1 pixel that bypasses caching.
For dashboard widgets, analytics, and data aggregation, see View Tracker Pro.
TYPO3 v13.4 and v14, PHP 8.2 or newer.
Release notes live in CHANGELOG.md.
composer require b13/view-trackerAdd the pixel to your main template, or let a site setting add it to every page (option 3). Make sure to use the localized page ID if you want to track language versions separately.
<img src="/_b13vt?page={data.uid}" style="position: fixed; z-index: -1000;" loading="eager" alt="" />The ViewHelper automatically includes the correct page ID, language, and page type.
It renders a small script that requests the pixel and passes along the host
name of the referring page and the campaign parameters of the current page
(see Privacy), with the plain pixel in a <noscript> fallback. The
plain <img> tag from option 1 cannot know the referring page or the
campaign, so all its views count as "unknown origin" and without campaign in
View Tracker Pro.
<html xmlns:vt="http://typo3.org/ns/B13/ViewTracker/ViewHelpers"
data-namespace-typo3-fluid="true">
<vt:pixel />
</html>The site setting view_tracker.pageTypes adds the same markup as the
ViewHelper before the closing </body> tag of every page of the listed page
types. Import the site set in config/sites/<id>/config.yaml:
dependencies:
- b13/view-trackerThen name the page types in config/sites/<id>/settings.yaml:
view_tracker:
pageTypes: '0'| Value | Pages that get the pixel |
|---|---|
'' (default) |
none, the setting is off |
'0' or '0,7' |
pages of these page types (type parameter, 0 for normal pages) |
'*' |
every HTML page |
The pixel becomes part of the cached page, so pages stay cacheable and a page
served from the cache is counted, too. Translated pages are counted with their
own ID. Responses without a closing </body> tag, such as JSON, XML, or
fragments for AJAX requests, are left alone, and so are page types that set a
content type other than HTML in config.additionalHeaders. A page whose template already
renders <vt:pixel /> keeps that pixel and is not counted twice, unless the
ViewHelper sits in an uncached part of the page (USER_INT, COA_INT); then
use either the ViewHelper or the setting, not both. Flush TYPO3 caches after
changing the value.
View statistics are shown automatically in the header area of each page in the TYPO3 backend. Charts include total views, last 7 / 30 days, last 12 months, and views by page type.
On a detail page, a table below the charts lists the ten records the page showed most since tracking began, such as news articles, with their title, type, and views across all languages of the page. A record deleted since then keeps its views and is marked as deleted. Pages without records show no table. See Records on Detail Pages.
By default, view statistics are not shown for non-content page types (folders, shortcuts, external links, etc.). A configured list replaces the defaults, so repeat them if you only want to add a doktype:
// ext_localconf.php
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['view_tracker']['excludedDoktypes'] = [
PageRepository::DOKTYPE_LINK,
PageRepository::DOKTYPE_SHORTCUT,
PageRepository::DOKTYPE_BE_USER_SECTION,
PageRepository::DOKTYPE_MOUNTPOINT,
PageRepository::DOKTYPE_SPACER,
PageRepository::DOKTYPE_SYSFOLDER,
116,
];By default every backend user that can open the Page module sees the statistics widget. Two site settings narrow that audience. Admins always see the widget regardless of these settings.
Import the site set in your config/sites/<id>/config.yaml:
dependencies:
- b13/view-trackerThen override in config/sites/<id>/settings.yaml:
view_tracker:
pageModuleStatistics:
# Restrict to admin users only — every non-admin loses the widget.
visibleForAdminsOnly: true
# OR keep visibleForAdminsOnly: false and limit by BE user group UIDs.
# Empty (default) means no group restriction.
visibleForGroups: '12,17'Behaviour matrix (non-admin users):
visibleForAdminsOnly |
visibleForGroups |
Non-admin sees widget? |
|---|---|---|
false (default) |
empty (default) | yes — backwards-compatible |
false |
'12,17' |
only if member of group 12 or 17 |
true |
(ignored) | never |
Views are written to the tx_view_tracker_count database table. To store them
elsewhere, implement B13\ViewTracker\Storage\StorageInterface and point the
service b13viewTracker.storage to your class in your own Services.yaml.
For the list of records in the Page module, the storage also implements
B13\ViewTracker\Storage\RecordStatisticsInterface. Without it, the list
does not show.
The middleware listens on /_b13vt by default. The path is deliberately
opaque so common tracker blocklists (EasyPrivacy etc.) don't catch it. If a
blocklist eventually picks it up, override the path per site — both the
middleware and the ViewHelper read from the same site setting.
Import the site set in your config/sites/<id>/config.yaml:
dependencies:
- b13/view-trackerThen override in config/sites/<id>/settings.yaml:
view_tracker:
endpoint: '/_yourpath'After changing the value, flush TYPO3 caches so the ViewHelper re-renders.
A detail page that shows many records, such as news articles, events or
products, would otherwise count as one page. View Tracker also stores which
record the page showed, in the columns record_table and record_uid, so
you can tell which article was read.
The record comes from the arguments of the page's route, when the page is rendered:
- Automatically for every route enhancer argument mapped by a
PersistedAliasMapperwith atableName, the usual setup for detail pages. This covers most extensions without configuration. If the route maps several arguments, such as/{category}/{article}, the last one in the route path counts. - Configured through the site setting
view_tracker.records, astable:argument/path. A configured argument wins over the automatic detection. EXT:news is set up by default:
view_tracker:
records:
- 'tx_news_domain_model_news:tx_news_pi1/news'
- 'tx_shop_domain_model_product:tx_shop_detail/product'Only these arguments count. Pagination and other parameters never create a
record. Without a route enhancer, a configured argument is part of the query
string; it counts only if the URL carries a valid cHash that covers it, as
links generated by TYPO3 do. A hand-written ?tx_news_pi1[news]=… without
cHash renders the page, but counts no record, so nobody can put records
into the statistics, or into the cached page, through the address. Translations count for the record in the default language. To switch
the automatic detection off, set view_tracker.recordDetection: false.
The pixel carries the record with a signature based on the TYPO3
encryptionKey, so the public tracking endpoint cannot be used to count
records the website did not render. A pixel without a valid signature still
counts the page, just without a record. After the encryptionKey changes,
cached pages count without record until the cache is renewed.
A detail view without a route argument, such as an Extbase action that
finds its record in another way, can set the record with a listener for
B13\ViewTracker\Event\ResolveTrackedRecordEvent:
#[AsEventListener]
final class TrackProduct
{
public function __invoke(ResolveTrackedRecordEvent $event): void
{
// Take the uid from what the page rendered, never from the raw
// query string: see above.
$uid = (int)($event->request->getAttribute('routing')?->getRouteArguments()['product'] ?? 0);
if ($uid > 0) {
$event->setRecord(new TrackedRecord('tx_shop_product', $uid));
}
}
}Use the uid of the record in the default language. Rows counted before this version have no record.
The Page module of the detail page lists the records it showed most, see Page Module Statistics.
The tracking endpoint moved from /_pixel to /_b13vt. If your templates use
the <vt:pixel /> ViewHelper, just flush caches — the new URL is emitted
automatically. If you copied the raw <img src="/_pixel?…"> snippet into a
template, update the path manually (or switch to the ViewHelper).
View Tracker counts page views without cookies and without storing any data
that identifies a visitor. Each counted view is one row in
tx_view_tracker_count. Which columns are filled depends on the installed
packages:
| Package | Stored per view | Read from the request, then discarded |
|---|---|---|
b13/view-tracker |
page ID, page type, primary browser language (e.g. de-de), timestamp, on detail pages the record shown (table and uid, e.g. a news article) |
User-Agent (to skip obvious bots), host name of the referring page and campaign parameters (both ignored without the Pro package) |
b13/view-tracker-pro |
browser name, operating system name, device type (no versions), host name of the referring page without www. (e.g. google.com), or (internal) / (unknown), campaign parameters utm_source, utm_medium, utm_campaign in a normalized form (e.g. newsletter) |
User-Agent (parsed, then discarded) |
b13/view-tracker-geoip |
country code (e.g. DE) |
client IP address (looked up in a local database, never stored or sent anywhere) |
b13/view-tracker-cdn-country |
country code (e.g. DE) |
country header set by the CDN (no IP address involved) |
Without the Pro package and a country package, the columns browser, os,
device_type, country, referrer, utm_source, utm_medium and
utm_campaign stay empty.
On a detail page, the pixel names the record the page shows, such as a news article, as table name and uid. It comes from the page's route when the page is rendered, not from the address in the browser, so the path and slug of the page never leave the browser either.
The referring page is known only to the browser. The pixel script reduces it to the host name before sending it, so the path, query string and fragment of the referring URL never reach the server.
Campaign parameters are the utm_source, utm_medium and utm_campaign
values in the address of the tracked page, set by whoever wrote the link (a
newsletter, an ad). The pixel script passes on only these three, never the
rest of the query string. They describe the link, not the visitor, as long as
links do not carry personal identifiers such as a recipient ID in
utm_campaign.
What View Tracker does not do:
- set or read cookies, local storage or any other identifier in the browser (it only checks whether a TYPO3 backend session cookie is present, so that editors are not counted)
- store IP addresses, the full
User-Agentstring or the full referrer URL - write request headers or IP addresses to the TYPO3 log; a counted view
produces at most a
debugentry with page ID and page type - link two page views to the same visitor
Note that your web server and CDN may still write their own access logs with IP addresses and headers. These are outside the scope of this extension.
Suggested wording for a privacy policy (adapt it to the installed packages):
We count page views on this website with the TYPO3 extension View Tracker. For each page view, we store the page, on detail pages the article or item shown, the time, the browser language and, where applicable, the browser, the operating system, the device type, the country, the domain of the website that linked to the page and the campaign named in the link (for example a newsletter). We do not set cookies, do not store IP addresses and cannot link page views to a person or to each other. The data is processed on our own server and is not passed on to third parties.
composer install
composer test:unit
composer test:functionalThe functional tests use SQLite by default and need no database server.
GPL-2.0-or-later — see the LICENSE file for details.
- View Tracker Pro—dashboard widgets, data aggregation, and server-side analytics (browser, operating system, device type, and origin of the visit)
- View Tracker CDN Country—country detection via CDN headers (Cloudflare, Fastly, CloudFront)
- View Tracker GeoIP—country detection via a local MaxMind GeoIP database
View Tracker was created by Johannes Schlier and David Steeb and is maintained by b13 GmbH, Stuttgart, Germany.
Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of our work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.