<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function monsterinsights_detect_uninstalled_addons( $settings ) {
	$network_license = get_site_option( 'monsterinsights_license', false );
	$local_license   = get_option( 'monsterinsights_license', false );
	
	if ( current_user_can( 'monsterinsights_save_settings' ) ) {
		if ( ( monsterinsights_is_network_active() && ! empty( $network_license ) ) || ( monsterinsights_is_network_active() && empty( $network_license ) && ! empty( $local_license ) ) || ( ! monsterinsights_is_network_active() && ! empty( $local_license ) ) ) {
			// Show notices they can install
			if ( ! class_exists( 'MonsterInsights_Social' ) ) {
				$settings['social']['social_notice']['id'] = 'social_notice';
				$settings['social']['social_notice']['type'] = 'notice';
				$settings['social']['social_notice']['desc'] = sprintf( esc_html__( 'In order to use the social tracking features, please %1$sinstall and activate%2$s the social addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Ads' ) ) {
				$settings['ads']['ads_notice']['id'] = 'ads_notice';
				$settings['ads']['ads_notice']['type'] = 'notice';
				$settings['ads']['ads_notice']['desc'] = sprintf( esc_html__( 'In order to use the ads tracking features, please %1$sinstall and activate%2$s the ads addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Forms' ) ) {
				$settings['forms']['forms_notice']['id'] = 'forms_notice';
				$settings['forms']['forms_notice']['type'] = 'notice';
				$settings['forms']['forms_notice']['desc'] = sprintf( esc_html__( 'In order to use the forms tracking features, please %1$sinstall and activate%2$s the forms addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_eCommerce' ) ) {
				$settings['ecommerce']['ecommerce_notice']['id'] = 'ecommerce_notice';
				$settings['ecommerce']['ecommerce_notice']['type'] = 'notice';
				$settings['ecommerce']['ecommerce_notice']['desc'] = sprintf( esc_html__( 'In order to use the ecommerce tracking features, please %1$sinstall and activate%2$s the ecommerce addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Media' ) ) {
				$settings['media']['media_notice']['id'] = 'media_notice';
				$settings['media']['media_notice']['type'] = 'notice';
				$settings['media']['media_notice']['desc'] = sprintf( esc_html__( 'In order to use the media tracking features, please %1$sinstall and activate%2$s the media addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Membership' ) ) {
				$settings['memberships']['memberships_notice']['id'] = 'memberships_notice';
				$settings['memberships']['memberships_notice']['type'] = 'notice';
				$settings['memberships']['memberships_notice']['desc'] = sprintf( esc_html__( 'In order to use the membership tracking features, please %1$sinstall and activate%2$s the membership addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Dimensions' ) ) {
				$settings['dimensions']['dimensions_notice']['id'] = 'dimensions_notice';
				$settings['dimensions']['dimensions_notice']['type'] = 'notice';
				$settings['dimensions']['dimensions_notice']['desc'] = sprintf( esc_html__( 'In order to use the dimensions tracking features, please %1$sinstall and activate%2$s the dimensions addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Performance' ) ) {
				$settings['performance']['performance_notice']['id'] = 'performance_notice';
				$settings['performance']['performance_notice']['type'] = 'notice';
				$settings['performance']['performance_notice']['desc'] = sprintf( esc_html__( 'In order to use the performance tracking features, please %1$sinstall and activate%2$s the performance addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_AMP' ) ) {
				$settings['amp']['amp_notice']['id'] = 'amp_notice';
				$settings['amp']['amp_notice']['type'] = 'notice';
				$settings['amp']['amp_notice']['desc'] = sprintf( esc_html__( 'In order to use the AMP integration, please %1$sinstall and activate%2$s the AMP addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Google_Optimize' ) ) {
				$settings['goptimize']['goptimize_notice']['id'] = 'goptimize_notice';
				$settings['goptimize']['goptimize_notice']['type'] = 'notice';
				$settings['goptimize']['goptimize_notice']['desc'] = sprintf( esc_html__( 'In order to use the Google Optimize integration, please %1$sinstall and activate%2$s the Google Optimize addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_FB_Instant_Articles' ) ) {
				$settings['fbia']['fbia_notice']['id'] = 'fbia_notice';
				$settings['fbia']['fbia_notice']['type'] = 'notice';
				$settings['fbia']['fbia_notice']['desc'] = sprintf( esc_html__( 'In order to use the Facebook Instant Articles integration features, please %1$sinstall and activate%2$s the Facebook Instant Articles addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Bounce_Reduction' ) ) {
				$settings['bounce']['bounce_notice']['id'] = 'bounce_notice';
				$settings['bounce']['fbounce_notice']['type'] = 'notice';
				$settings['bounce']['bounce_notice']['desc'] = sprintf( esc_html__( 'In order to use the Bounce Reduction addon features, please %1$sinstall and activate%2$s the Bounce Reduction addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Reporting' ) ) {
				$settings['reporting']['reporting_notice']['id'] = 'reporting_notice';
				$settings['reporting']['reporting_notice']['type'] = 'notice';
				$settings['reporting']['reporting_notice']['desc'] = sprintf( esc_html__( 'In order to use the reporting features, please %1$sinstall and activate%2$s the reporting addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
			if ( ! class_exists( 'MonsterInsights_Notifications' ) ) {
				$settings['notifications']['notifications_notice']['id'] = 'notifications_notice';
				$settings['notifications']['notifications_notice']['type'] = 'notice';
				$settings['notifications']['notifications_notice']['desc'] = sprintf( esc_html__( 'In order to use the notifications features, please %1$sinstall and activate%2$s the notifications addon.', 'ga-premium'), '<a href="' . admin_url( 'admin.php?page=monsterinsights_addons' ) . '" target="_blank" rel="noopener noreferrer" referrer="no-referrer" >', '</a>' );
			}
		} else {
			// Show enter license key notice
			if ( ! class_exists( 'MonsterInsights_Social' ) ) {
				$settings['social']['social_notice']['id'] = 'social_notice';
				$settings['social']['social_notice']['type'] = 'notice';
				$settings['social']['social_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Ads' ) ) {
				$settings['ads']['ads_notice']['id'] = 'ads_notice';
				$settings['ads']['ads_notice']['type'] = 'notice';
				$settings['ads']['ads_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Forms' ) ) {
				$settings['forms']['forms_notice']['id'] = 'forms_notice';
				$settings['forms']['forms_notice']['type'] = 'notice';
				$settings['forms']['forms_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_eCommerce' ) ) {
				$settings['ecommerce']['ecommerce_notice']['id'] = 'ecommerce_notice';
				$settings['ecommerce']['ecommerce_notice']['type'] = 'notice';
				$settings['ecommerce']['ecommerce_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Media' ) ) {
				$settings['media']['media_notice']['id'] = 'media_notice';
				$settings['media']['media_notice']['type'] = 'notice';
				$settings['media']['media_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Membership' ) ) {
				$settings['memberships']['memberships_notice']['id'] = 'memberships_notice';
				$settings['memberships']['memberships_notice']['type'] = 'notice';
				$settings['memberships']['memberships_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Dimensions' ) ) {
				$settings['dimensions']['dimensions_notice']['id'] = 'dimensions_notice';
				$settings['dimensions']['dimensions_notice']['type'] = 'notice';
				$settings['dimensions']['dimensions_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Performance' ) ) {
				$settings['performance']['performance_notice']['id'] = 'performance_notice';
				$settings['performance']['performance_notice']['type'] = 'notice';
				$settings['performance']['performance_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_AMP' ) ) {
				$settings['amp']['amp_notice']['id'] = 'amp_notice';
				$settings['amp']['amp_notice']['type'] = 'notice';
				$settings['amp']['amp_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Google_Optimize' ) ) {
				$settings['goptimize']['goptimize_notice']['id'] = 'goptimize_notice';
				$settings['goptimize']['goptimize_notice']['type'] = 'notice';
				$settings['goptimize']['goptimize_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_FB_Instant_Articles' ) ) {
				$settings['fbia']['fbia_notice']['id'] = 'fbia_notice';
				$settings['fbia']['fbia_notice']['type'] = 'notice';
				$settings['fbia']['fbia_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Bounce_Reduction' ) ) {
				$settings['bounce']['bounce_notice']['id'] = 'bounce_notice';
				$settings['bounce']['bounce_notice']['type'] = 'notice';
				$settings['bounce']['bounce_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Reporting' ) ) {
				$settings['reporting']['reporting_notice']['id'] = 'reporting_notice';
				$settings['reporting']['reporting_notice']['type'] = 'notice';
				$settings['reporting']['reporting_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
			if ( ! class_exists( 'MonsterInsights_Notifications' ) ) {
				$settings['notifications']['notifications_notice']['id'] = 'notifications_notice';
				$settings['notifications']['notifications_notice']['type'] = 'notice';
				$settings['notifications']['notifications_notice']['desc'] = esc_html__( 'In order to use these pro features, please enter your license key.', 'ga-premium' );
			}
		}
	} else {
		// Doesn't have permissions
		if ( ! class_exists( 'MonsterInsights_Social' ) ) {
			$settings['social']['social_notice']['id'] = 'social_notice';
			$settings['social']['social_notice']['type'] = 'notice';
			$settings['social']['social_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Ads' ) ) {
			$settings['ads']['ads_notice']['id'] = 'ads_notice';
			$settings['ads']['ads_notice']['type'] = 'notice';
			$settings['ads']['ads_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Forms' ) ) {
			$settings['forms']['forms_notice']['id'] = 'forms_notice';
			$settings['forms']['forms_notice']['type'] = 'notice';
			$settings['forms']['forms_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_eCommerce' ) ) {
			$settings['ecommerce']['ecommerce_notice']['id'] = 'ecommerce_notice';
			$settings['ecommerce']['ecommerce_notice']['type'] = 'notice';
			$settings['ecommerce']['ecommerce_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Media' ) ) {
			$settings['media']['media_notice']['id'] = 'media_notice';
			$settings['media']['media_notice']['type'] = 'notice';
			$settings['media']['media_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Membership' ) ) {
			$settings['memberships']['memberships_notice']['id'] = 'memberships_notice';
			$settings['memberships']['memberships_notice']['type'] = 'notice';
			$settings['memberships']['memberships_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Dimensions' ) ) {
			$settings['dimensions']['dimensions_notice']['id'] = 'dimensions_notice';
			$settings['dimensions']['dimensions_notice']['type'] = 'notice';
			$settings['dimensions']['dimensions_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Performance' ) ) {
			$settings['performance']['performance_notice']['id'] = 'performance_notice';
			$settings['performance']['performance_notice']['type'] = 'notice';
			$settings['performance']['performance_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_AMP' ) ) {
			$settings['amp']['amp_notice']['id'] = 'amp_notice';
			$settings['amp']['amp_notice']['type'] = 'notice';
			$settings['amp']['amp_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Google_Optimize' ) ) {
			$settings['goptimize']['goptimize_notice']['id'] = 'goptimize_notice';
			$settings['goptimize']['goptimize_notice']['type'] = 'notice';
			$settings['goptimize']['goptimize_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_FB_Instant_Articles' ) ) {
			$settings['fbia']['fbia_notice']['id'] = 'fbia_notice';
			$settings['fbia']['fbia_notice']['type'] = 'notice';
			$settings['fbia']['fbia_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Bounce_Reduction' ) ) {
			$settings['bounce']['bounce_notice']['id'] = 'bounce_notice';
			$settings['bounce']['bounce_notice']['type'] = 'notice';
			$settings['bounce']['bounce_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Reporting' ) ) {
			$settings['reporting']['reporting_notice']['id'] = 'reporting_notice';
			$settings['reporting']['reporting_notice']['type'] = 'notice';
			$settings['reporting']['reporting_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
		if ( ! class_exists( 'MonsterInsights_Notifications' ) ) {
			$settings['notifications']['notifications_notice']['id'] = 'notifications_notice';
			$settings['notifications']['notifications_notice']['type'] = 'notice';
			$settings['notifications']['notifications_notice']['desc'] = esc_html__( 'In order to use these pro features, please ask your webmaster to install the necessary addon.', 'ga-premium' );
		}
	}
	return $settings;
}
add_action( 'monsterinsights_registered_settings', 'monsterinsights_detect_uninstalled_addons', 99999, 1 );

function monsterinsights_registered_settings_filter( $settings ) {
	$tracking_mode   = monsterinsights_get_option( 'tracking_mode', 'analytics' );
	$events_tracking = monsterinsights_get_option( 'events_mode', 'js' );
	
	// UserID
	if ( 'ga' !== $tracking_mode ) {
		$url   = 'https://www.monsterinsights.com/docs/how-to-setup-user-tracking/';
		$settings['demographics']['userid'] = array(
				'id'          => 'userid',
				'name'        => __( 'Enable User ID tracking', 'ga-premium' ),
				'desc'        => sprintf( esc_html__( 'To the extent that Google allows webmasters to discern single users, this setting allows you to identify users by their WordPress user ID if logged in. To use this feature, you will need to turn this feature on in Google Analytics. %1$sClick here%2$s for step by step directions.' , 'ga-premium' ), '<a href="' . esc_attr( $url ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>'),
				'type' 		  => 'checkbox',
		);
	} else {
		$url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'demographics' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) );
		$settings['demographics']['userid'] = array(
				'id'          => 'userid',
				'name'        => __( 'Enable User ID tracking', 'ga-premium' ),
				'desc'        => sprintf( esc_html__( 'UserID 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.', 'ga-premium' ), '<a href="' . esc_attr( $url ) .'">', '</a>' ),
				'type' 		  => 'notice',
		);
	}

	if ( 'analytics' === $tracking_mode ) {
		$settings['compatibility']['gatracker_compatibility_mode'] = array(
			'id'          => 'gatracker_compatibility_mode',
			'name'        => __( 'Enable _gaTracker Compatibility', 'google-analytics-for-wordpress' ),
			'desc'        => sprintf( esc_html__( 'This enables MonsterInsights to work with plugins that use ga() and don\'t support %s' , 'ga-premium' ), '<code>__gaTracker</code>' ),
			'type'        => 'checkbox',
		);
	}


	// both
	if ( ! empty( $settings['engagement']['events_mode'] ) ) {
		if ( $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) {
			// if we're not using Universal Analytics, we can't do JS events tracking
			unset( $settings['engagement']['events_mode']['options']['js'] );
		} else {
			if ( $tracking_mode !== 'ga' && $events_tracking !== 'php' && ! monsterinsights_is_debug_mode() ) {
			   // if we're not using PHP events tracking, turn it off
				unset( $settings['engagement']['events_mode']['options']['php'] );
			}
		}
	}
	if ( ! empty( $settings['demographics']['demographics'] ) && $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) {
		// Events relies on universal tracking
		$url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'demographics' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) );
		$settings['demographics']['demographics']['type'] = 'notice';
		$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.', 'ga-premium' ), '<a href="' . $url .'">', '</a>' );
	}
	if ( ! empty( $settings['links']['enhanced_link_attribution'] ) && $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) {
		// This relies on universal tracking
		$url = esc_url( wp_nonce_url( add_query_arg( array( 'monsterinsights-action' => 'switch_to_analyticsjs', 'return' => 'demographics' ) ), 'monsterinsights-switch-to-analyticsjs-nonce' ) );
		$settings['links']['enhanced_link_attribution']['type'] = 'notice';
		$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.', 'ga-premium' ), '<a href="' . $url .'">', '</a>' );
	}


	if ( ! empty( $settings['compatibility']['subdomain_tracking'] ) && $tracking_mode === 'ga' && ! monsterinsights_is_debug_mode() ) {
		$settings['links']['enhanced_link_attribution']['name'] = __( 'Subdomain tracking:', 'ga-premium' );
		$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.', 'ga-premium' ), '<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>' );
	}
	return $settings;
}
add_filter( 'monsterinsights_registered_settings', 'monsterinsights_registered_settings_filter' );