All docs

Start

  1. 01Getting started
  2. 02Install
  3. 03Tracking

Features

  1. 04The dashboard
  2. 05Goals
  3. 06Short links
  4. 07AI sources and agents
  5. 08Email reports
  6. 09Scheduled check
  7. 10Ask your AI

Reference

  1. 11Configuration
  2. 12HTTP API

Platforms

  1. 13Standalone server
  2. 14PHP
  3. 15Python
  4. 16WordPress
  5. 17Drupal
  6. 18Craft CMS
  7. 20Rails
  8. 21Ruby

Trust

  1. 19Privacy

Platforms

Craft CMS

Count a Craft CMS site with Runlight, and see when AI agents read it.

The Runlight plugin connects a Craft 5 site to a Runlight you run elsewhere, either in an app with Runlight mounted or on the standalone server. The numbers live in your Runlight, and Craft stores only the plugin’s settings.

What it does

  • It adds Runlight’s script to every front-end page and marks 404 pages.
  • It leaves out Control Panel users’ own visits unless you turn that off.
  • It reports AI agents such as ChatGPT and Claude when they fetch your pages, after the response has been sent.
  • It adds a Runlight item to the Control Panel that opens your dashboard.

Set it up

  1. Install the plugin by running composer require runlight/craft and then php craft plugin/install runlight.
  2. In your Runlight, make sure the site’s hostname is counted (see Configuration).
  3. Go to Settings, Plugins, Runlight, and enter the address Runlight is mounted at, such as https://stats.example.com/runlight. The page checks that the address answers.
  4. To count AI agents, copy this site’s key from Settings, Install, Key for CMS plugins in Runlight and put it in Craft’s .env as RUNLIGHT_OBSERVE_KEY. Then enter $RUNLIGHT_OBSERVE_KEY as the observe key, which keeps the key itself out of project config. The key can only report agent fetches for this one site.

As with any Craft plugin, every setting can also come from config/runlight.php, and values there override the Control Panel.

php

<?php
return [
    'address' => 'https://stats.example.com/runlight',
    'observeKey' => '$RUNLIGHT_OBSERVE_KEY',
];

Static caching

Static caches such as Blitz with server rewrites serve pages without running Craft. Those pages still include the script, so visits are counted. AI agent fetches of the cached pages are not reported, because Craft never runs for them.

Edit this page on GitHub