Scoring and Badges Essentials scoring-and-badges-essentials

CAUTION
AEM 6.4 has reached the end of extended support and this documentation is no longer updated. For further details, see our technical support periods. Find the supported versions here.

The AEM Communities scoring and badges feature provides the ability to identify and reward community members.

The details of setting up the feature are described at

This page contains additional technical details:

CAUTION
The implementation structure visible in CRXDE Lite is subject to change.

Displaying Badges displaying-badges

Whether a badge is displayed as text or image is controlled on the client side in the HBS template.

For example, search for this.isAssigned in /libs/social/forum/components/hbs/topic/list-item.hbs,:

{{#each author.badges}}

  {{#if this.isAssigned}}

    <div class="scf-badge-text">

      {{this.title}}

    </div>

  {{/if}}

{{/each}}

{{#each author.badges}}

  {{#unless this.isAssigned}}

    <img class="scf-badge-image" alt="{{this.title}}" title="{{this.title}}" src="{{this.imageUrl}}" />

  {{/unless}}

{{/each}}

If true, isAssigned indicates the badge was assigned for a role and the badge should be displayed as text.

If false, is Assigned indicates the badge was awarded for an earned score and the badge should be displayed as an image.

Any changes to this behavior should be made in a customized script (either override or overlay). See Client-side Customizaton.

Debug Log for Scoring and Badging debug-log-for-scoring-and-badging

To help debug scoring and badging, a custom log file can be setup. The contents of this log file may then be provided to customer support if problems are encountered with the feature.

For detailed instructions, visit Create a Custom Log File.

To quickly setup a slinglog file:

  1. Access the Adobe Experience Manager Web Console Log Support, for example

    • http://localhost:4502/system/console/slinglog
  2. Select Add new logger

    1. Select DEBUG for Log Level

    2. Enter a name for Log File, for example

      • logs/scoring-debug.log
    3. Enter two Logger (class) entries (using + icon)

      • com.adobe.cq.social.scoring
      • com.adobe.cq.social.badging
    4. Select Save

chlimage_1-248

To see log entries:

  • From the Web Console

    • Under the Status menu
    • Select Log Files
    • Search for your Log File name, such as scoring-debug
  • On the server’s local disk

    • The log file is at <server-install-dir>/crx-quickstart/logs/<log-file-name>.log
    • For example, .../crx-quickstart/logs/scoring-debug.log

chlimage_1-249

UGC for Scoring and Badging ugc-for-scoring-and-badging

It is possible to view the UGC related to scoring and badging when the chosen SRP is either JSRP or MSRP, but not ASRP. (If not familiar with these terms, see Community Content Storage and Storage Resource Provider Overview.)

The descriptions for accessing scoring and badging data use JSRP, as the UGC is easily accessible using CRXDE Lite.

JSRP on author: experimenting in the author environment results in UGC that is only visible from the author environment.

JSRP on publish: similarly, if testing on the publish environment, it will be necessary to access CRXDE Lite with administrative privileges on a publish instance. If the publish instance is running in production mode (nosamplecontent runmode), it will be necessary to enable CRXDE Lite.

The base location of UGC on JSRP is /content/usergenerated/asi/jcr/.

Scoring and Badging APIs scoring-and-badging-apis

The following APIs are available for use:

The latest Javadocs for the installed releases are available to developers from the Adobe repository. See Using Maven for Communities: Javadocs.

The location and format of the UGC in the repository is subject to change without warning.

Example Setup example-setup

The screen shots of repository data come from setting up scoring and badging for a forum on two different AEM sites:

  1. An AEM site with an unique id (community site created using wizard):

    • Using the Getting Started Tutorial (engage) site created during the getting started tutorial

    • Locate the forum page node

      • /content/sites/engage/en/forum/jcr:content
    • Add scoring and badging properties

      • scoringRules = [/etc/community/scoring/rules/comments-scoring,
        /etc/community/scoring/rules/forums-scoring]
      • badgingRules =[/etc/community/badging/rules/comments-scoring,
        /etc/community/badging/rules/forums-scoring]
    • Locate the forum component node

      • /content/sites/engage/en/forum/jcr:content/content/primary/forum

        ( sling:resourceType = social/forum/components/hbs/forum)

    • Add property to display badges

      • allowBadges = true
    • A user signs in, creates a forum topic, and is awarded a bronze badge

  2. An AEM site without an unique id:

    • Using the Community Components guide

    • Locate the forum page node

      • /content/community-components/en/forum/jcr:content
    • Add scoring and badging properties

      code language-none
      scoringRules = [/etc/community/scoring/rules/comments-scoring,
      /etc/community/scoring/rules/forums-scoring]
      
      code language-none
      badgingRules =[/etc/community/badging/rules/comments-scoring,
      /etc/community/badging/rules/forums-scoring]
      
    • Locate the forum component node

      • /content/community-components/en/forum/jcr:content/content/forum

        ( sling:resourceType = social/forum/components/hbs/forum)

    • Add property to display badges

      • allowBadges = true
    • A user signs in, creates a forum topic, and is awarded a bronze badge

  3. A user is assigned a moderator badge using cURL:

curl -i -X POST -H "Accept:application/json" -u admin:admin -F ":operation=social:assignBadge" -F "badgeContentPath=/etc/community/badging/images/moderator/jcr:content/moderator.png" http://localhost:4503/home/users/community/w271OOup2Z4DjnOQrviv/profile.social.json

As a user has earned two bronze badges and has been awarded a moderator badge, this is how the user appears with their forum entry:

chlimage_1-250

NOTE
This example does not follow these best practices:
  • scoring rule names should be globally unique; they should not end with the same name.
    An example of what not to do:
    /etc/community/scoring/rules/site1/forums-scoring
    /etc/community/scoring/rules/site2/forums-scoring

  • creating unique badge images for different AEM sites

Access Scoring UGC access-scoring-ugc

Use of the APIs is preferred.

For investigative purposes, using JSRP for the example, the base folder containing scores is

  • /content/usergenerated/asi/jcr/scoring

The child node of scoringis the scoring rule name. Thus, a best practice is that scoring rule names on a server be globally unique.

For the Geometrixx Engage site, the user and their score is in a path contstructed with the scoring rule name, community site’s site id ( engage-ba81p), an unique id, and the user’s id:

  • .../scoring/forums-scoring/engage-ba81p/6d179715c0e93cb2b20886aa0434ca9b5a540401/riley

For the Community Components guide site, the user and their score is in a path constructed with the scoring rule name, a default id ( default-site), an unique id, and the user’s id:

  • .../scoring/forums-scoring/default-site/b27a17cb4910a9b69fe81fb1b492ba672d2c086e/riley

The score is stored in the property scoreValue_tl which may directonly contain a value or indirectly refer to an atomicCounter.

chlimage_1-251

Access Badging UGC access-badging-ugc

Use of the APIs is preferred.

For investigative purposes, using JSRP for the example, the base folder containing information about assigned or awarded badges is

  • /content/usergenerated/asi/jcr

Followed by the path to the user’s profile, ending in a badges folder, such as

  • /home/users/community/w271OOup2Z4DjnOQrviv/profile/badges

Awarded badge awarded-badge

chlimage_1-252

assigned badge assigned-badge

chlimage_1-253

Additional Information additional-information

To display a sorted list of members based on points:

recommendation-more-help
5d37d7b0-a330-461b-814d-068612705ff6