array( 'min_prev' => 100, 'trigger' => -20, 'clear' => -10, 'high' => -40, ), // One important page: in the top pages by clicks, or it brought leads. 'page' => array( 'top' => 10, 'min_leads' => 3, 'min_prev' => 30, 'min_lost' => 20, 'trigger' => -30, 'clear' => -15, 'high' => -60, 'max' => 3, ), // Keywords that slipped down Google's results. 'rankings' => array( 'min_prev_clicks' => 10, 'min_prev_impr' => 300, 'worse' => 3.0, 'clear' => 1.5, 'min_keywords' => 3, 'min_lost' => 30, 'high_lost' => 200, 'list' => 8, ), // Conversions (leads) from organic search. 'leads' => array( 'min_prev' => 10, 'trigger' => -25, 'clear' => -10, 'high' => -50, ), // A conversion event that stopped recording while visits continued. 'tracking' => array( 'min_before' => 8, 'min_sessions' => 20, ), // GA4 organic sessions, only for sites without Search Console. 'sessions' => array( 'min_prev' => 100, 'trigger' => -20, 'clear' => -10, 'high' => -40, ), // No Google clicks at all. 'zero' => array( 'min_prev' => 20, ), ); if ( self::RELAXED === $sensitivity ) { foreach ( $rules as $name => $rule ) { foreach ( $rule as $key => $value ) { if ( in_array( $key, array( 'trigger', 'clear', 'high', 'worse' ), true ) ) { $rules[ $name ][ $key ] = max( -95, $value * 1.5 ); } elseif ( 0 === strpos( $key, 'min_' ) ) { $rules[ $name ][ $key ] = $value * 2; } } } } /** * Filters the Client Monitor's thresholds. * * Percentages are negative (−20 means "down 20%"). Volume floors are * the minimum in the earlier period for a change to count. * * @param array $rules Rules keyed by check. * @param string $sensitivity standard|relaxed. */ return (array) apply_filters( 'turtlereport_attention_rules', $rules, $sensitivity ); } /** * Percentage change from $before to $now, or null with nothing to compare. * * @param float $now Now. * @param float $before Before. * @return float|null */ public static function change( $now, $before ) { return $before > 0 ? ( ( $now - $before ) / $before ) * 100 : null; } }