Panagiotis Triantafyllou

analytics

......@@ -18,6 +18,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -26,8 +27,10 @@ import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -229,6 +232,13 @@ public class ContextualActivity extends Activity implements View.OnClickListener
}
private void errorActivatingDialog() {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_offer_activated");
analyticsEvent.setParameter("name", mCCMS.getTitle());
analyticsEvent.setParameter("type", "gift");
analyticsEvent.setParameter("successful", "false");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
mAlertDialogErrorActivating = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_title)
.setMessage(R.string.cos_dlg_error_subtitle)
......@@ -239,6 +249,13 @@ public class ContextualActivity extends Activity implements View.OnClickListener
}
private void successActivatingDialog() {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_offer_activated");
analyticsEvent.setParameter("name", mCCMS.getTitle());
analyticsEvent.setParameter("type", "gift");
analyticsEvent.setParameter("successful", "true");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
mAlertDialogSuccessActivating = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_activate_success_title)
.setMessage(R.string.cos_dlg_activate_success_subtitle)
......
......@@ -32,6 +32,7 @@ import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.request.WarplyGetCampaignsRequest;
import ly.warp.sdk.io.request.WarplyRedeemCouponRequest;
......@@ -201,13 +202,13 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
mCoupon.setDescription(mCouponset.getShortDescription());
mCoupon.setImage(mCouponset.getImgPreview());
mCoupon.setName(mCouponset.getName());
showDialog(true, 1);
new Thread(() -> {
if (!Thread.currentThread().isInterrupted()) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback);
}
}).start();
showDialog(true, 1);
} else {
showDialog(false, status);
}
......@@ -222,6 +223,13 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private void showDialog(boolean success, int status) {
if (success) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_offer_activated");
analyticsEvent.setParameter("name", mLoyalty.getTitle());
analyticsEvent.setParameter("type", "coupon");
analyticsEvent.setParameter("successful", "true");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
mAlertDialogCouponset = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_success_couponset_title)
.setMessage(R.string.cos_dlg_success_couponset_subtitle)
......@@ -233,6 +241,13 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
})
.show();
} else {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_offer_activated");
analyticsEvent.setParameter("name", mLoyalty.getTitle());
analyticsEvent.setParameter("type", "coupon");
analyticsEvent.setParameter("successful", "false");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
if (status == 3) {
mAlertDialogCouponset = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_title)
......
......@@ -35,6 +35,7 @@ import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.MergedGifts;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.utils.WarpJSONParser;
......@@ -235,6 +236,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", dataItem.getCampaign().getTitle());
analyticsEvent.setParameter("type", "coupon");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
......@@ -263,6 +270,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", dataItem.getCampaign().getTitle());
analyticsEvent.setParameter("type", "coupon");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
......@@ -320,6 +333,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
seasonalCLick.setContext(GiftsForYouActivity.this);
EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick));
} else if (dataItem.getDataType() == 3) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", dataItem.getCCMS().getTitle());
analyticsEvent.setParameter("type", "gift");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class);
intent.putExtra("ccms", dataItem.getCCMS());
startActivity(intent);
......
......@@ -44,6 +44,7 @@ import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
import ly.warp.sdk.io.models.ActiveDFYCouponModel;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -201,9 +202,19 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
WarplyDealsAnalysisEventModel warplyDealsAnalysisEventModel = new WarplyDealsAnalysisEventModel();
warplyDealsAnalysisEventModel.setPressed(true);
EventBus.getDefault().post(new WarplyEventBusManager(warplyDealsAnalysisEventModel));
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_deals_for_you_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
return;
}
if (view.getId() == R.id.cl_deals_win) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("did_tap_gifts_for_you_badge");
analyticsEvent.setParameter("screen", "Loyalty Wallet");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(LoyaltyWallet.this, LoyaltyAnalysisActivity.class);
startActivity(intent);
return;
......
......@@ -571,6 +571,12 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
}
private void handleMoreContextualItemClick(LoyaltyContextualOfferModel ccmsItem) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", ccmsItem.getTitle());
analyticsEvent.setParameter("type", "gift");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(MoreForYouActivity.this, ContextualActivity.class);
intent.putExtra("ccms", ccmsItem);
startActivity(intent);
......
......@@ -71,6 +71,7 @@ import ly.warp.sdk.io.models.CustomerStateModel;
import ly.warp.sdk.io.models.LoyaltyBadgeModel;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.models.PushCampaign;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
......@@ -646,6 +647,12 @@ public class WarplyManagerHelper {
public static void handleContextualCampaigns(Context context, LoyaltyContextualOfferModel item) {
if (item != null) {
if (TextUtils.isEmpty(item.getLoyaltyCampaignId()) || item.getLoyaltyCampaignId().equals("NA")) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", item.getTitle());
analyticsEvent.setParameter("type", "gift");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent intent = new Intent(context, ContextualActivity.class);
intent.putExtra("ccms", item);
context.startActivity(intent);
......@@ -780,6 +787,12 @@ public class WarplyManagerHelper {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", item.getTitle());
analyticsEvent.setParameter("type", "coupon");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
WarplyManager.getSingleCampaign(item.getSessionUUID());
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
......@@ -808,6 +821,12 @@ public class WarplyManagerHelper {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_sdk_offer_selected");
analyticsEvent.setParameter("name", item.getTitle());
analyticsEvent.setParameter("type", "coupon");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
WarplyManager.getSingleCampaign(item.getSessionUUID());
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
......
......@@ -67,6 +67,7 @@ import java.util.concurrent.TimeUnit;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.io.models.CouponEventModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.QuestionnaireEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
......@@ -431,6 +432,10 @@ public class WarpView extends WebView {
EventBus.getDefault().post(new WarplyEventBusManager(pacingWidgetVisible));
} else if (parts[1].equals("steps") && parts[2].equals("shortcutEnabled")) { // This is for the pacing service
if (!isMyServiceRunning(WarplyHealthService.class)) {
LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
analyticsEvent.setEventName("loyalty_steps_activation");
EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
Warply.getWarplyContext().startService(stepsServiceIntent);
......