◾Smartico DWH \ Transactional views, Gamification
This page describes the transactional views that hold gamification events created by Smartico: points, gems and diamonds, levels, missions, the Store, mini-games, tournaments, raffles and jackpots, and clans.
The name of a view is the name of the event with the "tr_" prefix. For example, the view tr_ach_points_added holds the event ach_points_added. Read the general rules of the DWH on the Smartico Data Warehouse (DWH) page first.
Rules for all transactional views
One row is one event. The primary key is event_id.
Every view is partitioned by event_time. Always filter on it, and do not apply a function to the column in the filter.
The views keep the events of the last 1080 days.
A view appears in your dataset after its first event.
Columns that hold the ID of an object (a mission, a level, a Store item, a mini-game, a tournament, a raffle, a jackpot, a clan) join to the dimension tables named under each view.
Columns marked "ID of a value" hold a number, not a text. The text of each number is in a lookup view of your dataset, named under each view: see Text of value IDs. The numbers can differ between labels and between Smartico environments, so filter by the text through the lookup view, not by a fixed number.
Yes/No (BOOL) columns hold TRUE or are empty. Empty means false, so filter with IS NOT TRUE instead of = false.
A view can also have old columns that are no longer filled. They are not listed here.
Columns in every view:
event_time
TIMESTAMP
Time of the event (UTC)
ingest_time
TIMESTAMP
Time when the event was stored in Smartico
label_id
INT64
Label ID
event_id
INT64
ID of the event in Smartico. Use it to remove duplicates
user_to_label_cur_rate
NUMERIC
Rate from the player's currency to the label currency. Not needed on this page
The tables below list the other columns of each view.
Text of value IDs
The text of a column marked "ID of a value" is in a view of your dataset. Joins under each view names it for every such column:
For most columns, a view named lookup_ plus the name of the column. For example, the text of ach_points_last_change_source is in dwh_ext_xxx.lookup_ach_points_last_change_source.
A lookup_ view has two columns:
id
INT64
The ID that the column holds
value
STRING
The text of the ID
It holds the values of your label and the values shared by all labels.
It is in your dataset when a transactional view of your dataset has the column.
A new value reaches the lookup view up to about an hour after it first appears. Use LEFT JOIN, so that the events of a new value stay in your totals; their text is empty until then.
For a column of type INT64[] (a list of IDs), use CROSS JOIN UNNEST on the column first, then join each ID.
Points additions of the last 7 days per source
Points, Gems, Diamonds
dwh_ext_xxx.tr_ach_points_added
Points added to players. One row per addition.
For more details on each points change (requested and actual amount, leaderboard and level flags, the source by name), use g_ach_points_change_log.
Joins:
ach_points_last_change_source → lookup_ach_points_last_change_source (id)
ach_points_last_change
NUMERIC
Number of points added
ach_points_balance
NUMERIC
The player's points balance after the addition (the points the player can spend in the Store)
ach_points_last_change_source
INT64
Source of the points. ID of a value; text in lookup_ach_points_last_change_source
Points added per day in the last 7 days
dwh_ext_xxx.tr_ach_points_deducted
Points taken from players, for example for a Store purchase, a mini-game spin, an avatar or a clan entry fee. One row per deduction.
Joins:
ach_points_last_change_source → lookup_ach_points_last_change_source (id)
ach_points_last_change
NUMERIC
Points deducted, as a negative number (for example -100)
ach_points_balance
NUMERIC
The player's points balance after the deduction
ach_points_last_change_source
INT64
Reason of the deduction (for example STOREPURCHASE, SAWSPIN, AVATAR, CLAN). ID of a value; text in lookup_ach_points_last_change_source
dwh_ext_xxx.tr_ach_gems_added
Gems added to players. One row per addition. For the source of each change, use g_gems_diamonds_change_log.
ach_gems_change_amount
NUMERIC
Number of gems added
dwh_ext_xxx.tr_ach_gems_deducted
Gems taken from players. One row per deduction.
ach_gems_change_amount
NUMERIC
Number of gems deducted, as a positive number
dwh_ext_xxx.tr_ach_diamonds_added
Diamonds added to players. One row per addition. For the source of each change, use g_gems_diamonds_change_log.
ach_diamonds_change_amount
NUMERIC
Number of diamonds added
dwh_ext_xxx.tr_ach_diamonds_deducted
Diamonds taken from players. One row per deduction.
ach_diamonds_change_amount
NUMERIC
Number of diamonds deducted, as a positive number
Levels
dwh_ext_xxx.tr_ach_level_changed
A player moved to another level. One row per change. For more details, use g_ach_levels_changed.
Joins:
ach_level_current → dm_ach_level (level_id)
ach_level_direction → lookup_ach_level_direction (id)
ach_level_current
INT64
ID of the player's level after the change
ach_level_direction
INT64
Direction of the change. ID of a value; text in lookup_ach_level_direction
Missions
dwh_ext_xxx.tr_ach_achievement_completed
A player completed a mission. One row per completion. For more details, use g_ach_completed.
Joins:
ach_achievement_last_completed_id → dm_ach (ach_id)
ach_achievement_last_completed_id
INT64
ID of the completed mission
dwh_ext_xxx.tr_ach_achievement_task_completed
A player completed a task of a mission. One row per task. When the task is the last one of the mission, this event comes before the mission completed event.
Joins:
ach_last_completed_task_mission_id → dm_ach (ach_id)
ach_last_completed_task_mission_id
INT64
ID of the mission of the completed task
ach_is_achievement_completed_by_task
BOOL
TRUE when this task was the last one and the mission is completed too
Store
dwh_ext_xxx.tr_shop_item_purchase_successed
A player bought an item in the Store. One row per purchase. For the price and other details, use g_shop_transactions.
Joins:
ach_last_item_purchased → dm_shop_item (item_id)
ach_last_item_purchased
INT64
ID of the purchased item
ach_last_item_purchased_type
INT64
Type of the item. Same values as item_type_id in dm_shop_item
ach_shop_last_purchase_category_ids
INT64[]
IDs of the Store categories of the item
Mini-games
dwh_ext_xxx.tr_minigame_attempt
A player tried to play a mini-game. One row per attempt, successful or not. For the results of the games, use g_minigames.
Joins:
m_game_name → dm_saw_template (saw_template_id)
minigame_attempt_status → lookup_minigame_attempt_status (id)
m_game_name
INT64
ID of the mini-game template
minigame_attempt_status
INT64
Result of the attempt. ID of a value; text in lookup_minigame_attempt_status
minigame_attempt_round_id
NUMERIC
MatchX only: ID of the round
dwh_ext_xxx.tr_minigame_win
A player won a prize in a mini-game. One row per prize.
Joins:
m_game_name, m_last_game_name → dm_saw_template (saw_template_id)
m_prize_name → dm_saw_prize (saw_prize_id)
m_game_name
INT64
ID of the mini-game template
m_prize_name
INT64
ID of the prize
m_game_prize_type
INT64
Type of the prize. Same values as prize_type_id in dm_saw_prize
m_prize_int_parameter
INT64
ID of the prize (the same value as m_prize_name)
m_last_game_name
INT64
ID of the mini-game template the player played last, of any type including MatchX. Often empty
dwh_ext_xxx.tr_minigame_spins_issued
A player got spins (attempts) for a mini-game. One row per grant.
Joins:
m_game_name → dm_saw_template (saw_template_id)
minigame_issued_spins_source → lookup_minigame_issued_spins_source (id)
m_game_name
INT64
ID of the mini-game template
minigame_spins_count
NUMERIC
Number of spins given
minigame_issued_spins_source
INT64
Source of the spins. ID of a value; text in lookup_minigame_issued_spins_source
dwh_ext_xxx.tr_minigame_matchx_prediction
A player made a prediction in a MatchX game. One row per prediction.
Joins:
m_game_name → dm_saw_template (saw_template_id)
minigame_attempt_status → lookup_minigame_attempt_status (id)
m_game_name
INT64
ID of the mini-game template
minigame_attempt_round_id
NUMERIC
ID of the MatchX round
minigame_attempt_status
INT64
Result of the attempt. ID of a value; text in lookup_minigame_attempt_status
Tournaments
The column tournament_name holds the ID of the tournament, not its name. It joins to dm_tournament (id), not to dm_tournament_instance. For the results of each tournament run, use g_tournament_winners and g_tournament_analytics.
dwh_ext_xxx.tr_tournament_user_registered
A player registered in a tournament. One row per registration.
Joins:
tournament_name → dm_tournament (id)
tournament_name
INT64
ID of the tournament
dwh_ext_xxx.tr_tournament_win
A player finished a tournament in a prize place. One row per player and tournament run.
Joins:
tournament_name → dm_tournament (id)
tournament_name
INT64
ID of the tournament
tournament_winning_place
NUMERIC
Place of the player (1 = first)
tournament_winning_prize
INT64
ID of the prize of that place
dwh_ext_xxx.tr_tournament_lose
A player finished a tournament without a prize. One row per player and tournament run.
Joins:
tournament_name → dm_tournament (id)
tournament_name
INT64
ID of the tournament
Raffles & Jackpots
In the raffle views, raffle_name holds the ID of the raffle and joins to dm_raffle (raffle_id). raffle_draw_name holds the ID of the draw (draw_id in raf_won_prizes). For tickets and prizes, use raf_tickets and raf_won_prizes.
dwh_ext_xxx.tr_raffle_tickets_given
A player got raffle tickets. One row per grant.
raffle_name
INT64
ID of the raffle
dwh_ext_xxx.tr_raffle_draw_run_opt_in
A player opted in to a run of a raffle draw. One row per player and run. Players can opt in only when the draw requires it, and then only the tickets of players who opted in take part in the run. A recurring draw starts a new run each time and the player must opt in again, so one player can have several rows for the same draw.
A row is created only when the opt-in succeeds. There is no row when:
the player had already opted in to that run
the run was already drawn
the player is in the control group
the draw does not require opt-in
The view does not hold the ID of the run. To link opt-ins to prizes, match raffle_name, raffle_draw_name and user_id to raffle_id, draw_id and user_id in raf_won_prizes.
Joins:
raffle_name → dm_raffle (raffle_id)
raffle_draw_name → raf_won_prizes (draw_id)
user_id → j_user_no_enums (user_id)
event_time
TIMESTAMP
Time of the opt-in (UTC). The view is partitioned by this column, always filter on it
ingest_time
TIMESTAMP
Time when the event was stored in Smartico, usually a few seconds after event_time
label_id
INT64
Label ID
event_id
INT64
ID of the event in Smartico. Unique per row, use it to remove duplicates
raffle_name
INT64
ID of the raffle, not its name. The name is internal_name in dm_raffle
raffle_draw_name
INT64
ID of the draw, not its name. The names of draws are not in the DWH
user_to_label_cur_rate
NUMERIC
Rate from the player's currency to the label currency. An opt-in has no amount, so the column is not needed here. It holds 1 or is empty
Opt-ins and players per raffle and draw in the last 30 days
dwh_ext_xxx.tr_raffle_draw_won
A player won a prize in a raffle draw. One row per prize.
raffle_name
INT64
ID of the raffle
raffle_draw_name
INT64
ID of the draw
dwh_ext_xxx.tr_raffle_prize_claimed
A player claimed a raffle prize that needs claiming. One row per claim.
raffle_name
INT64
ID of the raffle
raffle_draw_name
INT64
ID of the draw
dwh_ext_xxx.tr_jackpot_opt_in
A player opted in to a jackpot. One row per opt-in. For the bets and contributions, use jp_bet.
Joins:
jackpot_template → dm_jp_template (jp_template_id)
jackpot_template
NUMERIC
ID of the jackpot template
dwh_ext_xxx.tr_jackpot_user_win
A player won a jackpot. One row per win.
Joins:
jackpot_template → dm_jp_template (jp_template_id)
jackpot_template
NUMERIC
ID of the jackpot template
jackpot_amount
NUMERIC
Amount won, in the currency of the jackpot
jackpot_currency
STRING
Currency of the jackpot
Jackpot wins of the last 30 days, with the jackpot name
Clans
dwh_ext_xxx.tr_core_clan_joined
A player joined a clan. One row per join.
Joins:
core_clan_id → dm_ach_clans (clan_id). Cast the column to INT64 for the join
core_clan_id
NUMERIC
ID of the clan the player joined
core_clan_join_source_id
INT64
How the player joined: 1 = Campaign, 6 = Manual, 12 = Automation Rule, 23 = Clans UI (the player joined in the clan screen)
core_clan_entry_fee_currency_type_id
INT64
What the entry fee was paid in: 0 = Points, 1 = Gems, 2 = Diamonds, 3 = Free
core_clan_entry_fee_amount
NUMERIC
Entry fee amount
core_clan_is_switched
BOOL
TRUE when the player moved from another clan. Empty when the player had no clan before
dwh_ext_xxx.tr_core_clan_kicked_out
A player left a clan: the operator or the system removed the player, the player left, or the player moved to another clan. One row per exit.
Joins:
core_clan_kicked_out_id → dm_ach_clans (clan_id)
core_clan_kicked_out_id
INT64
ID of the clan the player left
core_clan_is_kicked
BOOL
TRUE when the operator or the system removed the player. Empty when the player left or moved to another clan
core_clan_id
NUMERIC
Clan of the player at the moment of this event: 0 = no clan
Last updated
Was this helpful?