Analytics Service
요약
메서드
FireCustomEvent(player: Instance,eventCategory: string,customData: Variant):() |
FireInGameEconomyEvent(player: Instance,itemName: string,economyAction: Enum.AnalyticsEconomyAction,itemCategory: string,amount: number,currency: string,location: Variant,customData: Variant):() |
FireLogEvent(player: Instance,logLevel: Enum.AnalyticsLogLevel,message: string,debugInfo: Variant,customData: Variant):() |
FirePlayerProgressionEvent(player: Instance,category: string,progressionStatus: Enum.AnalyticsProgressionStatus,location: Variant,statistics: Variant,customData: Variant):() |
GetPlayerSegmentsAsync(player: Player):Dictionary |
LogCustomEvent(player: Player,eventName: string,value: number,customFields: Dictionary):() |
LogEconomyEvent(player: Player,flowType: Enum.AnalyticsEconomyFlowType,currencyType: string,amount: number,endingBalance: number,transactionType: string,itemSku: string,customFields: Dictionary):() |
LogFunnelStepEvent(player: Player,funnelName: string,funnelSessionId: string,step: number,stepName: string,customFields: Dictionary):() |
LogJourneyEvent(player: Player,journeyName: string,nodeName: string,journeySessionId: string,customFields: Dictionary):() |
LogOnboardingFunnelStepEvent(player: Player,step: number,stepName: string,customFields: Dictionary):() |
LogProgressionCompleteEvent(player: Player,progressionPathName: string,level: number,levelName: string,customFields: Dictionary):() |
LogProgressionEvent(player: Player,progressionPathName: string,status: Enum.AnalyticsProgressionType,level: number,levelName: string,customFields: Dictionary):() |
LogProgressionFailEvent(player: Player,progressionPathName: string,level: number,levelName: string,customFields: Dictionary):() |
LogProgressionStartEvent(player: Player,progressionPathName: string,level: number,levelName: string,customFields: Dictionary):() |
상속된 멤버
API 참조
속성
Api Key
메서드
Fire Custom Event
Fire Event
Fire In Game Economy Event
Fire Log Event
Fire Player Progression Event
Get Player Segments Async
매개 변수
코드 샘플
플레이어 세그먼트로 서버 측 경험 구성
local Players = game:GetService("Players")
local AnalyticsService = game:GetService("AnalyticsService")
local function configurePlayerExperience(player)
local segments = AnalyticsService:GetPlayerSegmentsAsync(player)
if not segments.HasData then
return
end
if segments.WhenUserFirstPlayed == Enum.WhenUserFirstPlayed.Days0To30 then
print("추가 온보딩을 보여줍니다:", player.Name)
end
if segments.ActivePayerStatus == Enum.ActivePayerStatus.Top15Percent then
print("높은 가치의 제안을 보여줍니다:", player.Name)
end
end
Players.PlayerAdded:Connect(configurePlayerExperience)Log Custom Event
Analytics Service: Log Custom Event(
):()
매개 변수
| 기본값: 1 |
| 기본값: nil |
반환
()
코드 샘플
사용자 정의 이벤트 기록
local AnalyticsService = game:GetService("AnalyticsService")
local Players = game:GetService("Players")
local missionBoard = script.Parent
local missionStartTimes: { [Player]: number } = {}
local prompt = Instance.new("ProximityPrompt")
prompt.ActionText = "미션"
prompt.Parent = missionBoard
prompt.Triggered:Connect(function(player)
local startTime = missionStartTimes[player]
if startTime == nil then
-- 플레이어가 미션을 수락합니다
missionStartTimes[player] = os.clock()
AnalyticsService:LogCustomEvent(
player,
"MissionStarted" -- 사용자 정의 이벤트 이름
)
else
-- 플레이어가 미션을 제출합니다
missionStartTimes[player] = nil
AnalyticsService:LogCustomEvent(
player,
"MissionCompletedDuration", -- 사용자 정의 이벤트 이름
os.clock() - startTime -- 집계에 사용되는 이벤트 값: 미션에 걸린 시간(초)
)
end
end)
Players.PlayerRemoving:Connect(function(player)
missionStartTimes[player] = nil
end)Log Economy Event
Analytics Service: Log Economy Event(
player:Player, flow Type:Enum.AnalyticsEconomyFlowType, currency Type:string, amount:number, ending Balance:number, transaction Type:string, item Sku:string, custom Fields:Dictionary
):()
매개 변수
| 기본값: nil |
반환
()
코드 샘플
인앱 구매 추적
local AnalyticsService = game:GetService("AnalyticsService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local COIN_BUNDLE_PRODUCT_ID = 123456 -- 개발자 제품의 ID로 교체하세요
local COINS_IN_BUNDLE = 1000
-- 각 플레이어가 가진 코인의 수를 위한 데이터 저장소의 대체
local coinBalances: { [Player]: number } = {}
MarketplaceService.ProcessReceipt = function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receiptInfo.ProductId == COIN_BUNDLE_PRODUCT_ID then
local balance = (coinBalances[player] or 0) + COINS_IN_BUNDLE
coinBalances[player] = balance
AnalyticsService:LogEconomyEvent(
player,
Enum.AnalyticsEconomyFlowType.Source,
"코인",
COINS_IN_BUNDLE, -- 번들에 있는 코인의 수
balance, -- 거래 후 잔액
Enum.AnalyticsEconomyTransactionType.IAP.Name,
"1000CoinBundle" -- 코인 번들의 고유 식별자
)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
endLog Funnel Step Event
반환
()
코드 샘플
상점 추적 단계
local AnalyticsService = game:GetService("AnalyticsService")
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FUNNEL_NAME = "ArmoryCheckout" -- 퍼널 이름, 단계를 함께 그룹화하는 데 사용됨
-- 클라이언트가 보고할 수 있는 각 작업에 대한 단계 번호 및 이름
local STEPS = {
OpenStore = { number = 1, name = "상점 열기" },
ViewItem = { number = 2, name = "아이템 보기" },
AddToCart = { number = 3, name = "장바구니에 추가" },
}
-- 클라이언트가 상점 UI를 사용할 때 "OpenStore", "ViewItem" 또는 "AddToCart"로 이 이벤트를 발생시킴
local shopActionEvent = Instance.new("RemoteEvent")
shopActionEvent.Name = "ShopAction"
shopActionEvent.Parent = ReplicatedStorage
local funnelSessionIds: { [Player]: string } = {}
shopActionEvent.OnServerEvent:Connect(function(player, action)
local step = STEPS[action]
if step == nil then
return
end
if action == "OpenStore" then
-- 상점이 열릴 때마다 새로운 체크아웃 세션이 시작됨
funnelSessionIds[player] = HttpService:GenerateGUID()
end
local funnelSessionId = funnelSessionIds[player]
if funnelSessionId == nil then
return
end
AnalyticsService:LogFunnelStepEvent(
player,
FUNNEL_NAME,
funnelSessionId, -- 이 고유 체크아웃 세션에 대한 퍼널 세션 ID
step.number, -- 단계 번호
step.name -- 단계 이름
)
end)
Players.PlayerRemoving:Connect(function(player)
funnelSessionIds[player] = nil
end)Log Journey Event
Analytics Service: Log Journey Event(
player:Player, journey Name:string, node Name:string, journey Session Id:string, custom Fields:Dictionary
):()
매개 변수
| 기본값: nil |
반환
()
Log Onboarding Funnel Step Event
Analytics Service: Log Onboarding Funnel Step Event(
):()
매개 변수
| 기본값: nil |
반환
()
코드 샘플
온보딩 단계 추적
local AnalyticsService = game:GetService("AnalyticsService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- 클라이언트는 플레이어가 온보딩 UI에서 클래스를 선택하면 이 이벤트를 발생시킵니다
local chooseClassEvent = Instance.new("RemoteEvent")
chooseClassEvent.Name = "ChooseClass"
chooseClassEvent.Parent = ReplicatedStorage
Players.PlayerAdded:Connect(function(player)
-- FTUE의 첫 번째 단계를 기록합니다
AnalyticsService:LogOnboardingFunnelStepEvent(
player,
1, -- 단계 번호
"게임에 참여함" -- 단계 이름
)
end)
chooseClassEvent.OnServerEvent:Connect(function(player)
-- FTUE의 두 번째 단계를 기록합니다
AnalyticsService:LogOnboardingFunnelStepEvent(
player,
2, -- 단계 번호
"클래스 선택" -- 단계 이름
)
end)Log Progression Complete Event
Analytics Service: Log Progression Complete Event(
):()
매개 변수
| 기본값: nil |
반환
()
Log Progression Event
Analytics Service: Log Progression Event(
player:Player, progression Path Name:string, status:Enum.AnalyticsProgressionType, level:number, level Name:string, custom Fields:Dictionary
):()
매개 변수
| 기본값: nil |
반환
()
Log Progression Fail Event
Analytics Service: Log Progression Fail Event(
):()
매개 변수
| 기본값: nil |
반환
()
Log Progression Start Event
Analytics Service: Log Progression Start Event(
):()
매개 변수
| 기본값: nil |
반환
()