> For the complete documentation index, see [llms.txt](https://knowledgebase.offer18.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.offer18.com/zh/lian-meng-huo-ban/ji-cheng/google-ads-ji-cheng-web-sdk.md).

# Google Ads 集成 - Web SDK

为了与 Google Ads 集成，我们建议使用带有 Web SDK 的直接方法，而不是重定向方法。在 Google Ads 的跟踪模板字段中使用广告主的链接，以便在 Offer18 中通过 Web SDK 无缝跟踪转化。这种方法可提高广告表现监测的准确性和效率。

### 创建活动

1. 使用广告主链接在 Offer18 中创建 Offer
2. 获取 Affiliate 跟踪 URL 或曝光（Impression）URL 并移除 Affiliate ID `(&a=0000)`&#x20;

{% code overflow="wrap" %}

```
示例跟踪 URL : https://example.o18.link/c?o=0000000&m=0000
示例曝光 URL : https://example.o18.link/i?o=0000000&m=0000
```

{% endcode %}

3. 在 Web SDK 中使用此 URL

#### 在 Google Ads 创建广告活动&#x20;

1. 登录 Google Ads 帐户
2. 点击 "**+ NEW CAMPAIGN**" 创建新广告活动
3. 选择广告活动目标，例如 - **销售、线索、网站流量、** 等。&#x20;
4. 定义 **活动名称、定位和预算**
5. 定义 **广告组** 和 **关键字**
6. 创建广告 **» 广告 URL 选项**
7. 投放地点 **广告主 URL** 放在 “**跟踪模板**"

{% hint style="warning" %}

#### **在将广告主 URL 添加到跟踪模板之前进行修改**

您应在广告主的 URL 中以查询参数形式包含 Affiliate ID。此处使用的参数键将在 Web SDK 中用于检索 Affiliate ID。
{% endhint %}

{% code title="示例广告主 URL" %}

```
https://example.com?<YOUR-PARAMETER-KEY>=00000
```

{% endcode %}

8. 添加 URL 后缀（如有）
9. 转到 "保存广告"

#### [<mark style="color:蓝色;">**了解有关在 Google Ads 创建广告活动的更多信息**</mark>](/zh/lian-meng-huo-ban/ji-cheng/google-ads-ji-cheng.md#create-campaign)

***

## 广告主端集成

在广告主端设置集成时，使用数据跟踪链接配置 WebSDK。

要开始使用 Offer18 的 Web SDK 进行追踪，需要在网站中添加一个 script 标签。

<mark style="color:紫色;">放置位置：页眉（所有页面）</mark>

{% code fullWidth="false" %}

```html
<script src="https://web-resources.offer18.net/sdk/web/WebSDK.js"></script>
```

{% endcode %}

### 追踪点击

要使用 SDK 追踪点击，请在脚本中添加以下代码。

<mark style="color:紫色;">放置位置：页眉（所有页面）</mark>

{% code fullWidth="false" %}

```html
<script>
    window.Offer18WebSDK.trackClick({
        trackingURL: '<YOUR-TRACKING-LINK>',
        keymapping: ['a:<YOUR-PARAMETER-KEY>']
    });
</script>
```

{% endcode %}

{% tabs %}
{% tab title="对象配置 - window\.Offer18WebSDK.trackclick()" %}

1. **trackingURL** （必填）: 替换 `<YOUR-TRACKING-LINK>` 为不包含 Affiliate ID 的跟踪 URL
2. **keymapping** : 替换 `<YOUR-PARAMETER-KEY>` 为在 Google Ads 中用于传递 Affiliate ID 的参数键
   {% endtab %}
   {% endtabs %}

### 追踪展现

要使用 SDK 跟踪曝光，请将以下代码添加到您的脚本中。

<mark style="color:紫色;">放置位置：页眉（所有页面）</mark>

{% code fullWidth="false" %}

```html
<script>
    window.Offer18WebSDK.trackClick({
        impressionURL: '<YOUR-IMPRESSION-LINK>',
        keymapping: ['a:<YOUR-PARAMETER-KEY>']
    });
</script>
```

{% endcode %}

{% tabs %}
{% tab title="对象配置 - window\.Offer18WebSDK.trackclick()" %}

1. **impressionURL** （必填）: 替换 `<YOUR-TRACKING-LINK>` 为不包含 Affiliate ID 的曝光 URL&#x20;
2. **keymapping** : 替换 `<YOUR-PARAMETER-KEY>` 为在 Google Ads 中用于传递 Affiliate ID 的参数键
   {% endtab %}
   {% endtabs %}

### 追踪转化

广告主必须将以下代码片段添加到所有落地页中，但不包括订单确认 / 订单成功（感谢）页面。

<mark style="color:紫色;">放置位置：感谢页/订单成功页（单页）</mark>

```html
<script>
    window.Offer18WebSDK.trackConversion({
        domain: '',
        accountId: '',
        offerId: '',
        coupon:'',
        postbackType: '', // 'iframe' or 'pixel'
        isGlobalPixel: false, // true or false
        allowMultiConversion: false, // true or false
        conversionData: {
            event: '', // Event Name (Please specify the event)
            payout: '', // Payout Amount (Please specify the payout amount)
            sale: '', // Sale Amount (Please specify the sale amount)
            currency: '',
            adv_sub1: '',
            adv_sub2: '',
            adv_sub3: '',
            adv_sub4: '',
            adv_sub5: '',
        }
    })
</script>
```

点击下面的链接了解有关 Offer18 的 Web SDK 的更多信息

{% content-ref url="/pages/b6eeace03ef61c61712f54e679a7ea8f407f3ee6" %}
[Web SDK](/zh/wang-luo/sdk/web-sdk.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.offer18.com/zh/lian-meng-huo-ban/ji-cheng/google-ads-ji-cheng-web-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
