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
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,13 @@ These guides include suggested development practices, SDK commands, and user flo
96
96
</Card>
97
97
</Container>
98
98
99
+
## Links
100
+
<Container>
101
+
<Cardtitle="Prompting Users to Share Incentivized Links"link="#DOCS_ACTIVITIES_DEVELOPMENT_GUIDES/prompting-users-to-share-incentivized-links">
102
+
Have your users share links to your activity, with tracking and incentives.
103
+
</Card>
104
+
</Container>
105
+
99
106
## Assets & Metadata
100
107
<Container>
101
108
<Cardtitle="Setting Up Activity Metadata"link="#DOCS_ACTIVITIES_DEVELOPMENT_GUIDES/setting-up-activity-metadata">
@@ -879,6 +886,35 @@ This example is being done entirely on the client, however, a more common patter
879
886
880
887
---
881
888
889
+
### Prompting Users to Share Incentivized Links
890
+
Virality is a valuable way to grow your userbase and your application. In order to leverage network effects, we suggest using our SDK's `shareLink` command to prompt users to share so-called "incentivized links" and receive rewards for sharing.
891
+
892
+
An example reward would be something like free coins (or any other in-game resource) for users who click the link and for those who shared the link.
893
+
894
+
To share the link, use `shareLink`.
895
+
```javascript
896
+
// custom ID creation, persistence, and resolution is up to you as a developer
message:'Click this link to redeem 5 free coins!',
901
+
custom_id: customId,
902
+
});
903
+
success ?console.log('User shared link!') :console.log('User did not share link!');
904
+
```
905
+
Calling `shareLink` will prompt the user with a modal to share the link. The `success` returned indicates if the link was shared or copied. Note that we did not add a `referrer_id` in this example, as the user ID will automatically be appended as a referrer if left empty.
906
+
907
+
So now that the initial user has shared a link, what happens when their friend receives the message and clicks the link?
908
+
Clicking the link (or Play from the Embed) will launch the activity and pass the `customId` and `referredId` to the SDK. From there you can resolve the IDs and grant the rewards as promised.
909
+
910
+
```javascript
911
+
// for illustrative purposes -- this must be implemented by you as a developer
912
+
awaitresolvePromotion({
913
+
customId:DiscordRPC.customId, // your promotional ID, which corresponds to granting reward (coins)
914
+
refererId:DiscordRPC.referredId, // the user ID of the initial user who shared the link
915
+
});
916
+
```
917
+
882
918
### Preventing unwanted activity sessions
883
919
884
920
Activities are surfaced through iframes in the Discord app. The activity website itself is publicly reachable at `<application_id>.discordsays.com`. Activities will expect to be able to communicate with Discord's web or mobile client via the Discord SDK's RPC protocol. If a user loads the activity's website in a normal browser, the Discord RPC server will not be present, and the activity will likely fail in some way.
0 commit comments