Skip to content

Getting Started with GetSocial Web SDK

The GetSocial Web SDK allows you to authenticate, attribute, invite and deep link users on the Web. You can use the SDK to drive mobile web users to your app, or allow them to use your website instead of the app, without losing the attribution benefits and social features of GetSocial.

Internally, the SDK uses the GetSocial HTTP API, so you can refer to the API Reference, in addition to the WebSDK Reference.

Create App on the Dashboard

To start using GetSocial, you have to create a free account and login to GetSocial Dashboard. The dashboard provides a web interface to manage all GetSocial services.

  1. Login to GetSocial Dashboard.
  2. Open Add new app wizard.
  3. Fill in App name and upload App icon image.
  4. Click Finish to exit the wizard and go to the App Information screen.
  5. Find your autogenerated app ID under Details.

Initialize the SDK

Using your GetSocial app ID, initialize the SDK:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<!doctype html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title></title>
  <script src="https://websdk.getsocial.im/sdk.min.js"></script>
  <script>
   var getSocial = new GetSocialSDK({appId: "put-your-getsocial-app-id-here"});
  </script>
</head>
<body>
</body>
</html>

Implement Features

Authentication and Referral Data

This method allows you to authenticate as an existing user, or create a new one and get referral data (if any). You must call this method before calling any others.

See API Reference for details.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
var params = {
    "identity_type": "email",
    "value": "example@example.com",
    "token": "d7sf9sd8f7s9d8f78sd"
};
getSocial.auth.authenticate(params)
.then(function (response) {
    console.log("User #" + response.user.id + " is authenticated");
})
.catch(function (error) {
    console.log(error);
});

Create Smart Invites

Using the Web SDK, you can create Smart Invites. These links are supported across Android, iOS and Web.

See API Reference for details.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
var params = {
    "channel": "email",
    "custom_data": {
        "key": "value"
    }
};
getSocial.smartInvites.create(params)
.then(function (invite) {
    console.log(invite.url); // prints "https://myapp.gsc.im/f8d6g7d"
})
.catch(function (error) {
    console.log(error);
});

Referred Users

You can get a list of users that were referred to your app by the current user:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
getSocial.referral.getReferredUsers()
.then(function (users) {
    /**
      [
        {
          "id": "123",
          "name": "User 123",
          "picture": "https://example.com/pictures/user123.png",
          "identities": {
            "email": "example@example.com"
          },
          "install_date": "2006-01-02T15:04:05Z07:00",
          "install_channel": "email"
        }
      ]
      */
    console.log("Referred " + users.length + " users.");
})
.catch(function (error) {
    console.log(error);
});

Next Steps

Well-done! GetSocial SDK is now set up and ready to rock, check what you can do next:

Give us your feedback! Was this article helpful?

😀 🙁