[android] Added crown stats

This commit is contained in:
Dmitry Donskoy 2019-09-13 21:32:36 +03:00 committed by Aleksandr Zatsepin
parent 71f0d2aac9
commit 0278f5deff
7 changed files with 49 additions and 11 deletions

View file

@ -82,6 +82,7 @@ import com.mapswithme.maps.promo.PromoBookingDialogFragment;
import com.mapswithme.maps.purchase.AdsRemovalActivationCallback;
import com.mapswithme.maps.purchase.AdsRemovalPurchaseControllerProvider;
import com.mapswithme.maps.purchase.BookmarkSubscriptionActivity;
import com.mapswithme.maps.purchase.BookmarkSubscriptionFragment;
import com.mapswithme.maps.purchase.FailedPurchaseChecker;
import com.mapswithme.maps.purchase.PurchaseCallback;
import com.mapswithme.maps.purchase.PurchaseController;
@ -742,7 +743,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void openBookmarkSubscriptionScreen()
{
Intent intent = new Intent(this, BookmarkSubscriptionActivity.class);
Intent intent = new Intent(this, BookmarkSubscriptionActivity.class)
.putExtra(BookmarkSubscriptionFragment.EXTRA_ORIGIN_PARAM,
Statistics.ParamValue.SPONSORED_BUTTON);
startActivityForResult(intent, PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION);
}

View file

@ -387,7 +387,8 @@ public class BookmarksCatalogFragment extends BaseWebViewMwmFragment
if (frag == null || frag.getActivity() == null)
return;
BookmarkSubscriptionActivity.startForResult(frag, PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION);
BookmarkSubscriptionActivity.startForResult(frag, PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION,
Statistics.ParamValue.WEBVIEW);
}
@Override

View file

@ -9,6 +9,7 @@ import com.mapswithme.maps.purchase.BookmarkSubscriptionActivity;
import com.mapswithme.maps.purchase.PurchaseUtils;
import com.mapswithme.util.log.Logger;
import com.mapswithme.util.log.LoggerFactory;
import com.mapswithme.util.statistics.Statistics;
class InvalidSubscriptionAlertDialogCallback implements AlertDialogCallback
{
@ -23,7 +24,8 @@ class InvalidSubscriptionAlertDialogCallback implements AlertDialogCallback
@Override
public void onAlertDialogPositiveClick(int requestCode, int which)
{
BookmarkSubscriptionActivity.startForResult(mFragment, PurchaseUtils.REQ_CODE_PAY_CONTINUE_SUBSCRIPTION);
BookmarkSubscriptionActivity.startForResult(mFragment, PurchaseUtils.REQ_CODE_PAY_CONTINUE_SUBSCRIPTION,
Statistics.ParamValue.POPUP);
}
@Override

View file

@ -110,7 +110,10 @@ public class BookmarkPaymentFragment extends BaseMwmFragment
private void onBuySubscriptionClicked()
{
BookmarkSubscriptionActivity.startForResult(this, PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION);
Bundle extras = new Bundle();
extras.putString(BookmarkSubscriptionFragment.EXTRA_ORIGIN_PARAM, Statistics.ParamValue.CARD);
BookmarkSubscriptionActivity.startForResult(this, PurchaseUtils.REQ_CODE_PAY_SUBSCRIPTION,
Statistics.ParamValue.CARD);
}
@Override

View file

@ -20,10 +20,12 @@ public class BookmarkSubscriptionActivity extends BaseMwmFragmentActivity
return false;
}
public static void startForResult(@NonNull Fragment fragment, int requestCode)
public static void startForResult(@NonNull Fragment fragment, int requestCode,
@NonNull String extra)
{
Intent intent = new Intent(fragment.getActivity(), BookmarkSubscriptionActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(BookmarkSubscriptionFragment.EXTRA_ORIGIN_PARAM, extra)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
fragment.startActivityForResult(intent, requestCode);
}
}

View file

@ -33,6 +33,8 @@ import java.util.List;
public class BookmarkSubscriptionFragment extends BaseAuthFragment
implements AlertDialogCallback, PurchaseStateActivator<BookmarkSubscriptionPaymentState>
{
public static final String EXTRA_ORIGIN_PARAM = "extra_origin_from";
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.BILLING);
private static final String TAG = BookmarkSubscriptionFragment.class.getSimpleName();
private final static String EXTRA_CURRENT_STATE = "extra_current_state";
@ -91,10 +93,20 @@ public class BookmarkSubscriptionFragment extends BaseAuthFragment
Statistics.INSTANCE.trackPurchasePreviewShow(PrivateVariables.bookmarksSubscriptionServerId(),
PrivateVariables.bookmarksSubscriptionVendor(),
PrivateVariables.bookmarksSubscriptionYearlyProductId());
PrivateVariables.bookmarksSubscriptionYearlyProductId(),
getExtraOriginParam());
return root;
}
@Nullable
private String getExtraOriginParam()
{
if (getArguments() == null)
return null;
return getArguments().getString(EXTRA_ORIGIN_PARAM, null);
}
@Override
public void onDestroyView()
{

View file

@ -110,6 +110,7 @@ import static com.mapswithme.util.statistics.Statistics.EventParam.ERROR;
import static com.mapswithme.util.statistics.Statistics.EventParam.ERROR_CODE;
import static com.mapswithme.util.statistics.Statistics.EventParam.ERROR_MESSAGE;
import static com.mapswithme.util.statistics.Statistics.EventParam.FEATURE_ID;
import static com.mapswithme.util.statistics.Statistics.EventParam.FROM;
import static com.mapswithme.util.statistics.Statistics.EventParam.HAS_AUTH;
import static com.mapswithme.util.statistics.Statistics.EventParam.HOTEL;
import static com.mapswithme.util.statistics.Statistics.EventParam.HOTEL_LAT;
@ -684,6 +685,10 @@ public enum Statistics
public static final String ASK = "ask";
public static final String TODAY = "today";
public static final String NOT_TODAY = "not_today";
public static final String CARD = "card";
public static final String SPONSORED_BUTTON = "sponsored_button";
public static final String POPUP = "popup";
public static final String WEBVIEW = "webview";
static final String SEARCH_BOOKING_COM = "Search.Booking.Com";
static final String OPENTABLE = "OpenTable";
static final String LOCALS_EXPERTS = "Locals.Maps.Me";
@ -1608,13 +1613,23 @@ public enum Statistics
.add(BUTTON, isCross ? 0 : 1));
}
public void trackPurchasePreviewShow(@NonNull String purchaseId, @NonNull String vendor,
@NonNull String productId, @Nullable String from)
{
ParameterBuilder params = params().add(VENDOR, vendor)
.add(PRODUCT, productId)
.add(PURCHASE, purchaseId);
if (!TextUtils.isEmpty(from))
params.add(FROM, from);
trackEvent(INAPP_PURCHASE_PREVIEW_SHOW, params,
STATISTICS_CHANNEL_REALTIME);
}
public void trackPurchasePreviewShow(@NonNull String purchaseId, @NonNull String vendor,
@NonNull String productId)
{
trackEvent(INAPP_PURCHASE_PREVIEW_SHOW, params().add(VENDOR, vendor)
.add(PRODUCT, productId)
.add(PURCHASE, purchaseId),
STATISTICS_CHANNEL_REALTIME);
trackPurchasePreviewShow(purchaseId, vendor, productId, null);
}
public void trackPurchaseEvent(@NonNull String event, @NonNull String purchaseId)