# 範例：shopline 加入追蹤清單

## 新增變數

<figure><img src="https://2075385674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA8vmX591TX7ccV7n1Qcw%2Fuploads%2F8ZpdLCrZmX9WeDFTjaSz%2Fimage.png?alt=media&#x26;token=aa68aa9d-e4d0-4c01-9a9a-4ece53fa9971" alt=""><figcaption><p>新增變數</p></figcaption></figure>

### 加入追蹤 金額

<figure><img src="https://2075385674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA8vmX591TX7ccV7n1Qcw%2Fuploads%2FU9bpSWBwXWjywnu8mrDQ%2Fimage.png?alt=media&#x26;token=e2b11d31-352f-4eca-81f7-8d8eae69f12b" alt=""><figcaption><p>加入追蹤商品金額</p></figcaption></figure>

* 變數名稱：shopline \[add\_to\_wishlist] price
* 變數類型：資料層變數
* 資料層變數名稱：eventModel.value
* 按下「儲存」

***

## 新增觸發條件

<figure><img src="https://2075385674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA8vmX591TX7ccV7n1Qcw%2Fuploads%2FMXHIHY1kmVqRN1A9s79A%2Fimage.png?alt=media&#x26;token=1ab5a496-efaf-4fcc-a9c4-1a2bf5c69819" alt=""><figcaption><p>新增觸發事件</p></figcaption></figure>

<figure><img src="https://2075385674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA8vmX591TX7ccV7n1Qcw%2Fuploads%2F4ffqaJTde3HXto6b40cP%2Fimage.png?alt=media&#x26;token=e1efe8cf-8f5f-4317-a76b-ed368003156e" alt=""><figcaption><p>加入追蹤事件</p></figcaption></figure>

* 觸發名稱：shopline\[add\_to\_wishlist] (可更改)
* 觸發條件類型：自訂事件
* 事件名稱：add\_to\_wishlist
* 按下「儲存」

***

## 新增代碼

<figure><img src="https://2075385674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA8vmX591TX7ccV7n1Qcw%2Fuploads%2FUfHMuXUYJnlpTHtIcitW%2Fimage.png?alt=media&#x26;token=07663b9e-0534-45de-8bfe-93b048cb3503" alt=""><figcaption><p>建立代碼</p></figcaption></figure>

<figure><img src="https://2075385674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA8vmX591TX7ccV7n1Qcw%2Fuploads%2FXXB451gGBuklXptivUpy%2Fimage.png?alt=media&#x26;token=d99908f4-825b-477a-9bd9-e3199f99facd" alt=""><figcaption><p>加入追蹤商品代碼</p></figcaption></figure>

* 代碼名稱： \[shopline] add\_to\_wishlist
* 代碼類型：自訂 HTML
* HTML：複製下面內容程式碼貼上

```javascript
<script>
var title = document.title;

if(title !== undefined && title != ''){
	itg('event', 'action',{
	    'type':   "click",             
	    'category': 'add_to_wishlist',
	    'label': title,
	    'value': {{shopline [add_to_wishlist] price}}                    
	});
}
</script>
```

* 觸發條件：shopline\[add\_to\_wishlist]（ [#xin-zeng-chu-fa-tiao-jian](#xin-zeng-chu-fa-tiao-jian "mention") ）

按下右上角「儲存」按鈕後，點擊右上角「提交」並且「發布」即可生效。

#### 提醒

* 請先用「預覽」功能測試，確認「Tags Fired」是否有觸發成功
