Help Center user segmentation using Google Analytics custom dimensions

36 コメント

  • Ryan McGrew
    Zendesk Product Manager

    Hey Dan!

    This identifier is actually a 1 way sha1 hash of the user id so you can't decrypt it. However, you could potentially user the email address in the user object for this. That should be a unique identifier for the user.

    You can also use the API endpoint /api/v2/users/me.json to get the current user information, including id.

    Thanks!

    0
  • Ryan McGrew
    Zendesk Product Manager

    I just realized the below comment won't work. Please disregard

    ***

    I also just realized that we also have the user object in the template that you could use as well to assign a variable in JavaScript.

    *** 

    Thanks!

    0
  • George Panoschi

    Hi, could anyone help me make a segment from a website that is not structured with " / " ?

    0
  • Bill Cicchetti

    Resurrecting this article.

     

    So I am trying to create a custom dimension in GA for user role.

    1) I have GA activated and see out of box reports and dashboards populated.

    2) I added this to the script.js file

     

    //send user role to Google Analytics

    var userRole = HelpCenter.user.role;
    ga('set', 'dimension1', userRole);
    ga('send', 'pageview');

    });

     

    I went into Chrome DEV Tools and saw no errors.

    3) I logged into GA and create a custom dimension

     

    If this all looks correct  how to I add a criteria to a custom report to filter on end users?

    Do I need a specific value for dimension and filter?

     

     

    0
  • Chris Stock
    Community Moderator

    Hi Bill Cicchetti, you're almost there. The final piece of the puzzle is to create a custom segment that uses the values recorded by your custom dimension.

    You'll see an 'Add Segment' box at the top of most of the GA reporting pages:

    Click on this, then on 'New Segment':

    Then select 'Conditions', under the 'Advanced' heading on the side-panel:

    From there you'll need to search for your custom dimension in the first conditional select menu (mine is called User Role, yours would be userRole):

    Change the operator from 'contains' to 'exactly matches', and then select the value you want to segment (i.e. end_user, anonymous, agent etc.).

    That should be all there is to it.

    0
  • Evan Walker

    Hey there!

     

    I'm trying to get this to work, and I just can't seem to capture the user roles in Google Analytics, when I search it keeps coming up with nothing. I've added a custom segment like the previous comment advised, and when I try to search it still comes up with nothing.

     

    This is the code I've added to the Help Center:

        // GA Custom Dimensions
    var userRole = HelpCenter.user.role;
    ga('set', 'dimension1', userRole);
    ga('send', 'pageview');
     
    });
     
    And this is what the custom definition looks like:
     
     
     
    As you can see, I tried to emulate what the previous successful commenter was able to do, but I'm not getting any results. Can someone assist?
     
    0

サインインしてコメントを残してください。

Powered by Zendesk