Integration Guides

TYPO3

Add Rybbit analytics to your TYPO3 site

TYPO3 sitepackages build the page <head> from TypoScript rather than an HTML template, so the snippet is added as a page.includeJS entry in your sitepackage's setup.typoscript.

Get your tracking snippet

In your Rybbit dashboard, open Site Settings → Tracking Script and copy your snippet. It looks like this:

<script src="https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID" defer></script>

YOUR_SITE_ID is the numeric ID of your site. If you self-host Rybbit, app.rybbit.io is the domain of your own instance.

Add the snippet to TYPO3

  1. Open your main TypoScript setup file, usually <sitepackage>/Configuration/TypoScript/setup.typoscript. It is the file that already contains page = PAGE. The same TypoScript can also live in a TypoScript record in the backend.

  2. Add the script to the page object:

    page = PAGE
    page {
      includeJS {
        rybbit = https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID
        rybbit.defer = 1
      }
    }

    Because the Site ID is part of the URL, no data-* attribute is needed, so this works on every supported TYPO3 version. Per-include attributes on includeJS only exist in TYPO3 12.1+.

  3. To track production only, wrap the include in an applicationContext condition:

    [applicationContext == "Production"]
    page.includeJS.rybbit = https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID
    page.includeJS.rybbit.defer = 1
    [END]
  4. Optionally keep the Site ID and instance URL in constants.typoscript (or a TypoScript record) so the setup file can be committed without site-specific values:

    # constants.typoscript
    rybbit {
      host = https://app.rybbit.io
      siteId = YOUR_SITE_ID
    }
    
    # setup.typoscript
    page.includeJS.rybbit = {$rybbit.host}/api/script.js?siteId={$rybbit.siteId}
    page.includeJS.rybbit.defer = 1
  5. Deploy the sitepackage, or set applicationContext accordingly, and flush the TYPO3 caches.

Verify installation

Open your live site in a new tab and click through a few pages. Within a few seconds the pageviews appear in the Rybbit dashboard.

If nothing shows up:

  • View the page source and search for script.js?siteId= to confirm the snippet is on the page.
  • Open the browser Network tab and check that script.js returns 200 and that POST requests go to /api/track.
  • Disable ad blockers, or set up a proxy so the script loads from your own domain.
  • See the script troubleshooting guide for other common causes.

Troubleshooting

  • Script not in the page source: TYPO3 caches rendered pages. Flush caches from the backend toolbar or with vendor/bin/typo3 cache:flush after changing TypoScript.
  • Wrong TypoScript file: if several files define page, check the resulting page.includeJS in the TypoScript object browser in the backend to see which definition wins.
  • Condition never matches: the applicationContext is set through the TYPO3_CONTEXT environment variable. If it is unset, TYPO3 runs as Production and the script loads everywhere.

Next steps

On this page