Skip to main content

JavaScript security

JavaScript Security gives you fine-grained control over permissions for JavaScript write APIs. Properly configuring these settings helps protect your platform from potential exploits while allowing legitimate functionality.

Why security matters

Since JavaScript activities run in the browser, users with technical knowledge could potentially manipulate these calls to gain unfair advantages. The security settings let you precisely control which actions can be performed through JavaScript.

Permission categories

Activity tracking permissions

These settings control which gamification activities can be tracked through the JavaScript Activities API:

Permission typeDescriptionSecurity implications
Points management
Set pointsDirectly set point balancesCould be used to artificially inflate points
Increment pointsAdd points to existing balanceLower risk than set points, but still gameable
Redeem pointsAllow spending pointsCould deplete points if compromised
Refund pointsReturn redeemed pointsCould be used to duplicate points if combined with other exploits
Coupon handling
Redeem couponApply coupon benefitsPotential for coupon abuse
Refund couponReturn a redeemed couponCould lead to unlimited coupon usage
Bounty management
Start bountyBegin a new bountyCould create unauthorized challenges
Cancel bountyEnd a bounty prematurelyCould interfere with active promotions
Award bountyGrant a bounty rewardCould award unearned benefits
Other actions
Track behaviourRecord user activitiesFundamental to gamification, but easily spoofed
Create giftGenerate gifts for usersRequired for gifting widget

User management permissions

You can also enable creation and modification of users through the JavaScript User APIs:

  • Create users
  • Update users

Important considerations

Behaviour tracking

The "Track behaviour" setting is a master control for whether any behaviours can be tracked via JavaScript. However, each individual behaviour must also have JavaScript tracking explicitly enabled in its configuration:

  1. Navigate to the specific behaviour
  2. Go to its Security settings
  3. Enable JavaScript tracking

This two-level permission system allows fine-grained control over which specific behaviours can be tracked through JavaScript.

Gifting functionality

The "Create gift" permission must be enabled for the Gifting Widget to function properly. If you're experiencing issues with the gifting widget, verify this permission is activated.

Troubleshooting security settings

If your JavaScript tracking isn't working as expected:

  1. Check the global JavaScript security settings
  2. Verify individual behaviour settings
  3. Look for console errors that might indicate permission issues
  4. Test with the simulator
tip

Note: These options are disabled by default to prevent cheating. Since activities can be tracked via the browser, technically skilled users could potentially create artificial activities that weren't actually performed.

Security best practices

When configuring JavaScript security:

  1. Only enable permissions required by your implementation
  2. Regularly audit which permissions are enabled
  3. Consider using server-side tracking for high-value activities
  4. Implement additional validation where possible