Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2017-05-10 19:13:59 +0300
committerGitHub <noreply@github.com>2017-05-10 19:13:59 +0300
commit6c5eb82e377e2db60a38a171ff11ad2be55624f1 (patch)
tree873251351c133d49737aed62998cf55083f7bfe8
parent419f9349d691f0a4c2fd0dce3ab677d4deb22c54 (diff)
parent16f8ee00bf044ca389c0d8077c4360bd868e9480 (diff)
Merge pull request #6027 from alexzatsepin/MAPSME-4449-1link-events-for-bannersbeta-799
[android] Added mytracker events for banners
-rw-r--r--android/src/com/mapswithme/maps/widget/placepage/BannerController.java8
-rw-r--r--android/src/com/mapswithme/util/statistics/Statistics.java18
2 files changed, 23 insertions, 3 deletions
diff --git a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
index a5d7ba6ac3..48372e8250 100644
--- a/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
+++ b/android/src/com/mapswithme/maps/widget/placepage/BannerController.java
@@ -35,6 +35,9 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.mapswithme.util.SharedPropertiesUtils.isShowcaseSwitchedOnLocal;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_CLICK;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_SHOW;
+import static com.mapswithme.util.statistics.Statistics.PP_BANNER_STATE_DETAILS;
+import static com.mapswithme.util.statistics.Statistics.PP_BANNER_STATE_PREVIEW;
+
final class BannerController
{
@@ -303,7 +306,7 @@ final class BannerController
else if (!mOpened)
{
close();
- Statistics.INSTANCE.trackPPBanner(PP_BANNER_SHOW, data, 0);
+ Statistics.INSTANCE.trackPPBanner(PP_BANNER_SHOW, data, PP_BANNER_STATE_PREVIEW);
}
else
{
@@ -395,7 +398,8 @@ final class BannerController
@Override
public void onClick(@NonNull MwmNativeAd ad)
{
- Statistics.INSTANCE.trackPPBanner(PP_BANNER_CLICK, ad, mOpened ? 1 : 0);
+ Statistics.INSTANCE.trackPPBanner(PP_BANNER_CLICK, ad,
+ mOpened ? PP_BANNER_STATE_DETAILS : PP_BANNER_STATE_PREVIEW);
}
}
}
diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java
index 5125628e5b..a7d920bba9 100644
--- a/android/src/com/mapswithme/util/statistics/Statistics.java
+++ b/android/src/com/mapswithme/util/statistics/Statistics.java
@@ -6,6 +6,7 @@ import android.location.Location;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
+import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
@@ -28,7 +29,10 @@ import com.mapswithme.maps.location.LocationHelper;
import com.mapswithme.maps.widget.placepage.Sponsored;
import com.mapswithme.util.Config;
import com.mapswithme.util.ConnectionState;
+import com.my.tracker.MyTracker;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -37,6 +41,7 @@ import java.util.Map;
import static com.mapswithme.util.statistics.Statistics.EventName.DOWNLOADER_DIALOG_ERROR;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_BLANK;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_ERROR;
+import static com.mapswithme.util.statistics.Statistics.EventName.PP_BANNER_SHOW;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_OWNERSHIP_BUTTON_CLICK;
import static com.mapswithme.util.statistics.Statistics.EventName.PP_SPONSORED_BOOK;
import static com.mapswithme.util.statistics.Statistics.EventParam.BANNER;
@@ -63,6 +68,13 @@ public enum Statistics
{
INSTANCE;
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({PP_BANNER_STATE_PREVIEW, PP_BANNER_STATE_DETAILS})
+ public @interface BannerState {}
+
+ public static final int PP_BANNER_STATE_PREVIEW = 0;
+ public static final int PP_BANNER_STATE_DETAILS = 1;
+
// Statistics counters
private int mBookmarksCreated;
private int mSharedTimes;
@@ -536,12 +548,15 @@ public enum Statistics
trackHotelEvent(PP_SPONSORED_BOOK, hotel, mapObject);
}
- public void trackPPBanner(@NonNull String eventName, @NonNull MwmNativeAd ad, int state)
+ public void trackPPBanner(@NonNull String eventName, @NonNull MwmNativeAd ad, @BannerState int state)
{
trackEvent(eventName, Statistics.params()
.add(BANNER, ad.getBannerId())
.add(PROVIDER, ad.getProvider())
.add(BANNER_STATE, String.valueOf(state)));
+
+ if (!eventName.equals(PP_BANNER_SHOW) || state == PP_BANNER_STATE_PREVIEW)
+ MyTracker.trackEvent(eventName);
}
public void trackPPBannerError(@NonNull String bannerId, @NonNull String provider,
@@ -556,6 +571,7 @@ public enum Statistics
.add(PROVIDER, provider)
.add(BANNER_STATE, String.valueOf(state));
trackEvent(eventName, builder.get());
+ MyTracker.trackEvent(eventName);
}
public void trackBookingSearchEvent(@NonNull MapObject mapObject)