Skip to content

Commit bd355cf

Browse files
authored
Added event and parameter constants (#21)
1 parent 3579091 commit bd355cf

File tree

3 files changed

+604
-42
lines changed

3 files changed

+604
-42
lines changed

example/analytics.gui_script

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,37 +60,40 @@ function on_input(self, action_id, action)
6060
analytics.log(s)
6161
end
6262
end)
63-
dirtylarry.button("log_string", action_id, action, function()
63+
dirtylarry.button("log_string", action_id, action, function()
6464
local s = random(STRINGS):gsub(" ", "_")
6565
print("log_string()", s)
6666
if analytics then
67-
analytics.log_string("analytics", "string", s)
68-
end
69-
end)
70-
dirtylarry.button("log_int", action_id, action, function()
71-
local i = math.random(1, 10000)
72-
print("log_int()", i)
73-
if analytics then
74-
analytics.log_int("analytics", "int", i)
67+
analytics.log_string("some_event1", "some_string", s)
7568
end
7669
end)
7770
dirtylarry.button("log_number", action_id, action, function()
7871
local n = math.random()
7972
print("log_number()", n)
8073
if analytics then
81-
analytics.log_number("analytics", "number", n)
74+
analytics.log_number("some_event2", "some_number", n)
8275
end
8376
end)
84-
77+
dirtylarry.button("log_int", action_id, action, function()
78+
local i = math.random(1, 10000)
79+
print("log_int()", i)
80+
if analytics then
81+
analytics.log_int(analytics.EVENT_LEVELUP, analytics.PARAM_LEVEL, i)
82+
end
83+
end)
84+
8585
dirtylarry.button("log_table", action_id, action, function()
8686
local tbl = {
87-
number = math.random(1,100),
88-
boolean = true,
89-
string = "some_string"
87+
[analytics.PARAM_SCORE] = 100,
88+
[analytics.PARAM_LEVEL] = 1,
89+
[analytics.PARAM_CHARACTER] = "Yoda",
90+
some_param1 = math.random(1,100),
91+
some_param2 = true,
92+
some_param3 = "some_string"
9093
}
9194
pprint("log_table()", tbl)
9295
if analytics then
93-
analytics.log_table("analytics", tbl)
96+
analytics.log_table(analytics.EVENT_POSTSCORE, tbl)
9497
end
9598
end)
9699
end

0 commit comments

Comments
 (0)