Forum Discussion

Inactive User's avatar
Inactive User
7 years ago

User Metrics / User Statistics

Hello everyone,

 

I would like to include something like this under each users Author Username or Rank on the Forum Message Page.

 

I have tried many variations of: 

<component id="users.widget.single-statistic" metric="net_overall_posts"/>
<component id="users.widget.single-statistic" metric="net_kudos_weight_received"/>
<component id="users.widget.single-statistic" metric="net_accepted_solutions"/>

But I can't get it to work and I also get this error

I have also tried setting the correct Text Keys using information from this thread and this thread

I also do not see the User Metrics component within Studio.

 

 

Any help would greatly be appreciated!

  • Hi etchen,

     

    You can use the following the component which displays statistics about the user's activity in the community, but this will work only on the User profile page.

    <@component id="users.widget.my-statistics"/>

    But, to display this on Forum Message Page, you can customize it by using the rest v2 call:

    <#assign getMetrics = rest("2.0", "search?q=" + "SELECT id,value FROM metrics WHERE id IN('net_overall_posts','net_kudos_weight_received','net_accepted_solutions') and user.id='${user.id}'"?url).data.items/>
    
    <#list  getMetrics  as userMetrics>
    <span>${userMetrics.value}</span>
    </#list>

    Let me know if this helps.

     

    Thanks,

    Payal Uppal

    • Inactive User's avatar
      Inactive User

      Hi Uppal,

       

      Thank you for your reply.

       

      Can you point me in the right direction of where I would apply this?

      <#assign getMetrics = rest("2.0", "search?q=" + "SELECT id,value FROM metrics WHERE id IN('net_overall_posts','net_kudos_weight_received','net_accepted_solutions') and user.id='${user.id}'"?url).data.items/>
      
      <#list  getMetrics  as userMetrics>
      <span>${userMetrics.value}</span>
      </#list>

      Thanks,

      • Payal's avatar
        Payal
        Director

        Inactive User - You have to add this in custom component, create a new component in studio, add this code and then add this component to the Forum Topic Page. 

        https://prnt.sc/im7uax

         

        Thanks,

        Payal Uppal