Open5
【Roblox】Economy Eventsの使いかたメモ
![eisuke](https://res.cloudinary.com/zenn/image/fetch/s--Vsmj_QUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/ea7606d7bb.jpeg)
主にとれるトラッキングするもの
-
Top sinks
消費系のイベント -
Top sources
追加系イベント -
Average wallet balance
保持している通貨の量
![eisuke](https://res.cloudinary.com/zenn/image/fetch/s--Vsmj_QUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/ea7606d7bb.jpeg)
公式Reference
![eisuke](https://res.cloudinary.com/zenn/image/fetch/s--Vsmj_QUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/ea7606d7bb.jpeg)
トラッキングサンプル
local AnalyticsService = game:GetService("AnalyticsService")
-- After level 1 completion
AnalyticsService:LogEconomyEvent(
player,
-- 消費系 or 追加系 か指定
Enum.AnalyticsEconomyFlowType.Source,
"Coins", -- 通貨名
50, -- 追加する量
50, -- 追加した物を含めたトータルの量
Enum.AnalyticsEconomyTransactionType.Gameplay.Name -- Transaction type
)
-- After level 2 completion
AnalyticsService:LogEconomyEvent(
player,
Enum.AnalyticsEconomyFlowType.Source,
"Coins", -- Currency name
50, -- Amount earned
100, -- Balance after transaction
Enum.AnalyticsEconomyTransactionType.Gameplay.Name -- Transaction type
)
Enum.AnalyticsEconomyTransactionType.Gameplay.Name
最後にNameがついてる理由は引数がstring型だからだそうです。
なのでこの書き方でも行けます。
tostring(Enum.AnalyticsEconomyTransactionType.Gameplay)
↑これダメっぽい
型付け言語がうらやましく感じた;;
![eisuke](https://res.cloudinary.com/zenn/image/fetch/s--Vsmj_QUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/ea7606d7bb.jpeg)
local Players = game:GetService("Players")
local AnalyticsService = game:GetService("AnalyticsService")
Players.PlayerAdded:Connect(function(player)
AnalyticsService:LogEconomyEvent(
player,
Enum.AnalyticsEconomyFlowType.Source,
"Coins", -- Currency name
50, -- Amount earned
100, -- Balance after transaction
Enum.AnalyticsEconomyTransactionType.Gameplay.Name -- Transaction type
)
end)
![eisuke](https://res.cloudinary.com/zenn/image/fetch/s--Vsmj_QUK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/ea7606d7bb.jpeg)
実装してすぐにdashboardのデバッグでは確認できないっぽい
実装して12時間後くらいにできるようになった