0
votes

I have a Drupal website with a few different roles. I can't figure out how to view the breakdown of those roles within Google Analytics.

Here is a screenshot of my GA Module in Drupal;

enter image description here

I want to get page views statistics broken down by a role or if they're just not logged in (that's an "anonymous user", right?!).

But I can't see where this breakdown is available to view in the Google Analytics webpage anywhere.

I am confident that I've got it hooked up correctly as I can see my tracking through different pages on my Drupal site. I just don't know how to break down by Role.

***** EDIT / UPDATE *****

I've done some further reading and it seems you need to do the following;

First go in to Google Analytics and navigate to Admin -> Custom Definitions -> Custom Dimensions. And then click NEW CUSTOM DIMENSION. Call it something like "User Roles".

Then over in Drupal, navigate to Custom Dimensions within the Google Analytics Module and do something like;

enter image description here

That text is small but it says [current-user:roles] - you can see a list of avaible inputs by clicking "Browse available tokens" further down the page. There are dozens of options!

Now I am playing the waiting game and hoping for this to take effect.

EDIT TWO;

Here is proof that the dimension is being set when inspecting the colsole log via Google Analytics Debugger (A Chrome Extenstion which seems really useful).

enter image description here

That's me, but logged out. And I get "Super Administrator" when logged in.

1
Where is Roles being sent to? Have you set up Custom Dimensions (my assumption for where Roles is being sent)sdhaus
@sdhaus I've not set up Custom Dimensions at all. I didn't know what they were for.mikelovelyuk

1 Answers

0
votes

I seem to have solved this. So as well as the screen shots and information above this is basically the steps to get Google Analytics working with User Roles on Drupal.

  1. Once you've installed the Google Analytics Module on Drupal, make sure you go to "Roles" and select all user types
  2. Go to Google Analytics and navigate to Admin -> Custom Definitions -> Custom Dimensions. Click "NEW CUSTOM DIMENSION" and add a custom dimension called "User Roles".
  3. Back in Drupal, navigate to Custom Dimensions within the Google Analytics Module and add "[current-user:roles]" to the Value field for the "1" index number key (see OP for more info)

  4. In Google Analytics, navigate to Behaviour -> Site Content -> All Pages and where is says "Secondary Dimension" (with a dropdown), select the dropdown, select Custom Dimensions from the dropdown, and select User Roles (if it's not there, this hasn't worked for you for some reason). But that should load the screen something like; enter image description here

Hope this helps.