<commit_before>package org.commcare.logging.analytics;

import android.os.Build;
import android.preference.Preference;
import android.preference.PreferenceManager;

import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;

import org.commcare.CommCareApplication;
import org.commcare.activities.CommCareSetupActivity;
import org.commcare.android.logging.ReportingUtils;
import org.commcare.dalvik.BuildConfig;
import org.commcare.preferences.CommCarePreferences;

import java.util.Map;

/**
 * All methods used to report events to google analytics, and all supporting utils
 *
 * @author amstone
 */
public class GoogleAnalyticsUtils {

    /**
     * Report a google analytics event that has only a category and an action
     */
    private static void reportEvent(String category, String action) {
        if (analyticsDisabled() || versionIncompatible()) {
            return;
        }
        getTracker().send(new HitBuilders.EventBuilder()
                .setCustomDimension(1, CommCareApplication._().getCurrentUserId())
                .setCustomDimension(2, ReportingUtils.getDomain())
                .setCustomDimension(3, BuildConfig.FLAVOR)
                .setCategory(category)
                .setAction(action)
                .build());
    }

    /**
     * Report a google analytics event that has a category, action, and label
     */
    private static void reportEvent(String category, String action, String label) {
        if (analyticsDisabled() || versionIncompatible()) {
            return;
        }
        getTracker().send(new HitBuilders.EventBuilder()
                .setCustomDimension(1, CommCareApplication._().getCurrentUserId())
                .setCustomDimension(2, ReportingUtils.getDomain())
                .setCustomDimension(3, BuildConfig.FLAVOR)
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .build());
    }

    /**
     * Report a google analytics event that has a category, action, label, and value
     */
    private static void reportEvent(String category, String action, String label, int value) {
        if (analyticsDisabled() || versionIncompatible()) {
            return;
        }<commit_msg>add new custom dimensions for app_id and is_consumer_app<commit_after>package org.commcare.logging.analytics;

import android.os.Build;
import android.preference.Preference;
import android.preference.PreferenceManager;

import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;

import org.commcare.CommCareApplication;
import org.commcare.activities.CommCareSetupActivity;
import org.commcare.android.logging.ReportingUtils;
import org.commcare.dalvik.BuildConfig;
import org.commcare.preferences.CommCarePreferences;

import java.util.Map;

/**
 * All methods used to report events to google analytics, and all supporting utils
 *
 * @author amstone
 */
public class GoogleAnalyticsUtils {

    /**
     * Report a google analytics event that has only a category and an action
     */
    private static void reportEvent(String category, String action) {
        if (analyticsDisabled() || versionIncompatible()) {
            return;
        }
        getTracker().send(new HitBuilders.EventBuilder()
                .setCustomDimension(1, CommCareApplication._().getCurrentUserId())
                .setCustomDimension(2, ReportingUtils.getDomain())
                .setCustomDimension(3, BuildConfig.FLAVOR)
                .setCustomDimension(4, "" + CommCareApplication._().isConsumerApp())
                .setCustomDimension(5, ReportingUtils.getAppId())
                .setCategory(category)
                .setAction(action)
                .build());
    }

    /**
     * Report a google analytics event that has a category, action, and label
     */
    private static void reportEvent(String category, String action, String label) {
        if (analyticsDisabled() || versionIncompatible()) {
            return;
        }
        getTracker().send(new HitBuilders.EventBuilder()
                .setCustomDimension(1, CommCareApplication._().getCurrentUserId())
                .setCustomDimension(2, ReportingUtils.getDomain())
                .setCustomDimension(3, BuildConfig.FLAVOR)
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .build());
    }

    /**
     * Report a google analytics event that has a category, action, label, and value
     */
    private static void reportEvent(String category, String action, String label, int value) {
        if (analyticsDisabled() || versionIncompatible()) {
            return;
        }
{'fraction_non_alphanumeric': 0.09583858764186633, 'fraction_numerical': 0.0029424127784783522, 'mean_word_length': 2.680587780355762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7589320', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1208, 'n_words': 295}