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);
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);