Umeng集成

官方文档


点击这里

统计分析之点击次数


  • 简单封装便于统一管理:

public class AnalyticsUtil {
private static final String TAG = "AnalyticsUtil";
private static AnalyticsUtil instance = null;
private AnalyticsUtil() {
}
public static AnalyticsUtil getInstance() {
synchronized (AnalyticsUtil.class) {
if (instance == null) {
instance = new AnalyticsUtil();
}
}
return instance;
}
public static void analyticsShopoing(Context context, int type) {
String eventId = "shop";
switch (type) {
case 0:
eventId = "shop_0";
break;
case 1:
eventId = "shop_1";
break;
case 2:
eventId = "shop_2";
break;
case 3:
eventId = "shop_3";
break;
}
// Log.d(TAG, "analyticsShopoing , eventId : " + eventId);
MobclickAgent.onEvent(context, eventId);
}
public static void analyticsEnvent(Context context, String eventId, HashMap map) {
MobclickAgent.onEvent(context, eventId, map);
}
}

你可能感兴趣的:(Umeng集成)