//Remove users logged into WordPress from Google Analytics

Remove users logged into WordPress from Google Analytics

It is important to remove developers, admins, and any other frequent users of your site from Google Analytics (GA) as if they visit the site very frequently this could possible skew any analysis. There are many ways to do this including setting up filters in GA, masking IP addresses. The method shown here is to is remove any user that is logged into the WordPress admin panel from being tracked in GA.

Simply find the location of your GA tracking java script, and wrap it in a PHP if statement that will not be evaluated as true if the user is logged in, thus not showing the GA tracking code. This will only be shown if the users is not logged into the WordPress admin panel.


< ? php if (!$user_ID) : ? >
< script >

GA script here

< / script >
< ? php endif; ? >