Google Analytics

Android 中添加Google Analytics
https://developers.google.com/analytics/devguides/collection/android/v4/start
http://blog.csdn.net/codezjx/article/details/50405795
Google Analytics Web: 用于查看分析结果
https://www.google.com/analytics/web/


// 配置依赖关系
1、将下面的依赖关系添加到您的项目一级 build.gradle 中。
classpath 'com.google.gms:google-services:3.0.0'
2、将此插件添加到应用级 build.gradle 的底部。
apply plugin: 'com.google.gms.google-services'


// set StandardExceptionParser to ExceptionReporter
ExceptionReporter reporter = new ExceptionReporter(
        tracker,
        Thread.getDefaultUncaughtExceptionHandler(),
        Eb.applicationContext);
ArrayList<String> includePackages = new ArrayList<String>();
includePackages.add("com.mediatek.eb");
includePackages.add("com.mediatek.wearable");
reporter.setExceptionParser(new StandardExceptionParser(Eb.applicationContext, includePackages));
Thread.UncaughtExceptionHandler myHandler = reporter;
// Make myHandler the new default uncaught exception handler.
Thread.setDefaultUncaughtExceptionHandler(myHandler);


// Set the dispatch period in seconds. default 30
GoogleAnalytics.getInstance(this).setLocalDispatchPeriod(30);


// 不需要设置"后台调度",也能运行在Android Phone without Google Play Services


// TODO: Replace the tracker-id with your app one from https://www.google.com/analytics/web/
tracker = analytics.newTracker("UA-54478999-1");
// Provide unhandled exceptions reports. Do that first after creating the tracker
        tracker.enableExceptionReporting(true);
// Enable Remarketing, Demographics & Interests reports
// https://developers.google.com/analytics/devguides/collection/android/display-features
tracker.enableAdvertisingIdCollection(true);
// Enable automatic activity tracking for your app
tracker.enableAutoActivityTracking(true);

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值