---
title: "推广点击跟踪 SDK 接入"
id: "584"
type: "docs"
slug: "sdk"
published_at: "2026-01-07T06:19:28+00:00"
modified_at: "2026-09-07T06:15:06+00:00"
url: "https://help-new-pro.partnershare.net/help/api/sdk"
markdown_url: "https://help-new-pro.partnershare.net/help/api/sdk.md"
excerpt: "SDK 在落地页自动保存推广归因参数、把参数透传到站内跳转链接，并在满足条件时自动回传点击。 接入后无需手动处 […]"
taxonomy_doc_category:
  - "技术集成"
---

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

## 快速入门

6

- [什么是推荐营销/老带新计划](https://help-new-pro.partnershare.net/help/start-guides/referral-marketing)
- [什么是联盟营销](https://help-new-pro.partnershare.net/help/start-guides/affiliate-marketing)
- [推荐计划和联盟计划有什么区别？](https://help-new-pro.partnershare.net/help/start-guides/referral-vs-affiliate)
- [如何创建推荐计划](https://help-new-pro.partnershare.net/help/start-guides/add-referral-marketing)
- [如何创建联盟营销活动](https://help-new-pro.partnershare.net/help/start-guides/add-affiliate-marketing)
- [如何提升推广效果](https://help-new-pro.partnershare.net/help/start-guides/improving-promotion-effectiveness)

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

## 推广运营

6

- [推荐计划](https://help-new-pro.partnershare.net/help/promoters/%e6%b4%bb%e5%8a%a8%e7%ae%a1%e7%90%86)
- [联盟营销活动](https://help-new-pro.partnershare.net/help/promoters/%e8%81%94%e7%9b%9f%e8%90%a5%e9%94%80%e6%b4%bb%e5%8a%a8)
- [产品管理](https://help-new-pro.partnershare.net/help/promoters/%e4%ba%a7%e5%93%81%e7%ae%a1%e7%90%86)
- [推广者管理](https://help-new-pro.partnershare.net/help/promoters/data)
- [合作伙伴支持的提现方式](https://help-new-pro.partnershare.net/help/promoters/withdrawal-methods)
- [查询合作伙伴提现状态](https://help-new-pro.partnershare.net/help/promoters/withdrawal-status)

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

## 支付与交易

2

- [佣金结算](https://help-new-pro.partnershare.net/help/payment/commission)
- [提现托管功能](https://help-new-pro.partnershare.net/help/payment/auto-payouts)

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

## 账户管理

2

- [团队管理功能](https://help-new-pro.partnershare.net/help/team/%e5%9b%a2%e9%98%9f%e7%ae%a1%e7%90%86%e5%8a%9f%e8%83%bd)
- [企业认证提示](https://help-new-pro.partnershare.net/help/team/certification)

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

## 技术集成

8

- [API 鉴权与签名机制](https://help-new-pro.partnershare.net/help/api/signature)
- [推广转化事件回传](https://help-new-pro.partnershare.net/help/api/event-report)
- [推广点击跟踪 SDK 接入](https://help-new-pro.partnershare.net/help/api/sdk)
- [转化退款](https://help-new-pro.partnershare.net/help/api/conversion-refund)
- [转化作废](https://help-new-pro.partnershare.net/help/api/conversion-void)
- [将 PartnerShare 内嵌到产品中](https://help-new-pro.partnershare.net/help/api/iframe)
- [推广者资源接口](https://help-new-pro.partnershare.net/help/api/promoter-resources)
- [PartnerShare 产品授权推广登录接入指南](https://help-new-pro.partnershare.net/help/api/partnershare-integration)

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

## 常见问题

2

- [旧版帮助中心入口](https://help-new-pro.partnershare.net/help/faq/%e6%97%a7%e7%89%88%e5%b8%ae%e5%8a%a9%e4%b8%ad%e5%bf%83%e5%85%a5%e5%8f%a3)
- [提现相关](https://help-new-pro.partnershare.net/help/faq/withdrawal)

![Image](https://help-new-pro.partnershare.net/wp-content/uploads/2026/03/B706BBD1-A488-44A9-B7CC-AD90B607DD45-150x150.png)

## 更新日志

2

- [更新日志 – 2026.05.15](https://help-new-pro.partnershare.net/help/update/%e6%9b%b4%e6%96%b0%e6%97%a5%e5%bf%97-2025-05-15)
- [更新日志-2026.03.05](https://help-new-pro.partnershare.net/help/update/update2026-3-5)

View Categories

SDK 在落地页自动保存推广归因参数、把参数透传到站内跳转链接，并在满足条件时自动回传点击。

接入后无需手动处理 URL 参数、Cookie 和跳转链路，注册、付费等事件回传时直接从 Cookie 读取归因参数。

### 1. 能力概览 [#](#0-toc-title)

| 能力 | 说明 |
| --- | --- |
| 保存归因参数 | 识别 URL 中的 ps_click_id 与 ps_ref，写入 Cookie |
| 透传链接参数 | 监听页面内 <a> 标签点击，把归因参数追加到站内跳转链接 |
| 自动上报点击 | URL 中带有 ps_token 时，页面加载后自动请求点击上报接口 |

### 2. 接入方式 [#](#1-toc-title)

在落地页或站点公共模板中引入以下脚本，建议放在页面底部或公共布局中统一引入。

```
<script src="https://sdk.partnershare.net/pro/sdk_v2.js"></script>
```

SDK 加载后自动执行，无需初始化调用。

### 3. 执行流程 [#](#2-toc-title)

1. 读取当前页面 URL 参数。
2. 将 `ps_click_id` 与 `ps_ref` 写入 Cookie。
3. 监听页面内 `<a>` 链接点击，把归因参数追加到跳转链接。
4. URL 中存在 `ps_token` 时，页面加载后自动请求点击上报接口。

### 4. 参数说明 [#](#3-toc-title)

| 参数 | 来源 | 写入 Cookie | 说明 |
| --- | --- | --- | --- |
| ps_click_id | PartnerShare 推广链接跳转 | 是 | 点击追踪 ID，标识一次具体点击，注册、付费等事件优先按该值归因 |
| ps_ref | PartnerShare 推广链接跳转 | 是 | 推广邀请码，无法获取点击 ID 时用于补充归因 |
| ps_token | PartnerShare 推广链接跳转 | 否 | 存在时触发自动点击上报 |

### 5. Cookie 约定 [#](#4-toc-title)

| Cookie | 说明 |
| --- | --- |
| ps_click_id | 点击归因 ID，注册或事件回传时读取 |
| ps_ref | 邀请码，落地页或后续事件回传时读取 |

Cookie 以 `path=/`、`SameSite=Lax` 写入。HTTPS 环境下按浏览器规则处理安全属性。

### 6. 归因链路 [#](#5-toc-title)

1. 用户从 PartnerShare 推广链接进入落地页。
2. SDK 读取 URL 中的 `ps_click_id`、`ps_ref` 并写入 Cookie。
3. 用户在站内跳转时，SDK 把归因参数追加到链接。
4. 注册、付费等节点，前端读取 Cookie 中的归因参数提交给业务后端。
5. 业务后端调用 [推广转化事件回传](https://www.partnershare.net/help/api/event-report) 接口回传转化。

### 7. 读取归因参数 [#](#6-toc-title)

服务端回传注册或付费事件前，先由前端读取 Cookie 并提交到业务后端：

```
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');
```

### 8. 接入注意事项 [#](#7-toc-title)

- SDK 部署在所有推广落地页、注册页和关键跳转页面，避免 `ps_click_id` 与 `ps_ref` 丢失。
- 只有通过标准 `<a>` 标签的跳转会被自动透传。前端路由、按钮脚本或异步跳转需在对应逻辑中手动读取 Cookie 并补齐参数。
- SDK 只透传 `ps_click_id` 与 `ps_ref`，不处理其他自定义参数。
- 自动点击上报依赖 URL 中的 `ps_token`，没有该参数时 SDK 不会请求点击上报接口。

更新 07/09/2026

###### 分享这篇文章 ：

- ![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/help/api/sdk](https://www.facebook.com/sharer/sharer.php?u=https://help-new-pro.partnershare.net/help/api/sdk)
- [https://twitter.com/intent/tweet?url=https://help-new-pro.partnershare.net/help/api/sdk](https://twitter.com/intent/tweet?url=https://help-new-pro.partnershare.net/help/api/sdk)
- [https://www.linkedin.com/shareArticle?mini=true&url=https://help-new-pro.partnershare.net/help/api/sdk](https://www.linkedin.com/shareArticle?mini=true&url=https://help-new-pro.partnershare.net/help/api/sdk)
- [https://pinterest.com/pin/create/button/?url=https://help-new-pro.partnershare.net/help/api/sdk](https://pinterest.com/pin/create/button/?url=https://help-new-pro.partnershare.net/help/api/sdk)

[推广转化事件回传](https://help-new-pro.partnershare.net/help/api/event-report)
[PartnerShare 产品授权推广登录接入指南](https://help-new-pro.partnershare.net/help/api/partnershare-integration)

大纲 - [1. 能力概览](#0-toc-title)
- [2. 接入方式](#1-toc-title)
- [3. 执行流程](#2-toc-title)
- [4. 参数说明](#3-toc-title)
- [5. Cookie 约定](#4-toc-title)
- [6. 归因链路](#5-toc-title)
- [7. 读取归因参数](#6-toc-title)
- [8. 接入注意事项](#7-toc-title)
