WordPress Help Articles

MS Clarity Exclude Logged In Users

MS Clarity Exclude Logged In Users

How to Use

Download > Install > Activate. Use your favorite IDE or just edit within the WordPress plugin editor. Change “xxxxxxxxxx” to be your Clarity ID.

Not associated with Microsoft® Clarity®


This prevents me from recording my logged in, back-end work. Prevents script from executing while logged in as Author or above so it will still run for WooCommerce customers.


This code can be pasted into the functions.php file of your child theme or, download and install the plugin for simple code activation.

function viawebs_plugins_clarity_exclude_logged_in(){
    if ( ! current_user_can( 'edit_posts' ) ) {
<script type="text/javascript">
    })(window, document, "clarity", "script", "xxxxxxxxxx"); // <--- add the site id here

add_action( 'wp_head', 'viawebs_plugins_clarity_exclude_logged_in' );

Via Webs Offers WordPress Hosting & Maintenance Services For Those That Prefer To Focus On Something Other Than The Technical Aspects

Our rollover development time lets you save unused hours for future assistance. Stay updated and optimized, with the flexibility to invest in new functionality.

Article Categories

Dive in to something specific you are wanting to learn more about.

Let's Get Started!