บทแนะนํา: วัด Conversion ของโฆษณา iOS
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ขั้นตอนที่ 2: ผสานรวม Google Analytics
เมื่อติดตั้งใช้งานระบบการตรวจสอบสิทธิ์เพื่อรวบรวมอีเมลหรือหมายเลขโทรศัพท์ของผู้ใช้แล้ว คุณจะเริ่มผสานรวม Google Analytics สำหรับ Firebase SDK ได้
ผสานรวม Google Analytics สำหรับ Firebase SDK
ผสานรวมกับ Google Analytics สำหรับ Firebase SDK เวอร์ชันล่าสุด
ใช้ Cocoapods
หากแอปใช้ Cocoapods ให้ตรวจสอบว่า Podfile ของโปรเจ็กต์มีรายการต่อไปนี้
pod 'FirebaseAnalytics` # includes GoogleAdsOnDeviceConversion
หรือ
pod 'FirebaseAnalytics/Core'
pod 'GoogleAdsOnDeviceConversion'
จากนั้นเรียกใช้คําสั่ง pod repo update
และ pod install
ใช้ Swift Package Manager
หากแอปใช้ Swift Package Manager ให้ทําตามขั้นตอนที่หัวข้อSwift Package Manager สําหรับ Firebase
เมื่อถึงขั้นตอน "เลือกไลบรารี Firebase ที่ต้องการรวมไว้ในแอป" ให้เลือก FirebaseAnalytics
ก่อนไปยังขั้นตอนถัดไป
หรือเลือก FirebaseAnalytics/Core
และ
GoogleAdsOnDeviceConversion
การผสานรวมทางเลือก
หากแอปไม่ได้ใช้ Cocoapods หรือ Swift Package Manager ให้ผสานรวมดังนี้
- ดาวน์โหลดไฟล์ ZIP สาธารณะของ Firebase จากที่เก็บ GitHub ของ firebase-ios-sdk
- ทำตามวิธีการใน README จากไฟล์ ZIP สาธารณะเพื่อเพิ่มเฟรมเวิร์กลงในโปรเจ็กต์โดยตรง อย่าลืมเพิ่มเฟรมเวิร์กจากไดเรกทอรี
FirebaseAnalytics
- ใน Xcode ให้เพิ่ม Flag
-ObjC
และ -lc++
ลงใน "การตั้งค่าอื่นๆ ของโปรแกรมลิงก์" ในการตั้งค่าบิลด์ของเป้าหมายแอป
Unity
เพิ่ม Firebase Unity SDK
(โดยเฉพาะ FirebaseAnalytics.unitypackage
) ลงในโปรเจ็กต์ Unity ดูวิธีการโดยละเอียดได้ที่เพิ่ม Firebase Unity SDK
เลือกแพลตฟอร์ม iOS ที่ไฟล์ > การตั้งค่าการสร้าง แล้วคลิกสร้างและเรียกใช้
ในโฟลเดอร์บิลด์ที่สร้างขึ้น ให้ค้นหา Podfile แล้วเพิ่มข้อมูลต่อไปนี้
pod 'GoogleAdsOnDeviceConversion'
เปิดใช้โหมดแก้ไขข้อบกพร่อง (ไม่บังคับ)
เปิดใช้โหมดแก้ไขข้อบกพร่องโดยเพิ่ม -FIRDebugEnabled
ในส่วน "อาร์กิวเมนต์ที่ส่งเมื่อเปิด" ในเครื่องมือแก้ไขสคีมาของ Xcode เมื่อเปิดแอปใน Xcode ให้ตรวจสอบว่ามีข้อความดังต่อไปนี้ปรากฏในคอนโซลแก้ไขข้อบกพร่องของ Xcode
[Firebase/Analytics][I-ACS023007] Analytics v.x.x.x started
...
[Firebase/Analytics][I-ACS023009] Debug logging enabled
arrow_back_iosขั้นตอนที่ 1: ใช้ประสบการณ์การลงชื่อเข้าใช้
ขั้นตอนที่ 3: เริ่มการวัดโดยใช้ Google Analyticsarrow_forward_ios
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["Step 2: Integrate Google Analytics\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| Introduction: [Measure iOS Ads conversions](/docs/tutorials/ads-ios-on-device-measurement/index-first-party) |\n| Step 1: [Implement a sign-in experience](/docs/tutorials/ads-ios-on-device-measurement/step-1) \u003cbr /\u003e |\n| **Step 2: Integrate Google Analytics** \u003cbr /\u003e |\n| Step 3: [Initiate on-device conversion measurement using Google Analytics](/docs/tutorials/ads-ios-on-device-measurement/step-3) |\n| Step 4: [Troubleshoot and handle common issues](/docs/tutorials/ads-ios-on-device-measurement/step-4) |\n\n\u003cbr /\u003e\n\nNow that you've implemented an authentication system to collect users' emails\nor phone numbers, you can begin integrating the Google Analytics for\nFirebase SDK.\n\nIntegrate the Google Analytics for Firebase SDK\n\nIntegrate with the latest Google Analytics for Firebase SDK version.\n| **Note:** `GoogleAdsOnDeviceConversion` is not subject to [Apple's privacy manifest requirements](https://developer.apple.com/news/?id=3d8a9yyh) and does not include a privacy manifest. No additional action is required to enable on-device conversion measurement.\n\nUse Cocoapods\n\nIf your app uses Cocoapods, ensure your project's Podfile contains either: \n\n pod 'FirebaseAnalytics` # includes GoogleAdsOnDeviceConversion\n\nor \n\n pod 'FirebaseAnalytics/Core'\n pod 'GoogleAdsOnDeviceConversion'\n\nThen, run the commands `pod repo update` and `pod install`.\n\nUse Swift Package Manager\n\nIf your app uses Swift Package Manager, follow the steps at\n[Swift Package Manager for Firebase](/docs/ios/installation-methods#swift-package-manager).\nWhen you reach the step \"Choose the Firebase libraries that you want include in\nyour app\", check `FirebaseAnalytics` before continuing to the next steps.\nAlternatively, check `FirebaseAnalytics/Core` *and*\n`GoogleAdsOnDeviceConversion`.\n\nAlternative integration\n\nIf your app does not use Cocoapods or Swift Package Manager, integrate as\nfollows:\n\n1. Download the public zip file of Firebase from the [firebase-ios-sdk GitHub repo](https://github.com/firebase/firebase-ios-sdk/releases).\n2. Follow the README instructions from the public zip file to add the frameworks to the project directly. Be sure to add the frameworks from the `FirebaseAnalytics` directory.\n3. In Xcode, add the `-ObjC` and `-lc++` flags to \"Other Linker Settings\" in your app target's build settings.\n\nUnity\n\n1. Add the [Firebase Unity SDK](/download/unity)\n (specifically, `FirebaseAnalytics.unitypackage`) to your Unity project. More detailed instructions can be found in [Add Firebase Unity SDKs](https://firebase.google.com/docs/unity/setup#add-sdks).\n\n2. Select the platform iOS at **File** \\\u003e **Build Settings** , then click\n **Build and Run**.\n\n3. In the generated build folder, locate the Podfile and add the following:\n\n pod 'GoogleAdsOnDeviceConversion'\n\nEnable debug mode (optional)\n\nEnable debug mode by adding `-FIRDebugEnabled` under \"Arguments Passed on Launch\"\nin Xcode's scheme editor. Upon launching the app in Xcode, ensure that a\nmessage like the following appears in the Xcode debug console: \n\n [Firebase/Analytics][I-ACS023007] Analytics v.x.x.x started\n ...\n [Firebase/Analytics][I-ACS023009] Debug logging enabled\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\n[arrow_back_ios**Step 1**: Implement a sign-in experience](/docs/tutorials/ads-ios-on-device-measurement/step-1)\n[**Step 3** : Initiate measurements using Google Analyticsarrow_forward_ios](/docs/tutorials/ads-ios-on-device-measurement/step-3)\n\n\u003cbr /\u003e\n\n*** ** * ** ***"]]