-
Notifications
You must be signed in to change notification settings - Fork 0
Referral link updates #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Amanda-Kauppinen
wants to merge
4
commits into
main
Choose a base branch
from
referral-link-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ba907db
availability-management: updated line numbers
Amanda-Kauppinen 222dc02
use-protected-data-in-emails: Added info about private data in use no…
Amanda-Kauppinen ee178ed
referral-links: New article describing how referral links work
Amanda-Kauppinen 58053a4
Added examples of console, link, and user type config structure
Amanda-Kauppinen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+85.2 KB
...cepts/users-and-authentication/referral-links/console-referral-link-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions
87
content/concepts/users-and-authentication/referral-links/index.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| --- | ||
| title: Referral links in Sharetribe | ||
| sidebarTitle: Referral links | ||
| description: | ||
| This article explains how referral links work in Sharetribe, including | ||
| how referral parameters are captured, persisted as referral data, and | ||
| saved to user data on sign-up. | ||
| --- | ||
|
|
||
| import { Callout } from 'nextra/components'; | ||
|
|
||
| # Referral links in Sharetribe | ||
|
|
||
| Referral links allow operators to track how new users arrive at the | ||
| marketplace. When a user follows a referral link, the referral | ||
| parameters in the URL are validated against the referral sources | ||
| configured for each user type in Console. If the user then signs up | ||
| before the expiry window, the referral data is saved to their private | ||
| data. | ||
|
|
||
| ## Configuring referrals in Console | ||
|
|
||
| Referral sources are configured per user type in Console, so a referral | ||
| link is only valid for users who match the expected user type on | ||
| sign-up. | ||
|
|
||
|  | ||
|
|
||
| For more information on setting up referrals, refer to the | ||
| [Help Center article](). {/* TODO: Add Help Center article link */} | ||
|
|
||
| ## How referral links work | ||
|
|
||
| Referral data is captured from the URL on any page load, meaning any | ||
| page on the marketplace can serve as an entry point for a referral link. | ||
| In pages where the URL directly impacts API query parameters - for | ||
| example the search page - the referral link is filtered out of the | ||
| params before the query is made. | ||
|
|
||
| A referral link uses the URL parameter name defined in Console combined | ||
| with a referral code. For example, a referral link for a cycling club | ||
| partnership might look like this: | ||
|
|
||
| ``` | ||
| /signup?clubReferral=referral-code | ||
| ``` | ||
|
|
||
| <Callout type="warning"> | ||
| If your custom search code passes URL parameters directly to API | ||
| queries - for example, by spreading `location.search` params into a | ||
| listings query - referral link parameters may be unintentionally | ||
| included. Filter them out before making API calls. See | ||
| [SearchPage.duck.js](https://github.com/sharetribe/web-template/blob/main/src/containers/SearchPage/SearchPage.duck.js) | ||
| for an example of how the template handles this. | ||
| </Callout> | ||
|
|
||
| ### Persisting referral data | ||
|
|
||
| When referral parameters are found in the URL, they are saved to local | ||
| storage as referral data. The referral data persists for 90 days, so a | ||
| user can follow a referral link and sign up at a later point within that | ||
| window and still have the referral captured. | ||
|
|
||
| ### Validation and sign-up | ||
|
|
||
| When a user signs up, the referral data stored in local storage is | ||
| validated against the referral sources defined for each user type in | ||
| Console. The referral sources for a user type are structured as follows: | ||
|
|
||
| ```json | ||
| { | ||
| "userType": "seller", | ||
| "referralSources": [ | ||
| { | ||
| "label": "Cycling club partnership", | ||
| "parameter": "clubReferral" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| If the referral data is valid and the user matches the expected user | ||
| type, the referral data is saved to the user's private data. | ||
|
|
||
| If the referral data is invalid, or the user's type does not match the | ||
| referral source, sign-up proceeds normally and no referral data is | ||
| saved. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this as someone not familiar with this feature, is there sense in including an example of what the referral URL structure looks like? Is it always static or is the exact structure defined via user type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I'll add an example there.
The structure is static →
userType.referralSourceshas parameter/label but the content of those depend on dynamic definitions set in Console