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 »

Source File

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

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;}

            $data = array(
                't' => 'exception',
                'exd' => $message,
                'exf' => $fatal,
                'dt' => 'Page Not Found'

            $data = array_merge($this->ga_common_parameters(), $data); //Add custom definition parameters
            $data = array_merge($data, $array); //Add passed parameters
            $this->ga_send_data($data, false); //Disabling force parameter here in an attempt to reduce or eliminate "(not set)" landing page data in Google Analytics.


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');