Exemplo n.º 1
0
 public static void event(
     Activity activity,
     GoogleAnalyticsTracker tracker,
     String category,
     String action,
     String label) {
   if (tracker != null && analyticsEnabled(activity)) {
     tracker = attachCustomVars(activity, tracker);
     Log.i(
         Utils.TAG,
         "[Analytics] Tracking event - category: "
             + category
             + ", action: "
             + action
             + ", label: "
             + label);
     // tracker.setDebug(true);
     tracker.setAnonymizeIp(true);
     tracker.trackEvent(category, action, label, -1);
     tracker.dispatch();
   }
 }
Exemplo n.º 2
0
  public static void page(
      Activity activity, GoogleAnalyticsTracker tracker, String page, boolean checkEntry) {
    if (tracker != null && analyticsEnabled(activity)) {

      if (checkEntry) {
        String source = entrySource(activity);
        if (source != null) {
          Log.i(
              Utils.TAG,
              "[Analytics] Marking next page view as an entry to the app of type: " + source);

          markEntry(activity, tracker, source);
        }
      }

      tracker = attachCustomVars(activity, tracker);

      Log.i(Utils.TAG, "[Analytics] Tracking page - " + page);
      // tracker.setDebug(true);
      tracker.setAnonymizeIp(true);
      tracker.trackPageView(page);
      tracker.dispatch();
    }
  }