---
title: "Click-Tracking SDK Integration"
id: "1275"
type: "docs"
slug: "sdk2"
published_at: "2026-08-24T06:51:11+00:00"
modified_at: "2026-08-26T02:19:37+00:00"
url: "https://help-new-pro.partnershare.net/en/help/technical/sdk2"
markdown_url: "https://help-new-pro.partnershare.net/en/help/technical/sdk2.md"
excerpt: "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..."
taxonomy_doc_category:
  - "Technical Integration"
---

![Image](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPJyGF1y8mfltQULD6hr47Eio3cwlDF3jyDucB_80_80-1.png)

## Getting Started

4

- [How to Launch Your Affiliate Program on PartnerShare](https://help-new-pro.partnershare.net/en/help/started/ipe)
- [How to Create a Referral Program](https://help-new-pro.partnershare.net/en/help/started/createprogram)
- [What Is Referral Marketing / “Old-Bring-New” Program](https://help-new-pro.partnershare.net/en/help/started/rmp)
- [What is Affiliate Marketing?](https://help-new-pro.partnershare.net/en/help/started/marketing)

![合作伙伴管理 - PartnerShare](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPKHuo_8Hse9tQULBcxdOVHL3PdwlDF3jyDucC_80_80.png)

## Campaign Operations

5

- [Checking Partner Withdrawal Status](https://help-new-pro.partnershare.net/en/help/operations/withdrawal-2)
- [Withdrawal Methods Supported for Partners](https://help-new-pro.partnershare.net/en/help/operations/wm)
- [Affiliate Management](https://help-new-pro.partnershare.net/en/help/operations/promoter)
- [Product Management](https://help-new-pro.partnershare.net/en/help/operations/product-management)
- [Campaign Management](https://help-new-pro.partnershare.net/en/help/operations/campaign)

![支付与交易 - ParterShare](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPJwyP0mL5vltQULAn8_2d-Nx0hglDF3jyZ0QA_80_80.png)

## Payments&Transactions

2

- [Auto-Payout](https://help-new-pro.partnershare.net/en/help/payments/autopayout)
- [Commission Settlement](https://help-new-pro.partnershare.net/en/help/payments/settlement)

![技术集成 - PartnerShare](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPJwDplrTBzltQULCNPWCeBswcaAlDF3jyZ0QB_80_80.png)

## Account Management

2

- [Business Certification Prompts](https://help-new-pro.partnershare.net/en/help/account/bcp)
- [Team Management](https://help-new-pro.partnershare.net/en/help/account/team)

![技术集成 - PartnerShare](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPJwDplrTBzltQULCNPWCeBswcaAlDF3jyZ0QB_80_80.png)

## Technical Integration

5

- [Embedding PartnerShare into Your Product](https://help-new-pro.partnershare.net/en/help/technical/embedding)
- [Conversion Event Postback](https://help-new-pro.partnershare.net/en/help/technical/event)
- [Click-Tracking SDK Integration](https://help-new-pro.partnershare.net/en/help/technical/sdk2)
- [API Authentication & Signature Mechanism](https://help-new-pro.partnershare.net/en/help/technical/api)
- [PartnerShare Product-Authorized Login Integration Guide](https://help-new-pro.partnershare.net/en/help/technical/guide)

![常见问题 - PartnerShare](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPJwbpuanIXltQULBfzi8WsAsVUQlDF3jyDucA_80_80.png)

## Frequently Asked Questions

2

- [Withdrawal FAQ](https://help-new-pro.partnershare.net/en/help/faqen/faq)
- [Legacy Help Center Entrance](https://help-new-pro.partnershare.net/en/help/faqen/legacyhelp)

![快速入门 - PartnerShare](https://help-new-pro.partnershare.net/wp-content/uploads/2026/01/lQLPJyGF1y8mfltQULD6hr47Eio3cwlDF3jyDucB_80_80.png)

## Changelog

2

- [Changelog – 2026.03.05](https://help-new-pro.partnershare.net/en/help/changelog/changelog-2026-03-05)
- [Changelog – 2026.05.15](https://help-new-pro.partnershare.net/en/help/changelog/changelog-2026-05-15)

View Categories

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 [#](#0-toc-title)

```
<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 [#](#1-toc-title)

| 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 [#](#2-toc-title)

| 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

1. **Referral link visit** — The user arrives at your landing page via a PartnerShare referral link.
2. **SDK captures parameters** — After the page loads, it automatically reads the attribution parameters from the URL (`ps_click_id`, `ps_ref`).
3. **Save and pass through** — Attribution parameters are written to cookies and automatically appended to in-site redirect links.
4. **Business conversion reads them** — At signup, payment, or other key moments, the business layer reads the attribution parameters and submits them to its backend.
5. **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 [#](#3-toc-title)

```
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**

1. **Referral link visit** — The user arrives at your landing page via a PartnerShare referral link.
2. **SDK captures parameters** — After the page loads, it automatically reads the attribution parameters from the URL (`ps_click_id`, `ps_ref`).
3. **Save and pass through** — Attribution parameters are written to cookies and automatically appended to in-site redirect links.
4. **Business conversion reads them** — At signup, payment, or other key moments, the business layer reads the attribution parameters and submits them to its backend.
5. **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.

Updated on 26/08/2026

###### Share This Article :

- ![Image](https://help-new-pro.partnershare.net/wp-content/plugins/betterdocs/assets/images/social/share-icon.svg?v=4.3.4)
- [https://www.facebook.com/sharer/sharer.php?u=https://help-new-pro.partnershare.net/en/help/technical/sdk2](https://www.facebook.com/sharer/sharer.php?u=https://help-new-pro.partnershare.net/en/help/technical/sdk2)
- [https://twitter.com/intent/tweet?url=https://help-new-pro.partnershare.net/en/help/technical/sdk2](https://twitter.com/intent/tweet?url=https://help-new-pro.partnershare.net/en/help/technical/sdk2)
- [https://www.linkedin.com/shareArticle?mini=true&url=https://help-new-pro.partnershare.net/en/help/technical/sdk2](https://www.linkedin.com/shareArticle?mini=true&url=https://help-new-pro.partnershare.net/en/help/technical/sdk2)
- [https://pinterest.com/pin/create/button/?url=https://help-new-pro.partnershare.net/en/help/technical/sdk2](https://pinterest.com/pin/create/button/?url=https://help-new-pro.partnershare.net/en/help/technical/sdk2)

[API Authentication & Signature Mechanism](https://help-new-pro.partnershare.net/en/help/technical/api)
[Conversion Event Postback](https://help-new-pro.partnershare.net/en/help/technical/event)

大纲 - [html](#0-toc-title)
- [4.1 Core attribution parameters](#1-toc-title)
- [4.2 Auto-report parameter](#2-toc-title)
  - [javascript](#3-toc-title)
