要扩展 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"]],["最后更新时间 (UTC):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."]]],[]]