title: Set user role in Google Analytics with gtag.js
body: <p>I'm trying to set some user properties in my Google Analytics 4.</p>
  <p>I'm setting the logged in user in my application by running these two commands:</p>
  <pre><code>    gtag('config', MEASUREMENT_ID, {
        user_id: String(user?.id),
      });
  
      gtag('set', 'user_properties', {
        role: String(user?.roles[0].key),
        role_name: String(user?.roles[0].name),
      });
  
      gtag('send', 'user_properties');
  </code></pre>
  <p>Then I created a Custom dimension in the Events tab for the User role. When I was creating it, the <code>role</code> property was available and I was able to create that and have this in the Custom dimensions list. Now, I'm trying to use this dimension as filter in the Engagement -&gt; Events, which shows up there but it displays this tooltip saying that there is no data available:</p>
  <p><a href="https://i.stack.imgur.com/sRXKD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sRXKD.png" alt="enter image description here" /></a></p>
  <p>I suspected that the user_properties data have not been sent, then I tried <code>gtag('send', 'pageview');</code> but it stills shows this tooltip.</p>
  <p>What am I missing? thanks in advance</p>