使用外掛程式

pt 函數會使用以下引數:

  • l (必要,字串):變數清單,包含 cf 引數的函數可針對此清單執行。
  • de (選用,字串):區分 l 引數中變數清單的分隔字元。 預設為逗號 (,)。
  • cf (必要,字串):要針對 l 引數中包含的每個變數呼叫的 AppMeasurement 物件中,所包含的回呼函數名稱。
  • fa (選用,字串):如果 cf 引數中的函數會在執行時呼叫其他引數,請在此處納入它們。 預設為 undefined。

如果回呼函數 (在 cf 引數中) 傳回值,呼叫此函數便會傳回值。

呼叫範例

範例 #1

下列程式碼是 getQueryParam 外掛程式的一部分。 它會針對 URL 查詢字串 (fullQueryString) 中包含的每個鍵值組執行 getParameterValue 協助程式函數。 若要擷取各個鍵值組,fullQueryString 必須以「&」字元分隔並分割。 parameterKey 是指外掛程式特別嘗試從查詢字串中擷取的查詢字串參數

returnValue = pt(fullQueryString, "&", "getParameterValue", parameterKey)

上一行是執行類似下列程式碼的捷徑:

var returnValue = "",
  parameters = fullQueryString.split("&"),
  parametersLength = parameters.length;
for(var i = 0; i < parametersLength; i++)
{
  returnValue = getParameterValue(parameters[i], parameterKey);
  if(returnValue !== "") break;
}

版本記錄

3.0 (2021 年 3 月 19 日)

  • 將版本編號加入為內容資料。

2.01 (2019 年 9 月 24 日)

  • 小幅變更程式碼以縮小整體大小

2.0 (2018 年 4 月 17 日)

  • 單點發行 (重新編譯,程式碼大小較小)。
  • 新增對 H-code 和 AppMeasurement 的支援。

1.0 (2013 年 9 月 23 日)

  • 首次發行。
自動翻譯
使用「語言選取器」檢視此頁面的英文版。
翻譯是否有幫助?

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.