Data about the logged in user on the site

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:

  1. Go to Settings / Google Tag Manager on your WordPress admin area
  2. Click on the Basic data tab
  3. Click on the Visitors subtab
  4. Put a check mark into the boxes shown on that page

visitorId

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.

visitorLoginState

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.

visitorType

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.