const analyticsItemsHelper = (offer) => {
if (offer.name.includes('Web Coins')) {
offer.bonusItems.forEach((el) => {
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: el.itemId,
item_name: el.itemName,
context: offer.id,
quantity: +el.itemQuantity,
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: +currentUser.webCoin,
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
});
rubyIsActive &&
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: 'web_currency_ruby',
item_name: 'Ruby',
context: offer.id,
quantity: currencyQuantity('Ruby', offer),
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: +currentUser.ruby,
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
} else if (offer.name.includes('Rubies')) {
offer.bonusItems.forEach((el) => {
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: el.itemId,
item_name: el.itemName,
context: offer.id,
quantity: +el.itemQuantity,
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: +currentUser.ruby + el.itemQuantity,
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
});
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: 'web_currency_web_coin',
item_name: 'Web Coin',
context: offer.id,
quantity: currencyQuantity('Web Coin', offer),
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: +currentUser.webCoin,
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
} else {
offer.bonusItems.forEach((el) => {
console.log(activeCurrencies, 'activeCurrencies');
console.log(currentUser, 'currentUser');
console.log(offer, 'offer');
console.log(el.itemName, 'itemNameitemNameItemNameitemNameitemName')
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: el.itemId,
item_name: el.itemName,
context: offer.id,
quantity: +el.itemQuantity,
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: '',
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
});
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: 'web_currency_web_coin',
item_name: 'Web Coin',
context: offer.id,
quantity: currencyQuantity('Web Coin', offer),
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: +currentUser.webCoin,
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
rubyIsActive &&
Titan.SendEvent({
name: 'sys.game_transaction',
parameters: {
trans_type: 'reward_web_portal',
trans_desc: 'redeem_promo_code',
tournament_id: '',
item_id: 'web_currency_ruby',
item_name: 'Ruby',
context: offer.id,
quantity: currencyQuantity('Ruby', offer),
transaction_id: +transactionIdAnalytics,
stage_id: '',
gacha_pack: '',
gacha_pack_name: '',
battle_id: '',
season_id: '',
item_balance: +currentUser.ruby,
tickets: '',
skin: '',
is_sgss: '',
is_female_ss: '',
item_ev: '',
reference_id: 'special_offers',
discount_info: JSON.stringify({
promo_id: promotionId,
promo_code: input,
}),
alliance_id: currentUser?.factionId || '',
alliance_name: currentUser?.factionName || '',
league_level: currentUser?.leagueId || '',
player_level: currentUser?.playerId || '',
player_name: currentUser?.nickname || '',
},
});
}
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter