You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/activities/development-guides.mdx
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -888,9 +888,19 @@ This example is being done entirely on the client, however, a more common patter
888
888
889
889
### Prompting Users to Share Incentivized Links
890
890
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 withaffiliates (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.
892
901
893
902
#### Implementation Overview
903
+
894
904
1. Create and track an incentivized link for a promotional campaign, then prompt users to share the link
895
905
2. Handle incoming referrals and grant valid rewards
message: 'Click this link to redeem 5 free coins!',
912
922
custom_id: customId,
913
-
// referrer_id is optional - if omitted, the current user's ID is used
914
923
});
915
924
916
925
if (success) {
@@ -924,6 +933,7 @@ try {
924
933
```
925
934
926
935
#### Handling Incoming Referrals
936
+
927
937
When a user clicks a shared link, your activity will launch with referral data available through the SDK:
928
938
929
939
```javascript
@@ -961,10 +971,12 @@ async function handleReferral() {
961
971
```
962
972
963
973
#### Link Sharing Best Practices
974
+
964
975
- Generate unique, non-guessable `customId`s
965
976
- Track and validate referrals to prevent abuse
966
977
- Handle edge cases like expired promotions gracefully
967
978
- 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.
0 commit comments