iOS 代碼管理工具進階設定
如要擴充 Google 代碼管理工具的功能,您可以新增函式呼叫變數和函式呼叫代碼。函式呼叫變數可讓您擷取對預先註冊函式呼叫傳回的值。函式呼叫代碼可讓您執行預先註冊的函式 (例如在 Google 代碼管理工具中代碼範本目前不支援其他評估和再行銷工具時,用來觸發命中)。
如要建立自訂標記,請建立實作 TAGCustomFunction
通訊協定的類別:
@implementation MYCustomTag<TAGCustomFunction>
- (NSObject*)executeWithParameters:(NSDictionary*)parameters {
// Add custom tag implementation here.
}
@end
如要建立自訂變數,請建立實作 TAGCustomFunction
通訊協定的類別:
@implementation MYCustomVariable<TAGCustomFunction>
- (NSObject*)executeWithParameters:(NSDictionary*)parameters {
// Return the value of the custom variable.
return @42;
}
@end
使用 TAGCustomFunction
設定類別後,請使用代碼管理工具的網頁介面,根據您建立的類別名稱設定代碼或變數。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-08 (世界標準時間)。
[null,null,["上次更新時間:2024-11-08 (世界標準時間)。"],[[["Function Call variables and tags extend Google Tag Manager's capabilities by enabling custom functions."],["Function Call variables capture values from pre-registered functions, while Function Call tags execute them."],["Custom tags and variables are created by implementing the `TAGCustomFunction` protocol in a class."],["These custom classes are then utilized within Tag Manager's interface to set up new tags or variables."]]],["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"]]