Search code examples
androidgoogle-analyticsgoogle-analytics-firebase

GoogleAnalytics custom dimension and metric values not updated


I created a custom dimension and metric and am trying to fill it with data from an Android app. I created a new dashboard of a table using the custom dimension (user id which is declared at the user scope) and the custom metric (bad attempts which is at the hit scope level), but the dashboard says that there are no values to show. Maybe I'm sending the data in a wrong way?

This is how I do it:

public static enum CustomDimensions
{
    USER_ID(1);

    private int value;

    CustomDimensions(int numVal)
    {
        this.value = numVal;
    }

    public int getValue()
    {
        return value;
    }
};

public static enum CustomMetrices
{
    BAD_ATTEMPTS(1);

    private int value;

    CustomMetrices(int numVal)
    {
        this.value = numVal;
    }

    public int getValue()
    {
        return value;
    }
};

public static void SendCustomEvent(Activity act, CustomDimensions cd, String dimensionValue,
        CustomMetrices cm, int metricValue)
{
    Tracker tracker = getGoogleAnalyticsTracker(act);
    tracker.send(new HitBuilders.EventBuilder().setCustomDimension(cd.getValue(), dimensionValue).build());
    tracker.send(new HitBuilders.EventBuilder().setCategory("customCategory").setAction("customAction")
            .setLabel("customLabel").setCustomMetric(cm.getValue(), metricValue).build());
}

and the call itself:

SendCustomEvent(this, CustomDimensions.USER_ID,
                        "1", CustomMetrices.BAD_ATTEMPTS, 1);

In the behavior section of the report I do see the events with customCategory and so on, but not any value of the dimension or metric.


Solution

  • It seems that regular events are updated sooner than custom dimensions and metrices. I could see that a "customCategory" event was created but nothing was shown in the custom dimension value. After another 24 hours (48 total), I got the data and can now see it.