关闭

Google Analytics

标签: androidgoogleAnalytics
161人阅读 评论(0) 收藏 举报
分类:
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
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:4392次
    • 积分:236
    • 等级:
    • 排名:千里之外
    • 原创:17篇
    • 转载:17篇
    • 译文:1篇
    • 评论:0条
    文章分类