Tracking internal users on wordpress

前端 未结 2 679
温柔的废话
温柔的废话 2021-01-06 17:27

We have an internal WordPress site, and about 25 users. Our current Google analytics set-up will show us how many times a page has been visited, but because everyone comes f

2条回答
  •  不知归路
    2021-01-06 18:24

    You can use the _setCustomVar method from the JavaScript API to provide the user name of the current user. To my knowledge no GA plugins for Wordpress support this, so you will need to put your tracking code directly into the theme or write a custom plugin for it. The custom variable will then show up as a segment in Google Analytics. To get the current user you can use the wp_get_current_user API call.

    Your tracking code would then look something like this:

    user_login;
        }
    ?>
    
    

    For the Universal Analytics version:

    user_login;
        }
    ?>
    
    

提交回复
热议问题