October 14, 2026

Hooks and the JavaScript API

Site Mascot 2.0 and later Updated October 14, 2026

PHP hooks

// Hide on some pages
add_filter( 'site_mascot_should_load', fn() => ! is_page( 'checkout' ) );

// Change anything sent to the browser
add_filter( 'site_mascot_config', function ( $c ) { /* ... */ return $c; } );

// Choose which post types it learns from (default: all public types)
add_filter( 'site_mascot_scan_post_types', fn( $types ) => array( 'page', 'post' ) );

// Learn from more than 500 items
add_filter( 'site_mascot_scan_limit', fn() => 1000 );

// React when a scan finishes
add_action( 'site_mascot_index_built', function ( $index ) { /* ... */ } );

Behind a CDN or proxy, add site_mascot_client_ip returning the visitor’s real IP so limits are per visitor, not shared.

JavaScript API

These calls are safe before the mascot has loaded, because they are queued.

SiteMascot.say('Hello!', ms?)
SiteMascot.ask('when do applications close?')
SiteMascot.pointAt('.cta-button', message?)
SiteMascot.celebrate(message?)      // cap toss + confetti
SiteMascot.flyToTop()
SiteMascot.sleep() / SiteMascot.wake()
SiteMascot.openMenu()