so it captures earliest possible errors ); // Tag context — same shape as PHP side so events from both // platforms cross-reference cleanly in the Sentry UI. $account_id = (string) get_option('aacb_accountID', ''); $site_host = wp_parse_url((string) get_site_url(), PHP_URL_HOST) ?: ''; $tier = ''; if (class_exists('AllAccessible_ApiClient')) { try { $tier = (string) AllAccessible_ApiClient::get_instance()->get_subscription_tier(); } catch (\Throwable $e) { /* don't recurse */ } } wp_localize_script('aacb-sentry-browser', 'AACB_SentryBrowser', array( 'dsn' => $dsn, 'release' => 'aacb-wp@' . (defined('AACB_VERSION') ? AACB_VERSION : '0.0.0'), 'environment' => (defined('WP_DEBUG') && WP_DEBUG) ? 'dev' : 'production', 'tags' => array( 'account_id' => $account_id !== '' ? $account_id : 'unknown', 'site_host' => $site_host !== '' ? strtolower($site_host) : 'unknown', 'tier' => $tier !== '' ? $tier : 'unknown', 'plugin_version' => defined('AACB_VERSION') ? AACB_VERSION : 'unknown', 'wp_version' => get_bloginfo('version'), 'multisite' => is_multisite() ? 'yes' : 'no', 'screen' => $hook, ), )); // Inline init. Runs immediately on script load. Defensive about // Sentry's loader timing — if `window.Sentry` isn't there yet, // wait for it once. SDK exposes `Sentry` global from the UMD bundle. $init_js = <<