必備條件
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
請先完成下列必要條件,再導入動態再行銷。
安插 Google 代碼和再行銷事件程式碼片段
首先,請在網站中加入再行銷代碼。您可以使用 conversion_action
欄位的 TagSnippet
,從 API 擷取 googleGlobalSiteTag
或 event_snippet
。
如要在網站中手動嵌入代碼,請按照下列步驟操作:
取得 Google 代碼和再行銷事件程式碼片段。
Google 代碼會在您的網站上設定新 Cookie,收集將訪客帶進您網站的廣告點擊相關資訊,並將網站訪客加進 Google Ads 帳戶中的標準再行銷名單。
為確保代碼能與動態再行銷搭配運作,請在「建立 Google Ads 代碼資料來源」步驟中,選取「搜集特定屬性或參數來個人化廣告」,如下所示:

如需取得 Google 代碼和再行銷事件程式碼片段的詳細操作說明,請參閱「使用 Google Ads 為網站加入代碼」。
安裝 Google 代碼。
網站上所有會傳送再行銷資訊的網頁都必須加入 Google 代碼,但每個 Google Ads 帳戶只需要一段 Google 代碼。事件程式碼片段可用於追蹤應計為再行銷事件的其他動作。請將這個程式碼片段安插在您想追蹤的網頁上,緊接在 <head></head>
區段中的 Google 代碼後方。
Google 代碼也適用於其他代碼,例如 Google Analytics 代碼。
進一步瞭解 Google Analytics 中的代碼運作方式。
在要追蹤的網站網頁上安插事件程式碼片段,並提供相應的自訂參數值。
自訂參數是再行銷代碼程式碼中的元素,可讓代碼將網站上特定項目或選項的相關資訊傳送至 Google Ads 帳戶。自訂參數與業務資料動態饋給直接相關,您可以在其中加入與代碼收集資訊相應的值。
如要使用動態再行銷,請務必使用標示為 Required
的自訂參數,如「動態再行銷事件和參數」一文所述。
將自訂參數的值加到再行銷代碼後,系統會與動態饋給同步,在廣告中顯示同一位訪客先前看過的產品或服務。
以下範例說明如何為零售網站安裝事件程式碼片段 (請注意,ecomm_prodid
是與網頁上產品相應的 Merchant Center 產品 ID):
gtag('event', 'page_view', {
ecomm_pagetype: 'product',
ecomm_prodid: 34592212,
ecomm_totalvalue: 29.99,
ecomm_category: 'Home & Garden',
isSaleItem: false
});
如需參數的詳細定義和有效值,請參閱「動態再行銷事件和參數」。
您使用的事件名稱 (例如上述範例中的 page_view
) 可以是您選擇的自訂事件名稱,也可以是我們建議的標準事件。
只要事件資料參數 (本例中的 ecomm_pagetype
、ecomm_prodid
和 ecomm_totalvalue
) 設定正確,就不需要為了導入動態再行銷而比對任何特定值。
如需不同業務類型的自訂參數詳細文件,以及 Google 代碼的運作方式,請參閱「為網站設定轉換追蹤」。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-26 (世界標準時間)。
[null,null,["上次更新時間:2025-08-26 (世界標準時間)。"],[[["\u003cp\u003eInstall the Google tag and remarketing event snippet on all website pages to enable dynamic remarketing.\u003c/p\u003e\n"],["\u003cp\u003eWhen setting up the Google tag, ensure you select "Collect specific attributes or parameters to personalize ads" for dynamic remarketing functionality.\u003c/p\u003e\n"],["\u003cp\u003eUtilize custom parameters within the event snippet to send specific product or service information to your Google Ads account for targeted ads.\u003c/p\u003e\n"],["\u003cp\u003eEnsure the custom parameters, such as 'ecomm_prodid', align with your business data feeds for accurate product or service synchronization in ads.\u003c/p\u003e\n"]]],[],null,["# Prerequisites\n\nFollow these prerequisites to implement dynamic remarketing.\n\nInstall Google tag and remarketing event snippet\n------------------------------------------------\n\nBegin by\n[tagging your site for remarketing](//support.google.com/google-ads/answer/2476688).\nYou can retrieve the `googleGlobalSiteTag` or `event_snippet` from the API using\nthe [`TagSnippet`](/google-ads/api/reference/rpc/v21/TagSnippet) of the\n[`conversion_action`](/google-ads/api/fields/v21/conversion_action) field.\n\nHere are the steps for embedding tags in your website manually:\n\n1. **Get the Google tag and the remarketing event snippet.**\n\n The Google tag sets a new cookie on your site which collects information\n about the ad click that brought a visitor to your site and adds website\n visitors to standard remarketing lists in your Google Ads account.\n\n To make sure the tagging works with dynamic remarketing, select **Collect\n specific attributes or parameters to personalize ads** during the step\n **Create the Google Ads tag data source**, as shown below:\n\n For detailed instructions for acquiring the Google tag and remarketing event\n snippet, see\n [Tag your website using Google Ads](//support.google.com/google-ads/answer/2476688).\n2. **Install the Google tag.**\n\n You must install the Google tag on all the pages of your website that\n send remarketing information, but you need only one Google tag for each\n Google Ads account. The event snippet can be used to track additional actions\n that are to be counted as remarketing events. Install this snippet on site\n pages you'd like to track, right after the Google tag in the\n `\u003chead\u003e\u003c/head\u003e` section.\n\n The Google tag also works with other tags such as Google Analytics tags.\n [Read more about how tags work in Google\n Analytics](/analytics/devguides/collection/gtagjs).\n3. **Install an event snippet on site pages you would like to track, with\n corresponding custom parameter values.**\n\n Custom parameters are elements in your remarketing tag code that allow your\n tag to send information about specific items or selections on your website to\n your Google Ads account. Custom parameters are directly related to business\n data feeds, where you add the values that correspond to the information\n the tag collects.\n\n To use dynamic remarketing, you'll need to use the custom parameters marked\n as `Required`, as described in\n [Dynamic remarketing events and parameters](//support.google.com/google-ads/answer/7305793).\n\n When you add the value of a custom parameter to your remarketing tag,\n it will sync with your feed to show the same product or service in\n your ads previously viewed by the same visitor.\n\n Here is an example of how to install an event snippet for a retail site (note\n the `ecomm_prodid` is the [Merchant Center Product\n ID](//support.google.com/merchants/answer/7052112) that corresponds to the\n product on the page): \n\n gtag('event', 'page_view', {\n ecomm_pagetype: 'product',\n ecomm_prodid: 34592212,\n ecomm_totalvalue: 29.99,\n ecomm_category: 'Home & Garden',\n isSaleItem: false\n });\n\n For detailed definitions of the parameters and their valid values,\n see\n [Dynamic remarketing events and parameters](//support.google.com/google-ads/answer/7305793).\n\n The event name you use (such as `page_view` in the above example) can be a\n custom event name of your choosing or one of our recommended standard events.\n It doesn't need to match any specific value for the purpose of implementing\n dynamic remarketing, as long as the event data parameters (`ecomm_pagetype`,\n `ecomm_prodid`, and `ecomm_totalvalue` in this example) are correctly set.\n\n For detailed documentation on custom parameters for different business types\n and how the Google tag works, refer to\n [Set up conversion tracking for your website](//support.google.com/google-ads/answer/12216424)."]]