public static void initGATracker(DroidPlannerApp app) { if (sAppTracker == null) { final Context context = app.getApplicationContext(); final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); // Call is needed for now to allow dispatching of auto activity reports // (http://stackoverflow.com/a/23256722/1088814) analytics.enableAutoActivityReports(app); analytics.setAppOptOut(!DroidPlannerPrefs.getInstance(context).isUsageStatisticsEnabled()); // If we're in debug mode, set log level to verbose. if (BuildConfig.DEBUG) { analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); } sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker); } }
public static void initGATracker(DroidPlannerApp app) { if (sAppTracker == null) { final Context context = app.getApplicationContext(); final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); // Call is needed for now to allow dispatching of auto activity // reports // (http://stackoverflow.com/a/23256722/1088814) analytics.enableAutoActivityReports(app); analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled()); // If we're in debug mode, set log level to verbose. if (BuildConfig.DEBUG) { analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); } sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker); } }
public static void initGATracker(DroidPlannerApp app) { if (sAppTracker == null) { final Context context = app.getApplicationContext(); final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); // Call is needed for now to allow dispatching of auto activity reports // (http://stackoverflow.com/a/23256722/1088814) analytics.enableAutoActivityReports(app); analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled()); // If we're in debug mode, set log level to verbose. if (BuildConfig.DEBUG) { analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); } sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker); } }
public synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); /*Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker( R.xml.global_tracker) : analytics.newTracker(Constants.GOOGLE_ANALYTICS_TRACKING_ID);*/ Tracker t = analytics.newTracker(Constants.GOOGLE_ANALYTICS_TRACKING_ID); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.setDryRun(false); analytics.getLogger().setLogLevel(Logger.LogLevel.INFO); analytics.setLocalDispatchPeriod(30); Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.app_tracker) : null; if (t != null) { t.enableAdvertisingIdCollection(false); } mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
public synchronized Tracker getTracker(TrackerName trackerId) { if (mTrackers.containsKey(trackerId)) { return mTrackers.get(trackerId); } final GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); final Tracker tracker; switch (trackerId) { case APP_TRACKER: tracker = analytics.newTracker(PROPERTY_ID); break; case GLOBAL_TRACKER: tracker = analytics.newTracker(R.xml.global_tracker); break; default: tracker = analytics.newTracker(R.xml.global_tracker); break; } tracker.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, tracker); return tracker; }
/** * Initialize the tracker */ private void initTracker() { final Context context = BarterLiApplication.getStaticContext(); if (!BuildConfig.REPORT_GOOGLE_ANALYTICS) { GoogleAnalytics.getInstance(context).setDryRun(true); GoogleAnalytics.getInstance(context).getLogger() .setLogLevel(Logger.LogLevel.VERBOSE); } else { GoogleAnalytics.getInstance(context).setDryRun(false); GoogleAnalytics.getInstance(context).getLogger() .setLogLevel(Logger.LogLevel.ERROR); } mApplicationTracker = GoogleAnalytics.getInstance(context) .newTracker(context.getString(R.string.ga_tracking_id)); //We will track manually since we use Fragments mApplicationTracker.enableAutoActivityTracking(false); mApplicationTracker.setSessionTimeout(SESSION_TIMEOUT); }
public static void initGATracker(DroidPlannerServicesApp app) { if (sAppTracker == null) { final Context context = app.getApplicationContext(); final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); // Call is needed for now to allow dispatching of auto activity // reports // (http://stackoverflow.com/a/23256722/1088814) analytics.enableAutoActivityReports(app); analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled()); // If we're in debug mode, set log level to verbose. if (BuildConfig.DEBUG) { analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); } sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker); } }
public void initializeGATracker() { // Set dryRun flag. GoogleAnalytics.getInstance(context).setDryRun(GA_IS_DRY_RUN); // Set the log level to verbose if dryRun. // DEFAULT is set to DRY RUN (only logging will happen) GoogleAnalytics.getInstance(context).getLogger() .setLogLevel(GA_IS_DRY_RUN ? Logger.LogLevel.VERBOSE : Logger.LogLevel.WARNING); // Set the opt out flag when user updates a tracking preference. /* SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); sp.registerOnSharedPreferenceChangeListener( new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences pref, String key) { if (key.equals(TRACKING_PREF_KEY)) { GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut( pref.getBoolean(key, false)); } } }); */ }
public void init(final Context context){ if (tracker==null) { if (context==null){ throw new IllegalArgumentException("No context set."); } // Create new tracker final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); tracker = analytics.newTracker(R.xml.analytics); } }
public synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker( R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
/** * Get the default {@link Tracker} for this {@link Application}. * * @return tracker */ public static synchronized Tracker getDefaultTracker(Context context) { if (mTracker == null) { GoogleAnalytics analytics = GoogleAnalytics .getInstance(context.getApplicationContext()); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); mTracker = analytics.newTracker(R.xml.global_tracker); } return mTracker; }
private void setupAnalyticsTools() { boolean isProd = !BuildConfig.DEBUG && BuildConfig.FLAVOR.equals("prod"); // setup fabric Crashlytics crashlytics = new Crashlytics.Builder().disabled(!isProd).build(); final Fabric fabric = new Fabric.Builder(this) .kits(crashlytics) .build(); Fabric.with(fabric); // set up timber Timber.plant(isProd ? new CrashlyticsTree() : new Timber.DebugTree()); // set up analytics GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); SharedPreferences userPrefs = PreferenceManager.getDefaultSharedPreferences(this); analytics.setAppOptOut(!userPrefs.getBoolean(getString(R.string.key_analytics), true)); analytics.getLogger().setLogLevel(Logger.LogLevel.ERROR); analytics.setDryRun(!isProd); userPrefs.registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals(getString(R.string.key_analytics))) { GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut(!sharedPreferences.getBoolean(key, true)); } } }); }
/** * Don't instantiate directly - use {@link #getInstance()} instead. */ private AnalyticsTrackers(Context context) { Context mContext = context.getApplicationContext(); GoogleAnalytics.getInstance(mContext).setDryRun(mContext.getResources().getBoolean(R.bool.ga_dryRun)); GoogleAnalytics.getInstance(mContext).getLogger().setLogLevel(Logger.LogLevel.VERBOSE); mTracker = GoogleAnalytics.getInstance(mContext).newTracker(mContext.getString(R.string.ga_trackingId)); mTracker.setSessionTimeout(300); mTracker.setAppVersion(BuildConfig.VERSION_NAME); mTracker.setAppId(BuildConfig.APPLICATION_ID); }
public static void init(Context context) { Preconditions.checkState(mAnalytics == null, "can't init twice"); mAnalytics = GoogleAnalytics.getInstance(context); if (BuildConfig.DEBUG) { mAnalytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); mAnalytics.setDryRun(true); } mTracker = mAnalytics.newTracker(R.xml.analytics_config); onAppCreate(); }
public synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); if (APPDEBUG) { analytics.getInstance(this).setDryRun(true); } Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : analytics.newTracker(R.xml.global_tracker); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
public synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Tracker t = analytics.newTracker(PROPERTY_ID); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
public synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Tracker t = analytics.newTracker(R.xml.app_tracker); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
private void initTracking() { if (mTracker == null) { GoogleAnalytics ga = GoogleAnalytics.getInstance(MovieManiacApp.getContext()); mTracker = ga.newTracker(R.xml.ga_config); ga.enableAutoActivityReports(MovieManiacApp.INSTANCE); ga.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); } }
public synchronized Tracker getTracker() { if (tracker == null) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.enableAutoActivityReports(this); if (BuildConfig.DEBUG) { analytics.setDryRun(true); } else { analytics.getLogger().setLogLevel(Logger.LogLevel.ERROR); } tracker = analytics.newTracker(R.xml.global_tracker); } return tracker; }
public SyncManager(Context context) { this.context = context; Manager.enableLogging("CityExplorer", Logger.LogLevel.VERBOSE); Manager.enableLogging("Sync", Logger.LogLevel.VERBOSE); openDatabase(); }
synchronized public Tracker getTracker() { Log.d(TAG, "getTracker called"); if (tracker == null) { Log.d(TAG, "tracker was null - returning new tracker"); GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.setDryRun(false); analytics.getLogger().setLogLevel(Logger.LogLevel.WARNING); analytics.setLocalDispatchPeriod(7200); tracker = analytics.newTracker(R.xml.app_tracker); return tracker; } return tracker; }
public synchronized Tracker getTracker(TrackerName trackerId) { //Log.d(TAG, "getTracker()"); if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); //analytics.getLogger().setLogLevel(Logger.LogLevel.INFO); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); // Global GA Settings // <!-- Google Analytics SDK V4 BUG20141213 Using a GA global xml freezes the app! --> analytics.setDryRun(false); analytics.enableAutoActivityReports(this); analytics.setLocalDispatchPeriod(30); // Create a new tracker Tracker t = (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker) : null; if (t != null) { t.setSampleRate(100.0); t.setSessionTimeout(300); t.setAnonymizeIp(true); t.enableExceptionReporting(true); t.enableAutoActivityTracking(true); } mTrackers.put(trackerId, t); //Log.v(TAG, "put mTrackers: " + trackerId.toString()); } Log.v(TAG, "return mTrackers"); return mTrackers.get(trackerId); }
@Override public void onCreate() { super.onCreate(); GraphHolder.getInstance().addModules(getModules()); if (BuildConfig.DEBUG) { GoogleAnalytics.getInstance(this).setDryRun(true); GoogleAnalytics.getInstance(this).getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Crashlytics.getInstance().setDebugMode(true); } Crashlytics.start(this); }
synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID) : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker( R.xml.global_tracker) : analytics.newTracker(R.xml.ecommerce_tracker); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); }
@Override public void onCreate() { super.onCreate(); // Enabling Advertising Features in Google Analytics allows you to take advantage of // Remarketing, Demographics & Interests reports, and more. Tracker t = getTracker(TrackerName.APP_TRACKER); t.enableAdvertisingIdCollection(true); if(BuildConfig.DEBUG) { GoogleAnalytics.getInstance(this).getLogger().setLogLevel(Logger.LogLevel.VERBOSE); GoogleAnalytics.getInstance(this).setDryRun(true); } }
public synchronized static Tracker getTracker(TrackerName trackerId) { if( GaiaGoogleAnalytics.playServiceAvviable(context)){ if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(context); analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE); Tracker t = analytics.newTracker(PROPERTY_ID); t.enableAdvertisingIdCollection(true); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); } return null; }
private GoogleAnalyticsHelper() { mGoogleAnalytics = GoogleAnalytics.getInstance(mContext); mGoogleAnalytics.enableAutoActivityReports(mContext); mGoogleAnalytics.getLogger().setLogLevel(BuildConfig.DEBUG && Boolean.valueOf(mContext.getString(R.string.analytics_logging_enabled)) ? Logger.LogLevel.VERBOSE : Logger.LogLevel.ERROR); mGoogleAnalytics.setDryRun(BuildConfig.DEBUG); }