How do I set up my website to use Google’s User ID?


I can see that people have posted similar questions but I haven’t been able to find a working solution and thought I would post my situation to see if someone can point out what I’m doing wrong.
The website concerned has one public page and a member area that must be logged into before anything is seen. I’ve been advised that Google’s User ID will help with tracking the pages visited by members in the private area. It’s a non-profit club hence trying to find a free solution.

In Google, I have switched on Tracking Info > User ID and created a custom report (Member_Activity). I have also in Custom Definitions > Custom Dimensions created a dimension (dimension1) called Custom_User_ID.

In each page’s header of the website is the following code:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-nnnnnnnnn');
    var dimensionValue = 'member_id';
    ga('set', 'dimension1', dimensionValue); // Set the user ID using signed-in user_id.
    ga('send', 'pageview');

The idea is that each logged in user has a WordPress ‘member_id’ value and this value is given to ‘dimension1’. This is then sent to Google with the page being viewed. (member_id is being used to maintain user anonymity.)

I change the Google Analytics screen from All Web Site Data view to either Member_Activity or Dimension_Value but the results show zero activity. (I have been active on the site via a separate session and another browser.)

What am I doing wrong? What do I need to do to track the pages or links visited by each member?


Davo 8 months 2020-12-12T09:10:38-05:00 0 Answers 14 views 0

Leave an answer