This SDK automatically saves promotion attribution parameters on your landing page, passes source parameters through, and automatically reports click info when conditions are met — reducing the manual work of handling URL parameters, cookies, and redirect chains.
1. SDK capability overview
Save attribution parameters: Automatically detects ps_click_id and ps_ref in the URL and writes them to cookies.
Pass through link parameters: Automatically appends the current page’s attribution parameters to in-page redirect links, reducing parameter loss along the chain.
Auto-report clicks: When ps_token is present in the URL, the page automatically calls the click-reporting endpoint after loading.
2. Installation
Add the following script to your landing page or site’s shared template — ideally at the bottom of the page or in a shared layout.
html #
<script src="https://sdk.partnershare.net/pro/sdk_v2.js"></script>
Once loaded, the SDK runs automatically — no additional initialization is needed to complete cookie writing, parameter pass-through, and auto-reporting logic.
3. Automatic processing flow
- Step 1: Read URL parameters on the current page.
- Step 2: Write
ps_click_idandps_refto cookies. - Step 3: Listen for
<a>link clicks on the page and automatically append attribution parameters to the outgoing link. - Step 4: When
ps_tokenis present in the URL, automatically call the click-reporting endpoint after page load.
4. Parameter reference
4.1 Core attribution parameters #
| Parameter | Source | Purpose | Description |
|---|---|---|---|
ps_click_id | PartnerShare referral link | Click attribution | A click-tracking ID identifying a specific click, used primarily for attributing later signup/payment events |
ps_ref | PartnerShare referral link | Invite-code attribution | The referral invite code, used to supplement attribution when a click ID isn’t available |
4.2 Auto-report parameter #
| Parameter | Purpose | Auto-written to cookie? | Description |
|---|---|---|---|
ps_token | Triggers auto click-reporting | No | When present in the page URL, the SDK automatically calls the click-reporting endpoint after page load |
5. Cookie reference
| Cookie name | Description |
|---|---|
ps_click_id | Stores the click-attribution ID, read later during signup or event postback |
ps_ref | Stores the invite-code attribution info, read later on the landing page or during event postback |
By default the SDK writes cookies with path=/, SameSite=Lax. If the page runs over standard HTTPS, the browser will handle the security attributes per current rules.
6. Simplified flow diagram
- Referral link visit — The user arrives at your landing page via a PartnerShare referral link.
- SDK captures parameters — After the page loads, it automatically reads the attribution parameters from the URL (
ps_click_id,ps_ref). - Save and pass through — Attribution parameters are written to cookies and automatically appended to in-site redirect links.
- Business conversion reads them — At signup, payment, or other key moments, the business layer reads the attribution parameters and submits them to its backend.
- Event postback — The business backend reports the conversion result back to PartnerShare via the conversion-reporting endpoint.
7. Recommended deployment
We recommend deploying the SDK on all promotion landing pages, signup pages, and key redirect pages, to maximize the chance that ps_click_id and ps_ref are preserved.
If your page redirects to a signup page, payment page, or other in-site page, make sure those links use standard <a> tags so the SDK can automatically pass through the parameters.
8. Reading attribution parameters in your own code
Before reporting a signup or payment event, the brand’s server-side typically needs to first read the attribution parameters from the frontend cookies and submit them to its own backend.
javascript #
function getCookie(name) {
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
return match ? decodeURIComponent(match[2]) : '';
}
const clickId = getCookie('ps_click_id');
const inviteCode = getCookie('ps_ref');
console.log({ clickId, inviteCode });
9. Common notes
The SDK only auto-passes through ps_click_id and ps_ref if they’re present in the current URL — it won’t auto-fill other custom parameters.
Auto click-reporting depends on ps_token being present in the URL; if the page doesn’t have that parameter, the SDK won’t proactively call the click-reporting endpoint.
If your page navigation happens via frontend routing, button scripts, or async logic, we recommend manually reading the cookie and re-appending the parameters in that logic rather than relying entirely on native link listeners.
For subsequent signup, payment, or other conversion events, use this together with the [Event Postback] endpoint to complete the full attribution → reward → settlement loop.This SDatically saves promotion attribution parameters on your landing page, passes source parameters through, and automatically reports click info when conditions are met — reducing the manual work of handling URL parameters, cookies, and redirect chains.
1. SDK capability overview
Save attribution parameters: Automatically detects ps_click_id and ps_ref in the URL and writes them to cookies.
Pass through link parameters: Automatically appends the current page’s attribution parameters to in-page redirect links, reducing parameter loss along the chain.
Auto-report clicks: When ps_token is present in the URL, the page automatically calls the click-reporting endpoint after loading.
2. Installation Add the following script to your landing page or site’s shared template — ideally at the bottom of the page or in a shared layout.
html
<script src="https://sdk.partnershare.net/pro/sdk_v2.js"></script>
Once loaded, the SDK runs automatically — no additional initialization is needed to complete cookie writing, parameter pass-through, and auto-reporting logic.
3. Automatic processing flow
Step 1: Read URL parameters on the current page. Step 2: Write ps_click_id and ps_ref to cookies. Step 3: Listen for <a> link clicks on the page and automatically append attribution parameters to the outgoing link. Step 4: When ps_token is present in the URL, automatically call the click-reporting endpoint after page load.
4. Parameter reference
4.1 Core attribution parameters
| Parameter | Source | Purpose | Description |
|---|---|---|---|
ps_click_id | PartnerShare referral link | Click attribution | A click-tracking ID identifying a specific click, used primarily for attributing later signup/payment events |
ps_ref | PartnerShare referral link | Invite-code attribution | The referral invite code, used to supplement attribution when a click ID isn’t available |
4.2 Auto-report parameter
| Parameter | Purpose | Auto-written to cookie? | Description |
|---|---|---|---|
ps_token | Triggers auto click-reporting | No | When present in the page URL, the SDK automatically calls the click-reporting endpoint after page load |
5. Cookie reference
| Cookie name | Description |
|---|---|
ps_click_id | Stores the click-attribution ID, read later during signup or event postback |
ps_ref | Stores the invite-code attribution info, read later on the landing page or during event postback |
By default the SDK writes cookies with path=/, SameSite=Lax. If the page runs over standard HTTPS, the browser will handle the security attributes per current rules.
6. Simplified flow diagram
- Referral link visit — The user arrives at your landing page via a PartnerShare referral link.
- SDK captures parameters — After the page loads, it automatically reads the attribution parameters from the URL (
ps_click_id,ps_ref). - Save and pass through — Attribution parameters are written to cookies and automatically appended to in-site redirect links.
- Business conversion reads them — At signup, payment, or other key moments, the business layer reads the attribution parameters and submits them to its backend.
- Event postback — The business backend reports the conversion result back to PartnerShare via the conversion-reporting endpoint.
7. Recommended deployment We recommend deploying the SDK on all promotion landing pages, signup pages, and key redirect pages, to maximize the chance that ps_click_id and ps_ref are preserved.
If your page redirects to a signup page, payment page, or other in-site page, make sure those links use standard <a> tags so the SDK can automatically pass through the parameters.
8. Reading attribution parameters in your own code Before reporting a signup or payment event, the brand’s server-side typically needs to first read the attribution parameters from the frontend cookies and submit them to its own backend.
javascript
function getCookie(name) {
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
return match ? decodeURIComponent(match[2]) : '';
}
const clickId = getCookie('ps_click_id');
const inviteCode = getCookie('ps_ref');
console.log({ clickId, inviteCode });
9. Common notes The SDK only auto-passes through ps_click_id and ps_ref if they’re present in the current URL — it won’t auto-fill other custom parameters.
Auto click-reporting depends on ps_token being present in the URL; if the page doesn’t have that parameter, the SDK won’t proactively call the click-reporting endpoint.
If your page navigation happens via frontend routing, button scripts, or async logic, we recommend manually reading the cookie and re-appending the parameters in that logic rather than relying entirely on native link listeners.
For subsequent signup, payment, or other conversion events, use this together with the [Event Postback] endpoint to complete the full attribution → reward → settlement loop.