เอกสารนี้แสดงภาพรวมระดับสูงเกี่ยวกับเซสชันเนื่องจากเกี่ยวข้องกับ Google Analytics SDK สําหรับ iOS v3
ภาพรวม
เซสชันแสดงถึงการโต้ตอบของผู้ใช้กับแอปของคุณ 1 ครั้ง เซสชันเซสชันทําหน้าที่เป็นคอนเทนเนอร์ของกิจกรรมกิจกรรมที่วัดค่า ซึ่งประกอบไปด้วยการดูหน้าจอ เหตุการณ์ และธุรกรรมอีคอมเมิร์ซ
การจัดการเซสชัน
โดยค่าเริ่มต้น Google Analytics จะจัดกลุ่ม Hit ที่ได้รับภายใน 30 นาทีไว้ด้วยกันภายในเซสชันเดียวกัน ระยะเวลานี้จะกําหนดค่าได้ที่ระดับพร็อพเพอร์ตี้ ดูวิธีกําหนดค่าระยะหมดเวลาของเซสชันนี้
การจัดการเซสชันด้วยตนเอง
หากต้องการเริ่มหรือจบเซสชันด้วยตนเอง ให้ตั้งค่าพารามิเตอร์การควบคุมเซสชันในพจนานุกรมที่คุณส่งเข้าไปในเมธอด send: tracker
// May return nil if a tracker has not yet been initialized. id tracker = [[GAI sharedInstance] defaultTracker]; // Start a new session with a screenView hit. GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; [builder set:@"start" forKey:kGAISessionControl]; [tracker set:kGAIScreenName value:@"My Screen"]; [tracker send:[builder build]];
// There should be no need to end a session explicitly. However, if you do // need to indicate end of session with a hit, simply add the following line // of code to add the parameter to the builder: [builder set:@"end" forKey:kGAISessionControl];