How to Disable Google Analytics for Logged in Users

If you are running a membership based website and don’t want to track your website’s authors and writers and only want to track real visitors of your website, then this tutorial is only designed for you.

In this tutorial, I will share the WordPress function which will allow disabling google analytics for logged in users. replace the “XXXXXXXX” value with your own google analytics property ID. I have used wp_head() function in below example so that google analytics code will be display in the header part of front-end website.

How to Disable Google Analytics for Logged in Users

How to Disable Google Analytics for Logged in Users

After using this function you can track your visitors except for your Authors and Writers. Open your functions.php file from current active themes folder and copy paste below code at the end of the file. If your functions.php file is not available in your theme folder, then create new functions.php file and add the below in it.

If you still need any help to disable Google Analytics for logged in user, then feel free to put your comments in below comment section. I will be happy to help to disable Google Analytics for logged in user on your website. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.