Skip to Content


Send a Google Analytics exception from the server side.

PHP June 11, 2017


nebula()->ga_send_exception($message, $fatal, $array)


(Required) (String) The error message
Default: None

(Optional) (Boolean) If the error was fatal
Default: true

(Optional) (Array) An array of additional custom values
Default: None

Parameter Notes

Be careful with the $message parameter that it doesn’t accidentally send personally identifiable information.

Refer to this documentation for parameters.

Request or provide clarification »

Was this page helpful? Yes No

    A feedback message is required to submit this form.

    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Utilities/Analytics.php on line 155.

    1 Hook

    Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

    Need a new filter hook? Request one here.

    This function has no action hooks available. Request one?

            public function ga_send_exception($message=null, $fatal=1, $array=array()){
                $override = apply_filters('pre_ga_send_exception', null, $message, $fatal, $array);
                if ( isset($override) ){return;}
                $event_parameters = array(
                    'message' => $message,
                    'fatal' => $fatal,
                    'page_title' => 'Page Not Found'
                $data = array_merge($event_parameters, $array); //Add passed parameters
                $data = $this->ga_build_event('exception', $data);


    To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):

    add_filter('pre_ga_send_exception', 'my_custom_ga_send_exception', 10, 4); //The last integer must be 1 more than the actual parameters
    function my_custom_ga_send_exception($null, $message, $fatal, $array){ //$null is required, but can be ignored
        //Write your own code here
        return true; //Return true to prevent the original function from running afterwords

    You can completely disable this PHP function with a single line actions:

     add_filter('pre_ga_send_exception', '__return_false');