Skip to content

Commit 981e885

Browse files
committed
[Activities] Ammend guide to clarify referrer_id behavior
1 parent f90fb59 commit 981e885

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
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+
1. **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+
2. **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+
3. **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=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+
4. **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+
5. **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+
6. **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

0 commit comments

Comments
 (0)