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_dntis set to comply with that request - If within the WordPress Customizer
- If the query string
nogais present - If the current IP address matches the server’s IP address itself
Source File
Located in /libs/Utilities/Analytics.php on line 35.
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.
Filters
This function has no filter hooks available. Request one?
Actions
"qm/info"Need a new action hook? Request one here.
PHP
public function is_analytics_allowed(){
if ( $this->is_minimal_mode() ){return null;}
if ( $this->option('observe_dnt') && $this->is_do_not_track() ){
$this->once('is_analytics_allowed', function(){
do_action('qm/info', 'Observing "Do Not Track" requests');
});
return false;
}
if ( $this->is_non_page_request() ){ //Should I include $this->is_background_request() here too?
return false;
}
if ( isset($this->super->get['noga']) || is_customize_preview() ){ //Disable analytics for ?noga query string
return false;
}
if ( isset($this->super->server['SERVER_ADDR']) && $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?