適用於:開發人員 |基本 |基本 v2 |標準 |標準 v2 |Premium |進階 v2
Google Tag Manager 是由 Google 所建立的標籤管理系統。 您可以將此用來管理網站上用於追蹤和分析的 JavaScript 和 HTML 標籤。 例如,您可以使用 Google Tag Manager 來整合 Google Analytics、熱度圖或聊天機器人,例如 LiveChat。
請遵循本文中的步驟,將 Google Tag Manager 插入 Azure API 管理的受控或自我裝載開發人員入口網站。
將 Google Tag Manager 新增至入口網站
請遵循下列步驟,將 Google Tag Manager 整合到受控或自我裝載開發人員入口網站。
重要
受控入口網站不必進行步驟 1 - 3。 如果您有受控入口網站,請跳至步驟 4。
為最新版的開發人員入口網站設定本機環境。
安裝 npm 套件以新增 Paperbits for Google Tag Manager:
npm install @paperbits/gtm --save
在
src
資料夾的startup.publish.ts
檔案中,匯入並註冊 GTM 模組:import { GoogleTagManagerPublishModule } from "@paperbits/gtm/gtm.publish.module"; ... injector.bindModule(new GoogleTagManagerPublishModule());
擷取入口網站的設定:
GET /contentTypes/document/contentItems/configuration
{ "nodes": [ { "site": { "title": "Microsoft Azure API Management - developer portal", "description": "Discover APIs, learn how to use them, try them out interactively, and sign up to acquire keys.", "keywords": "Azure, API Management, API, developer", "faviconSourceId": null, "author": "Microsoft Azure API Management" } } ] }
使用 Google Tag Manager 設定,從上一個步驟擴充網站設定:
PUT /contentTypes/document/contentItems/configuration
{ "nodes": [ { "site": { ... }, "integration": { "googleTagManager": { "containerId": "GTM-..." } } } ] }