Skip to content

Commit f9f932c

Browse files
authored
[Activities] Ammend guide to clarify referrer_id behavior (discord#7439)
1 parent 0805af8 commit f9f932c

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

docs/activities/development-guides.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,19 @@ This example is being done entirely on the client, however, a more common patter
888888
889889
### Prompting Users to Share Incentivized Links
890890
891-
Incentivized sharing can help grow your Activity through network effects. This guide covers implementing a reward system for users who share links and those who click them.
891+
Incentivized sharing can help grow your Activity through network effects. You can use links in several different ways such as:
892+
893+
- **Referral links.** Users can copy referral links inside your Activity, which include their Discord user ID (`https://discord.com/activities/<your Activity ID>?referrer_id=123456789`), and they can send to their friends. If their friend accepts and starts playing your game, then you gift the referrer something inside your game.
894+
- **Promotions.** You can run a temporary promotion on social media, where you offer a reward if they start playing now. Share a custom link on your social media (`https://discord.com/activities/<your Activity ID>?custom_id=social012025` ). Anyone who clicks that specific link receives something inside your game.
895+
- **Social deep-links.** Currently, when users launch an Activity, they all land in the same place. Instead, you can start deep-linking to contextually relevant points in your game. For example, user A can copy a link inside your Activity for engaging other users (`https://discord.com/activities/<your Activity ID>?referrer_id=123456789&custom_id=visit-location`), and sends the link to their friends in a DM or channel. Then, user B who clicks the link gets taken directly to user A’s location.
896+
- **Turn-based deep-links.** When you send an “it’s your turn” DM to a user, you can include a link which takes them directly to the right game instance and the turn they need to take.
897+
- **Affiliate marketing.** You can work with affiliates (influencers, companies, etc) to advertise your game to their followings, and reward them via a custom link (`https://discord.com/activities/<your Activity ID>?custom_id=influencer1`). Then, for every user that starts playing because of said influencer, you can then pay out to the influencer.
898+
- **Source attribution.** You can use the `custom_id` parameter to figure out how much traffic you’re getting from different marketing sources.
899+
900+
This guide covers implementing a referral link which will feature a reward system for users who share links and those who click them.
892901

893902
#### Implementation Overview
903+
894904
1. Create and track an incentivized link for a promotional campaign, then prompt users to share the link
895905
2. Handle incoming referrals and grant valid rewards
896906

@@ -910,7 +920,6 @@ try {
910920
const { success } = await discordSdk.commands.shareLink({
911921
message: 'Click this link to redeem 5 free coins!',
912922
custom_id: customId,
913-
// referrer_id is optional - if omitted, the current user's ID is used
914923
});
915924
916925
if (success) {
@@ -924,6 +933,7 @@ try {
924933
```
925934
926935
#### Handling Incoming Referrals
936+
927937
When a user clicks a shared link, your activity will launch with referral data available through the SDK:
928938
929939
```javascript
@@ -961,10 +971,12 @@ async function handleReferral() {
961971
```
962972
963973
#### Link Sharing Best Practices
974+
964975
- Generate unique, non-guessable `customId`s
965976
- Track and validate referrals to prevent abuse
966977
- Handle edge cases like expired promotions gracefully
967978
- Consider implementing cool-down periods between shares
979+
- Do not override the `referrer_id` query parameter directly. When present, `referrer_id` is expected to be a Discord snowflake-type user ID, otherwise it will be set to the message's author id.
968980
969981
---
970982

docs/developer-tools/embedded-app-sdk.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,6 @@ shareLink(args: [ShareLinkRequest](#DOCS_DEVELOPER_TOOLS_EMBEDDED_APP_SDK/sharel
717717
```js
718718
const { success } = await discordSdk.commands.shareLink({
719719
message: 'This message is shared alongside the link!',
720-
referrer_id: 'some_referrer_id',
721720
custom_id: 'some_custom_id',
722721
});
723722
success ? console.log('User shared link!') : console.log('User did not share link!');
@@ -1472,11 +1471,10 @@ No scopes required
14721471

14731472
#### ShareLinkRequest
14741473

1475-
| Property | Type |
1476-
|--------------|--------|
1477-
| referrer_id? | string |
1478-
| custom_id? | string |
1479-
| message | string |
1474+
| Property | Type |
1475+
|------------|--------|
1476+
| custom_id? | string |
1477+
| message | string |
14801478

14811479
#### ShareLinkResponse
14821480

0 commit comments

Comments
 (0)