targetPageParams()

此方法允許您將參數從要求程式碼外部附加至全域 mbox。

對於要在多個 mbox 呼叫上併入相同的一組參數,此函數很實用。函數需要由客戶定義。它應該傳回僅會傳遞至全域 mbox 要求的參數陣列。此函式可在at.js載入前或其中定義 管理 > 實施 > 編輯 > 資料庫標題.

您可以使用 targetPageParams() 函數,透過下列任何方式將參數傳入 target-global-mbox 中:

  • 以 & 符號區隔的清單
  • 陣列
  • JSON 物件

範例

以 & 符號分隔的清單 (值必須經過 URL 編碼):

function targetPageParams() {
    return "param1=value1¶m2=value2&p3=hello%20world";
}

陣列 (值不需經過 URL 編碼):

targetPageParams = function() {
     return ["a=1", "b=2", "c=hello world"];
};

JSON (值不需經過 URL 編碼):

targetPageParams = function() {
  return {
    "a": 1,
    "b": 2,
    "profile": {
        "age": 26,
        "country": {
          "city": "San Francisco"
        }
      }
  };
};
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3