monsterinsights_registered_settings_filter

The Google Analytics for WordPress by MonsterInsights monsterinsights registered settings filter function.

Description

monsterinsights_registered_settings_filter( $settings ); 

Parameters (1)

0. $settings
The settings.

Usage

  1. if ( !function_exists( 'monsterinsights_registered_settings_filter' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/lite/includes/admin/addons.php'; 
  3.  
  4. // The settings. 
  5. $settings = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = monsterinsights_registered_settings_filter($settings); 
  9.  

Defined (1)

The function is defined in the following location(s).

/lite/includes/admin/addons.php  
  1. function monsterinsights_registered_settings_filter( $settings ) { 
  2. $tracking_mode = monsterinsights_get_option( 'tracking_mode', 'analytics' ); 
  3. $events_tracking = monsterinsights_get_option( 'events_mode', 'js' ); 
  4.  
  5. // both 
  6. if ( ! empty( $settings['engagement']['events_mode'] ) ) { 
  7. if ( $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) { 
  8. // if we're not using Universal Analytics, we can't do JS events tracking 
  9. unset( $settings['engagement']['events_mode']['options']['js'] ); 
  10. } else { 
  11. if ( $tracking_mode !== 'ga' && $events_tracking !== 'php' && ! monsterinsights_is_debug_mode() ) { 
  12. // if we're not using PHP events tracking, turn it off 
  13. unset( $settings['engagement']['events_mode']['options']['php'] ); 
  14. if ( ! empty( $settings['demographics']['demographics'] ) && $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) { 
  15. // Events relies on universal tracking 
  16. $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'demographics' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) ); 
  17. $settings['demographics']['demographics']['type'] = 'notice'; 
  18. $settings['demographics']['demographics']['desc'] = sprintf( esc_html__( 'Demographics and Interests tracking is only available on Universal Tracking (analytics.js). You\'re currently using deprecated ga.js tracking. We recommend switching to analytics.js, as it is significantly more accurate than ga.js, and allows for additional functionality (like the more accurate Javascript based events tracking we offer). Further Google Analytics has deprecated support for ga.js, and it may stop working at any time when Google decides to disable it from their server. To switch to using the newer Universal Analytics (analytics.js) %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
  19. if ( ! empty( $settings['links']['enhanced_link_attribution'] ) && $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) { 
  20. // This relies on universal tracking 
  21. $url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'demographics' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) ); 
  22. $settings['links']['enhanced_link_attribution']['type'] = 'notice'; 
  23. $settings['links']['enhanced_link_attribution']['desc'] = sprintf( esc_html__( 'Enhanced Link Attribution tracking is only available on Universal Tracking (analytics.js). You\'re currently using deprecated ga.js tracking. We recommend switching to analytics.js, as it is significantly more accurate than ga.js, and allows for additional functionality (like the more accurate Javascript based events tracking we offer). Further Google Analytics has deprecated support for ga.js, and it may stop working at any time when Google decides to disable it from their server. To switch to using the newer Universal Analytics (analytics.js) %1$sclick here%2$s.', 'google-analytics-for-wordpress' ), '<a href="' . $url .'">', '</a>' ); 
  24.  
  25.  
  26. if ( ! empty( $settings['compatibility']['subdomain_tracking'] ) && $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) { 
  27. $settings['links']['enhanced_link_attribution']['name'] = __( 'Subdomain tracking:', 'google-analytics-for-wordpress' ); 
  28. $settings['links']['enhanced_link_attribution']['desc'] = sprintf( esc_html__( 'This allows you to set the domain that\'s set by %1$s for tracking subdomains. If empty, this will not be set. Can be used to set localhost for ga.js tracking.', 'google-analytics-for-wordpress' ), '<a href="https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._setDomainName" target="_blank" rel="noopener noreferrer" referrer="no-referrer"><code>_setDomainName</code></a>' ); 
  29. return $settings;