[OFFER ALERT!] This Halloween, Get Any Premium Theme for Just $19 [GET IT NOW]
Jump to content

[Rank Math SEO Plugin] Hiding other google analytics accounts


nick8
 Share

Recommended Posts

I tend to create my clients Analytics account under my google account. I have almost 100 of them sitting in my google account. How can I select the clients analytics account and then hide all other accounts. I don't want them to have access to the data from any of my clients analytic accounts.

This is under General Setting > Search Console.

 

Link to comment
Share on other sites

  • Support

Hello,

Please use below code to remove the Search console option for everyone except the IDs in the array:

// Remove Search Console option from Settings.
add_filter( 'rank_math/settings/general', function( $tabs ) {
	$user_id = get_current_user_id();
	if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3
		unset( $tabs['search-console'] );
	}
	return $tabs;
});

// Remove Search Console option from Setup Wizard.
add_filter( 'rank_math/wizard/steps', function( $steps ) {
	$user_id = get_current_user_id();
	if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3
		unset( $steps['searchconsole'] );
	}
	return $steps;
});

Hope that helps. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello,

Thank you for contacting MyThemeShop and sorry for any inconvenience that might have been caused due to that.

Search console profile shows all the accounts linked to the email address. Sadly, there is no way to show specific Analytics Account in Seach Console Profile. To show client specific analytics account in the profile you'll either have to create separate client accounts or you can hide the Search console option completely for specific WP users which belongs to your client by adding below code to your active theme's funcitons.php file:

// Remove Search Console option from Settings.
add_filter( 'rank_math/settings/general', function( $tabs ) {
	$user_id = get_current_user_id();
	if ( in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3
		unset( $tabs['search-console'] );
	}
	return $tabs;
});

// Remove Search Console option from Setup Wizard.
add_filter( 'rank_math/wizard/steps', function( $steps ) {
	$user_id = get_current_user_id();
	if ( in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3
		unset( $steps['searchconsole'] );
	}
	return $steps;
});

Please replace '{COMMA_SEPARATED_CLIENT_IDS}' with the WP user IDs.

Hope that helps. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • Support

Hello,

Please use below code to remove the Search console option for everyone except the IDs in the array:

// Remove Search Console option from Settings.
add_filter( 'rank_math/settings/general', function( $tabs ) {
	$user_id = get_current_user_id();
	if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3
		unset( $tabs['search-console'] );
	}
	return $tabs;
});

// Remove Search Console option from Setup Wizard.
add_filter( 'rank_math/wizard/steps', function( $steps ) {
	$user_id = get_current_user_id();
	if ( ! in_array( $user_id, array( '{COMMA_SEPARATED_CLIENT_IDS}' ) ) ) { // Eg 1,2,3
		unset( $steps['searchconsole'] );
	}
	return $steps;
});

Hope that helps. Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin.

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

  • 2 weeks later...
  • Support

Hello,

Glad that helped.

We would request you to take a couple of minutes to REVIEW the plugin and give it 5-STARS on WordPress.org, if not already
https://link.mythemeshop.com/reviewrankmath

Your kind words motivate us and help us put more effort into the development of this plugin and make it even better.

We really need your positive feedback to push even harder, keep the plugin FREE, and continue the development of the plugin in full-swing.

If you are planning to do a 4-star review or anything less, please don't. Instead, reply here and let us understand your requirements so we can get a 5-star rating from you as well. Can not afford even a single user to be disappointed over anything.

Thank you.


🏁Rank #1 on Google With our WordPress SEO Plugin

Score a 💯on PageSpeed and Dominate Search Rankings.

✏ Editing theme files? Please create a child theme to make your changes update-proof.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...