Support » Plugin: Tracking Code Manager » Disable tracking based on user role

  • This is a great plugin, but it seems like it’s only missing one important feature. I want to disable tracking codes when I’m logged in as an administrator. I also create a custom role for other people, and want to disable it for them too. Right now my data is skewed because it’s accounting for the website views from me and others that are working in the website quite a bit.

    Is there a way to disable tracking codes for logged in users (or for specific user roles)?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author IntellyWP

    (@intellywp)

    Hi @kizinko,
    Thanks for choosing IntellyWP products.

    Unfortunately this feature is not still available on our plugin.
    We’ll keep it in mind for a next version of our plugin.

    Meantime you could edit the following file:

    /tracking-code-manager/includes/core.php

    and replace from line 3 to line 27 with:

    
    add_filter('wp_head', 'tcmp_head');
    function tcmp_head(){
        global $post, $tcmp;
    
        $tcmp->Options->setPostShown(NULL);
        if($post && isset($post->ID) && (is_page($post->ID) || is_single($post->ID))) {
            $tcmp->Options->setPostShown($post);
            $tcmp->Log->info('POST ID=%s IS SHOWN', $post->ID);
        }
    
        //future development
        //is_archive();
        //is_post_type_archive();
        //is_post_type_hierarchical();
        //is_attachment();
    	if( !current_user_can('administrator')) {
        	$tcmp->Manager->writeCodes(TCMP_POSITION_HEAD);
    	} 
    }
    add_action('wp_footer', 'tcmp_footer');
    function tcmp_footer() {
        global $tcmp;
        //there isn't a hook when <BODY> starts
    	if( !current_user_can('administrator')) {
    		$tcmp->Manager->writeCodes(TCMP_POSITION_BODY);
    		$tcmp->Manager->writeCodes(TCMP_POSITION_CONVERSION);
    		$tcmp->Manager->writeCodes(TCMP_POSITION_FOOTER);
    	} 
    }
    

    Please let us know

    Cheers.

    IntellyWP

    Awesome! My only concern is adding this custom code on all my clients’ websites and then losing it across the board when the plugin is updated next. Are you saying you’ll include this in your next update?

    FYI – I’d be happy to check with my team to see if someone on our end can add this as an option in your plugin. All we’d ask for is a followed, branded credit link on the main plugin page to our website. Let me know if that’s of any interest on your end.

    Plugin Author IntellyWP

    (@intellywp)

    Hey @kizinko,

    Thanks for your proposal but we are already working to include this feature in the next plugin update.

    Meantime you could create a customized version or a backup of this file for all your websites.

    Cheers.

    IntellyWP

    Cool deal! Will just wait for the next plugin update then. 👍

    Plugin Author IntellyWP

    (@intellywp)

    Hi @kizinko,

    Perfect 👍

    Let us know if you still need help, we’re more than happy to assist you.

    Cheers.

    IntellyWP

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable tracking based on user role’ is closed to new replies.