Skip to Content
Menu

is_analytics_allowed()

Check if analytics is allowed for this page rendering.

PHP July 24, 2018

Usage

PHP
nebula()->is_analytics_allowed()

Parameters

This function does not accept any parameters. Is this incorrect?

Additional Notes

This checks several conditions to determine if analytics should be enabled for this rendering.

Conditions that do not allow analytics:

  • If “Do Not Track” header is present and the Nebula option observe_dnt is set to comply with that request
  • If within the WordPress Customizer
  • If the query string noga is present
  • If the current IP address matches the server’s IP address itself
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 31.

    No Hooks

    This function does not have any filters or actions available. Request one?
    PHP
            public function is_analytics_allowed(){
                if ( $this->option('observe_dnt') && $this->is_do_not_track() ){
                    return false;
                }
    
                if ( isset($this->super->get['noga']) || is_customize_preview() ){ //Disable analytics for ?noga query string
                    return false;
                }
    
                if ( $this->get_ip_address() === wp_privacy_anonymize_ip($this->super->server['SERVER_ADDR']) ){ //Disable analytics for self-requests by the server
                    return false;
                }
    
                return true; //Analytics is allowed
            }
    

    Override

    This function can not be short-circuited with an override filter. Request one?