如要擴充 Google 代碼管理工具的功能,您可以新增函式呼叫變數和函式呼叫代碼。函式呼叫變數可讓您擷取對預先註冊函式呼叫傳回的值。函式呼叫代碼可讓您執行預先註冊的函式 (例如在 Google 代碼管理工具中代碼範本目前不支援其他評估和再行銷工具時,用來觸發命中)。
如要建立自訂標記,請建立實作 TAGCustomFunction 通訊協定的類別:
@implementationMYCustomTag<TAGCustomFunction>-(NSObject*)executeWithParameters:(NSDictionary*)parameters{// Add custom tag implementation here.}@end
如要建立自訂變數,請建立實作 TAGCustomFunction 通訊協定的類別:
@implementationMYCustomVariable<TAGCustomFunction>-(NSObject*)executeWithParameters:(NSDictionary*)parameters{// Return the value of the custom variable.return@42;}@end
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-11-08 (世界標準時間)。"],[[["\u003cp\u003eFunction Call variables and tags extend Google Tag Manager's capabilities by enabling custom functions.\u003c/p\u003e\n"],["\u003cp\u003eFunction Call variables capture values from pre-registered functions, while Function Call tags execute them.\u003c/p\u003e\n"],["\u003cp\u003eCustom tags and variables are created by implementing the \u003ccode\u003eTAGCustomFunction\u003c/code\u003e protocol in a class.\u003c/p\u003e\n"],["\u003cp\u003eThese custom classes are then utilized within Tag Manager's interface to set up new tags or variables.\u003c/p\u003e\n"]]],["Function Call variables and tags in Google Tag Manager enhance its capabilities by interacting with pre-registered functions. Both utilize a class implementing the `TAGCustomFunction` protocol, with the `executeWithParameters` method defining their behavior. For a tag, this method executes custom logic; for a variable, it returns a value. After implementing the protocol in the class, you can use the Tag Manager web interface to create tags or variables by referencing the class name.\n"],null,[]]