Swarm Documentation API Reference

Adding Achievements to your App

Estimated Integration Time: 10 minutes

Achievements are an easy way to entice users to reach for interesting goals (and they have been shown to boost per-session play time while increasing user retention). Do you want to encourage your users to get to level 3? Add an achievement! Do you want your users to try out every level? Add an achievement! You get the idea :).

In this guide, you will learn how to add Achievements by following an example for an achievement that a user unlocks upon reaching level 2.

Prerequisite: Swarm Setup

Step 1: Define Achievements in the Admin Panel
  1. Go to Swarm's Admin Panel (click here).
  2. Click on your app's name in the app list.
  3. Create the achievement and click on Submit.
  4. Write down the Achievement ID number, as you'll need it very soon!

Step 2: Unlock an Achievement
Call the following method to unlock an achievement where ACEHIEVEMENT_ID is the Achievement ID shown in the admin panel.
// Make sure the user has reached level 2
if (level == 2) {

    // Unlock the achievement
[+] Click here to see more control and customization options.

Step 3: Show Achievements List
After the user has completed some achievements, it might be time to add a way for them to see a list of their accomplishments (as well as discover other achievements).

While the user can always get to their achievements from the Swarm Dashboard, try adding the following line of code to take the user directly to the achievements list.


Now you know how to add achievements to your apps. It's not too tough, right? If you'd like to take it one step further, you can customize the look and feel of your achievements with Swarm's complete APIs.

Have you added Leaderboards or a Virtual Store yet? They both offer more great ways to improve your app!