Weak hands cannot be planted, meager skills have no foundation. Shallow wisdom is futile, how can one hope for a good name?扰扰从役倦，屑屑身事微。少壮轻年月，迟暮惜光辉。
<html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><?php
namespace WP_Statistics\Service\CustomEvent;

use Exception;
use WP_Statistics\Models\EventsModel;
use WP_Statistics\Utils\Request;
use WP_Statistics\Components\Ajax;
use WP_STATISTICS\Exclusion;
use WP_Statistics\Service\Analytics\VisitorProfile;

/**
 * @todo Send responses in a standard format using Ajax::success() or Ajax::error()
 */
class CustomEventActions
{
    public function register()
    {
        Ajax::register('custom_event', [$this, 'insertCustomEvent']);
    }

    public function insertCustomEvent()
    {
        try {
            $nonce = Request::get('nonce');

            if (!wp_verify_nonce($nonce, 'wp_statistics_custom_event')) {
                throw new Exception(esc_html__('Access denied.', 'wp-statistics-marketing'));
            }

            $GLOBALS['wp_statistics_user_id'] = get_current_user_id();

            $visitorProfile = new VisitorProfile();

            $exclusion = Exclusion::check($visitorProfile);
            if ($exclusion['exclusion_match'] === true) {
                Exclusion::record($exclusion);

                throw new Exception($exclusion['exclusion_reason']);
            }

            $eventName = Request::get('event_name');
            $eventData = Request::get('event_data');

            // Decode the json event data
            $eventData = json_decode(stripslashes($eventData), true);

 