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.  
  30.  
  31. // Addons: 
  32. // Social 
  33. $settings['social']['social_notice'] = array(  
  34. 'id' => 'social_notice',  
  35. 'name' => __( 'Want to setup Social Tracking?', 'google-analytics-for-wordpress'),  
  36. 'type' => 'upgrade_notice',  
  37. 'desc' => sprintf( esc_html__( 'To setup social tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  38. ); 
  39.  
  40. // Ads 
  41. $settings['ads']['ads_notice'] = array(  
  42. 'id' => 'ads_notice',  
  43. 'name' => __( 'Want to setup Ad Tracking?', 'google-analytics-for-wordpress'),  
  44. 'type' => 'upgrade_notice',  
  45. 'desc' => sprintf( esc_html__( 'To setup ad tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  46. ); 
  47.  
  48. // Forms 
  49. $settings['forms']['forms_notice'] = array(  
  50. 'id' => 'forms_notice',  
  51. 'name' => __( 'Want to setup Forms Tracking?', 'google-analytics-for-wordpress'),  
  52. 'type' => 'upgrade_notice',  
  53. 'desc' => sprintf( esc_html__( 'To setup form tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  54. ); 
  55.  
  56. // Media 
  57. $settings['media']['media_notice'] = array(  
  58. 'id' => 'media_notice',  
  59. 'name' => __( 'Want to setup Media Tracking?', 'google-analytics-for-wordpress'),  
  60. 'type' => 'upgrade_notice',  
  61. 'desc' => sprintf( esc_html__( 'To setup media tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  62. ); 
  63.  
  64. // Membership 
  65. $settings['membership']['membership_notice'] = array(  
  66. 'id' => 'membership_notice',  
  67. 'name' => __( 'Want to setup Membership Tracking?', 'google-analytics-for-wordpress'),  
  68. 'type' => 'upgrade_notice',  
  69. 'desc' => sprintf( esc_html__( 'To setup membership tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  70. ); 
  71.  
  72. // Dimensions 
  73. $settings['dimensions']['dimensions_notice'] = array(  
  74. 'id' => 'dimensions_notice',  
  75. 'name' => __( 'Want to setup Custom Dimensions?', 'google-analytics-for-wordpress'),  
  76. 'type' => 'upgrade_notice',  
  77. 'desc' => sprintf( esc_html__( 'To setup custom dimensions, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  78. ); 
  79.  
  80. // Performance 
  81. $settings['performance']['performance_notice'] = array(  
  82. 'id' => 'performance_notice',  
  83. 'name' => __( 'Want to setup Performance Tracking?', 'google-analytics-for-wordpress'),  
  84. 'type' => 'upgrade_notice',  
  85. 'desc' => sprintf( esc_html__( 'To setup performance tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  86. ); 
  87.  
  88. // Reporting 
  89. $settings['reporting']['reporting_notice'] = array(  
  90. 'id' => 'reporting_notice',  
  91. 'name' => __( 'Want to setup Custom Reporting?', 'google-analytics-for-wordpress'),  
  92. 'type' => 'upgrade_notice',  
  93. 'desc' => sprintf( esc_html__( 'To setup custom reporting, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  94. ); 
  95.  
  96. // Reporting 
  97. $settings['notifications']['notifications_notice'] = array(  
  98. 'id' => 'notifications_notice',  
  99. 'name' => __( 'Want to setup Custom Notifications?', 'google-analytics-for-wordpress'),  
  100. 'type' => 'upgrade_notice',  
  101. 'desc' => sprintf( esc_html__( 'To setup custom notifications, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  102. ); 
  103.  
  104. // Reporting 
  105. $settings['ecommerce']['ecommerce_notice'] = array(  
  106. 'id' => 'ecommerce_notice',  
  107. 'name' => __( 'Want to setup eCommerce Tracking?', 'google-analytics-for-wordpress'),  
  108. 'type' => 'upgrade_notice',  
  109. 'desc' => sprintf( esc_html__( 'To setup ecommerce tracking, please %1$supgrade your MonsterInsights account%2$s to unlock this feature.', 'google-analytics-for-wordpress' ), '<a href="' . esc_attr( monsterinsights_get_upgrade_link() ) . '">', '</a>' ) , '<br /><a href="' . monsterinsights_get_upgrade_link() . '" class="monsterinsights-upsell-box-button button button-primary" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >' . esc_html__( 'Learn more about MonsterInsights Pro', 'google-analytics-for-wordpress' ) . '</a>' 
  110. ); 
  111. return $settings;