# 購買追蹤

{% hint style="warning" %}
需完成 [基礎追蹤 (必要)](/doc/cheng-shi-ma-zi-ding-an-zhuang/ji-chu-zhui-zong-bi-yao.md)
{% endhint %}

## 程式碼

當購買完成並到達購買完成頁時，透過 Javascript 填入「購買」資料後發送。

<pre class="language-javascript"><code class="lang-javascript">itg('event', 'purchase',{
  'id': '<a data-footnote-ref href="#user-content-fn-1">string</a>',
  'price': '<a data-footnote-ref href="#user-content-fn-2">string</a>',
  'promotion': '<a data-footnote-ref href="#user-content-fn-3">string</a>',
  'product': '<a data-footnote-ref href="#user-content-fn-4">string</a>',
  'user':{
    'type': '<a data-footnote-ref href="#user-content-fn-5">string</a>',
    'id': '<a data-footnote-ref href="#user-content-fn-6">string</a>',
    'email': '<a data-footnote-ref href="#user-content-fn-7">string</a>',
    'phone': '<a data-footnote-ref href="#user-content-fn-8">string</a>'
  }
});
</code></pre>

***

## 參數說明

<table><thead><tr><th width="92.33333333333331" data-type="checkbox">必要</th><th width="163">參數</th><th>說明</th></tr></thead><tbody><tr><td>true</td><td>id</td><td><p>string</p><p>訂單 ID，依據每一次購買產生之訂單 ID</p></td></tr><tr><td>true</td><td>price</td><td><p>string</p><p>訂單總金額，設置此訂單金額或價值，可於受眾篩選條件選擇。</p></td></tr><tr><td>true</td><td>promotion</td><td><p>string</p><p>訂單優惠，依據不同行銷優惠給予購買者折扣，每一次不同優惠設置不同名稱</p></td></tr><tr><td>true</td><td>product</td><td><p>string</p><p>訂單購買之商品 ID，多個以「,」逗號區隔，將用於「受眾篩選」之條件</p></td></tr><tr><td>false</td><td>user.type</td><td><p>string</p><p>使用者 來源，例如：own, line, facebook, google</p><ul><li>自有會員：own</li><li>Line 來源：line</li><li>Facebook 來源：facebook</li><li>Google 來源：google</li></ul></td></tr><tr><td>false</td><td>user.id</td><td><p>string</p><p>使用者 id，串聯 User ID 資料，讓「受眾篩選」的「整合資訊」條件更加精準。</p></td></tr><tr><td>false</td><td>user.email</td><td><p>string</p><p>使用者 email，將串聯 User Email 資料，讓「受眾篩選」的「整合資訊」條件更加精準。</p></td></tr><tr><td>false</td><td>user.phone</td><td><p>string</p><p>使用者 phone，將串聯 User Phone 資料，讓「受眾篩選」的「整合資訊」條件更加精準。</p></td></tr></tbody></table>

[^1]: 訂單 ID，依據每一次購買產生之訂單 ID

[^2]: 訂單總金額，設置此訂單金額或價值，可於受眾篩選條件選擇。

[^3]: 訂單優惠，依據不同行銷優惠給予購買者折扣，每一次不同優惠設置不同名稱

[^4]: 訂單商品，訂單購買之商品，多個以「,」逗號區隔，將用於「受眾篩選」之條件

[^5]: 使用者 來源，例如：own, line, facebook, google

[^6]: 使用者 id，串聯 User ID 資料，讓「受眾篩選」的「整合資訊」條件更加精準。

[^7]: 使用者 email，串聯 User Email 資料，讓「受眾篩選」的「整合資訊」條件更加精準。

[^8]: 使用者 phone，串聯 User Phone 資料，讓「受眾篩選」的「整合資訊」條件更加精準。


---

# Agent Instructions: 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://instag.gitbook.io/doc/cheng-shi-ma-zi-ding-an-zhuang/gou-mai-zhui-zong.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.
