> For the complete documentation index, see [llms.txt](https://instag.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://instag.gitbook.io/doc/dao-ru-an-zhuang/ji-chu-zhui-zong-bi-yao.md).

# 基礎追蹤 (必要)

Google Tag Manager (GTM) 是使用 Instag 的建議安裝方式，低技術門檻且便於維護，請依下述說明完成 GTM 設置。&#x20;

{% hint style="info" %}
如需要使用程式碼進行安裝，請參考 [程式碼自訂安裝](/doc/cheng-shi-ma-zi-ding-an-zhuang/ji-chu-zhui-zong-bi-yao.md) 區段。
{% endhint %}

## 事前準備 <a href="#shi-qian-zhun-bei" id="shi-qian-zhun-bei"></a>

1. 若您尚未使用過 Google Tag Manager，請參考 [Google 官方說明](https://support.google.com/tagmanager/answer/6102821) 完成帳戶及容器設置。
2. 下載 Instag GTM 預置容器檔案：將下方 Instag GTM json 檔案下載到電腦，接下來的步驟會在 GTM 中使用 「匯入容器」 功能完成快速設定。

{% file src="/files/Fk81F0ftTnhss5uM4ee0" %}

***

## Step 1. 進入 [GTM 後台](https://tagmanager.google.com/#/home)，開啟 「容器設定」

<figure><img src="/files/L3JSBA5G3oKJwsBw8wG9" alt=""><figcaption></figcaption></figure>

***

## Step 2. 點選 「匯入容器」

<figure><img src="/files/1PLgjAKj3e2hcBb8GOz1" alt=""><figcaption></figcaption></figure>

***

## Step 3. 匯入容器

1. 選取要匯入的檔案 ：選擇 [事前準備](#shi-qian-zhun-bei) 中下載到的 json 檔案。
2. 選擇工作區：選擇 「現有」 並點選您正在使用的工作區，一般沒特別設定則直接選擇 "Default Workspace"。
3. 選擇匯入選項： 選擇 「合併」 > 「覆寫有衝突的代碼、觸發條件和變數。」
4. 點擊 「確認」 完成匯入。

<figure><img src="/files/fgQFaZUQw0rViTmimUNj" alt=""><figcaption></figcaption></figure>

***

## Step 4. 設定 網站 ID

1. 至[ Instag 平台](https://pro.instag.ai/)進入 「系統設定 > 專案資訊」，複製 「專案 ID」
2. 至 Google Tag Manager 將 「變數 variable > Instag Site ID」 值從 0 更換為您的「專案 ID」，接著按下 「儲存」

<figure><img src="/files/zrj4FRwOeVjwZkulNv62" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/vucGpfO7UXL4QsJHCXld" alt=""><figcaption></figcaption></figure>

***

## Step 5. 提交變更

按下右上角 「提交」，再按下 「發布」 按鈕即可完成設置。

<figure><img src="/files/1S8CXGVTDUUAHGMcyuxT" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/bMYu44XselTrBlPy1YGM" alt=""><figcaption></figcaption></figure>

***
