This plugin can add several Data Layer variables which enable you to control your tags and triggers based on whether the user is logged in and with what user level.
How to enable visitor data?
This feature is disabled by default which means that you will need to enable it:
- Go to Settings / Google Tag Manager on your WordPress admin area
- Click on the Basic data tab
- Click on the Visitors subtab
- Put a check mark into the boxes shown on that page
This variable will include the internal ID of the logged in user. The primary use of this variable is to setup User-ID tracking in Google Analytics. This value is not included in the Data Layer if there is no logged in user even if you enabled the feature on the settings page of this plugin.
This is a very simple Data Layer variable: the value logged-in means someone is logged in to your site regardless of the user level. The value logged-out means that an anonymous user is on your site.
You can use this variableÂ to identify the user level (aka. user role) of the logged in user.
If there is no logged in user on your site, the valueÂ visitor-logged-out will indicate that state. If a WordPress user is logged in, the name of the role of the logged in user will be included. For admin this will be administrator, for lower level users this can be something else like editor.