การกำหนดค่า iOS Tag Manager ขั้นสูง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการขยายฟังก์ชันการทำงานของ Google Tag Manager ให้เพิ่มตัวแปรการเรียกใช้ฟังก์ชันและแท็กการเรียกใช้ฟังก์ชัน ตัวแปรการเรียกใช้ฟังก์ชันช่วยให้คุณบันทึกค่าที่แสดงผลจากการเรียกฟังก์ชันที่บันทึกไว้ล่วงหน้าได้ แท็กการเรียกใช้ฟังก์ชันช่วยให้คุณเรียกใช้ฟังก์ชันที่ลงทะเบียนไว้ล่วงหน้าได้ (เช่น เพื่อทริกเกอร์ Hit สําหรับเครื่องมือวัดผลและรีมาร์เก็ตติ้งเพิ่มเติมที่เทมเพลตแท็กใน Google Tag Manager ยังไม่รองรับในขณะนี้)
หากต้องการสร้างแท็กที่กำหนดเอง ให้สร้างคลาสที่ใช้โปรโตคอล 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
แล้ว ให้ใช้อินเทอร์เฟซเว็บของ Tag Manager เพื่อตั้งค่าแท็กหรือตัวแปรที่มีชื่อคลาสที่คุณสร้างขึ้น
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-11-08 UTC
[null,null,["อัปเดตล่าสุด 2024-11-08 UTC"],[[["\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,["# Advanced iOS Tag Manager configuration\n\nTo extend the functionality of Google Tag Manager, you can add Function Call\nvariables and Function Call tags. Function Call variables let you capture the\nvalues returned by calls to pre-registered functions. Function Call tags let you\nexecute pre-registered functions (e.g. to trigger hits for additional\nmeasurement and remarketing tools that are not currently supported with tag\ntemplates in Google Tag Manager).\n\nTo create a custom **tag** , create a class that implements the\n`TAGCustomFunction` protocol: \n\n @implementation MYCustomTag\u003cTAGCustomFunction\u003e\n\n - (NSObject*)executeWithParameters:(NSDictionary*)parameters {\n // Add custom tag implementation here.\n }\n\n @end\n\nTo create a custom **variable** , create a class that implements the\n`TAGCustomFunction` protocol: \n\n @implementation MYCustomVariable\u003cTAGCustomFunction\u003e\n\n - (NSObject*)executeWithParameters:(NSDictionary*)parameters {\n // Return the value of the custom variable.\n return @42;\n }\n\n @end\n\nOnce your class has been set up with `TAGCustomFunction`, use Tag Manager's web\ninterface to set up tags or variables with the class name you created."]]