]; } /** * Returns true if the new_pricing_202210 is set to not empty in URL for testing purpose. */ public static function is_forced_new_pricing_202208() { $referrer = wp_get_referer(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash return ( isset( $_GET['new_pricing_202208'] ) && $_GET['new_pricing_202208'] ) || $referrer && strpos( $referrer, 'new_pricing_202208=1' ) !== false; } /** * Returns true if tracking should be disabled via URL parameter, which is used for testing purposes. * * @since 0.56.0 * * @return bool */ public static function is_tracking_disabled() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash return isset( $_GET['disable_tracking'] ) && $_GET['disable_tracking']; } /** * Enqueue the WordPress.com Tracks library that drains `window._tkq` and * sends the queued events. Shared by Instant Search and the Search blocks so * the handle, src, and cache-busting version live in one place. Callers own * the decision of whether to load it (e.g. the `is_tracking_disabled()` gate). */ public static function enqueue_tracks_script() { wp_enqueue_script( 'jp-tracks', '//stats.wp.com/w.js', array(), gmdate( 'YW' ), true ); } }