//public void SendScreenChangeEvent(GameWindow from, GameWindow to) //{ // //AnalyticsEvent // if (ShouldSkipSendEvent) // { // DebugLog($"[ANALYTICS] [Skip] {Constants.Analytics.Events.ScreenChange}: " + // $"From: {from.ToString()} To: {to.ToString()}"); // return; // } // AnalyticsResult analyticsResult = AnalyticsEvent.ScreenVisit(to.ToString(), new Dictionary<string, object> // { // {Constants.Analytics.Parameters.ScreenFrom, from}, // {Constants.Analytics.Parameters.ScreenTo, to} // }); // DebugLog($"[ANALYTICS] [{analyticsResult}] {Constants.Analytics.Events.ScreenChange}: " + // $"From: {from.ToString()} To: {to.ToString()}"); // return; //} // ad analytics private QLAdSourceType MapAdSource(AdSourceType source) { switch (source) { case AdSourceType.NotSet: return(QLAdSourceType.QLAdSourceTypeNotSet); case AdSourceType.FilmPopUp: return(QLAdSourceType.QLAdSourceTypeFilmPopUp); case AdSourceType.GoldCardPopUp: return(QLAdSourceType.QLAdSourceTypeGoldCardPopUp); case AdSourceType.InGame: return(QLAdSourceType.QLAdSourceTypeInGame); case AdSourceType.ReplayPopUp: return(QLAdSourceType.QLAdSourceTypeReplayPopUp); case AdSourceType.PostGame: return(QLAdSourceType.QLAdSourceTypePostGame); case AdSourceType.AndroidGold: return(QLAdSourceType.QLAdSourceTypeAndroidGold); default: //TODO add asset here? -> SHouldn't reach here return(QLAdSourceType.QLAdSourceTypeNotSet); } }
// **** REWARDED ADS **** public void ShowAdForReward(AdSourceType source, Action error = null, Action success = null, Action cancel = null, Action finished = null) { #if UNITY_EDITOR Debug.Log("[FYBER] ShowAdForReward, EDITOR -> RewardedVideo"); InvokeAndLog(success, nameof(success)); return; #endif adErrorCallback = error; rewardConfirmationCallback = success; adCanceledCallback = cancel; adFinishedCallback = finished; }
public void SendAdResult(AdResultType result, AdType type, AdSourceType adSource) { if (ShouldSkipSendEvent) { DebugLog($"[ANALYTICS] [Skip] AD EVENT: {MapAdResult(result).ToString()} {MapAdSource(adSource).ToString()}, {MapAdType(type).ToString()}"); return; } QLAdEvent adEvent = new QLAdEvent(MapAdResult(result), MapAdType(type), MapAdSource(adSource)); TrackEvent(adEvent); if (result == AdResultType.Watched) { AdjustEvent adjustEvent = new AdjustEvent(Constants.Analytics.AdjustEvents.AdImpression); adjustEvent.addPartnerParameter("type", $"{type.ToString()}"); adjustEvent.addPartnerParameter("eCPM", "0.0"); Adjust.trackEvent(adjustEvent); DebugLog($"[ADJUST] AD WATCHED - {adjustEvent.ToString()} - {type.ToString()}"); } }
public void CallRewardedVideo(AdSourceType adSource, bool inGame = false, RuleSettings gameRules = null) { DebugLog("[ADS] call rewarded video"); if (inGame) { sessionScript.OnPauseClick(); } adsController.TryShowIncentivised(() => { // started DebugLog("[ADS] rewarded video started"); analyticsController.SendAdResult(AdResultType.Started, AdType.RewardedVideo, adSource); SoundController.Instance.MuteMusic(true); }, () => { // finished DebugLog("[ADS] rewarded video finished"); analyticsController.SendAdResult(AdResultType.Watched, AdType.RewardedVideo, adSource); SoundController.Instance.MuteMusic(false); if (adSource != AdSourceType.FilmPopUp) { DebugLog("[ADS] adsource not film pop up"); SceneActivationBehaviour <PopupClaimCoinsActivator> .Instance.ShowClaimPopup(GameConstants.MainGame.FeatureMessages.ClaimYourPrizeHeader, globalSettings.Coins.RewardedVideoCoinRewardCount, CoinSourceType.VideoWatched, () => { if (inGame) { sessionScript.OnResumeClick(); } return; }); } else { DebugLog("[ADS] thank you panel"); SceneActivationBehaviour <UIFilmCounterActivator> .Instance.GrantFilm(globalSettings.Film.FilmRewardCount); analyticsController.FilmEarned(globalSettings.Film.FilmRewardCount, FilmSourceType.RewardedVideo); SceneActivationBehaviour <PopUpFilmActivator> .Instance.ShowThankyouPanel(() => { DebugLog("[TEST] claimed " + gameRules.PuzzleNameKey); StartCoroutine(StartGameHandler(gameRules)); return; }); } }, () => { // error DebugLog("[ADS] rewarded video error"); analyticsController.SendAdResult(AdResultType.Error, AdType.RewardedVideo, adSource); SoundController.Instance.MuteMusic(false); SceneActivationBehaviour <PopupRewardedVideoActivator> .Instance.ShowVideoErrorPopup(() => { if (inGame) { sessionScript.OnResumeClick(); } return; }); }, () => { // cancelled DebugLog("[ADS] rewarded video cancelled"); analyticsController.SendAdResult(AdResultType.Aborted, AdType.RewardedVideo, adSource); SoundController.Instance.MuteMusic(false); SceneActivationBehaviour <BoardBlurActivator> .Instance.Hide(); if (inGame) { sessionScript.OnResumeClick(); } return; }); }