# 範例：shopline 分類點擊

## 新增變數

<figure><img src="/files/zU8nnElQknn6wRlPh9Gr" alt=""><figcaption><p>新增內建變數</p></figcaption></figure>

### 新增內建變數

<figure><img src="/files/UXxH22TH8ClPxPli11YA" alt="" width="238"><figcaption><p>選擇內建變數</p></figcaption></figure>

* 勾選變數名稱：Click Text

***

## 新增觸發條件

<figure><img src="/files/TbuQE6OXVBhYCVk2b9Ip" alt=""><figcaption><p>新增觸發事件</p></figcaption></figure>

<figure><img src="/files/Ta5SYfzC5JdA5Y5EnC3H" alt=""><figcaption><p>觸發條件</p></figcaption></figure>

* 觸發名稱：shopline\[click\_category] (可更改)
* 觸發條件類型：點擊 - 僅連結
* 啟動時機：部分的連結點擊
* 觸發條件：「Click Classes」「包含」「 Label」
* 按下「儲存」

***

## 新增代碼

<figure><img src="/files/TsPmKE7iTBfCefncuxWT" alt=""><figcaption><p>建立代碼</p></figcaption></figure>

<figure><img src="/files/qZJ2cS4OoKCBXzEXmYlY" alt=""><figcaption><p>點擊分類追蹤碼</p></figcaption></figure>

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

```javascript
<script>
if({{Click Text}} !== undefined && {{Click Text}} != ''){
	itg('event', 'action',{
	    'type':   "click",             
	    'category': 'category',
	    'label': {{Click Text}},
	    'value': ''                    
	});
}
</script>
```

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

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

#### 提醒

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


---

# 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/dian-ji-zhui-zong/shopline/fan-li-shopline-fen-lei-dian-ji.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.
