<?php
if ( ! defined( 'ABSPATH' ) ) exit;
class SS_Analytics {
    public static function init(){
        add_action('ss_log', [__CLASS__,'log'], 10, 3);
    }
    public static function log($channel, $event, $context = []){
        if (!get_option(SS_Settings::OPT_TELEMETRY, false)) return; // respect opt-in
        // Minimal, non-PII: rely on backend if you want richer telemetry (Milestone 3).
        do_action(
            'searchshifter_log',
            'searchshifter:' . $channel,
            $event,
            $context
        );
    }
}
