Search code examples
androidgoogle-analytics-firebase

Track view Google Analytics


I have an Android application in which I want to track views. I am not sure if these are considered page views but I don't think they are.

Could someone tell me how to load a tracker so that the events sent would be sent to that specific view?

I have set up the tracking id and other event information.

tracker = analytics.newTracker(UA_TRACKER_ID);
tracker.setScreenName(screen);


if (tracker != null) {
    tracker.enableExceptionReporting(true);
    tracker.enableAdvertisingIdCollection(true);
    tracker.enableAutoActivityTracking(true);
    tracker.setScreenName("screen name");
    tracker.setAppName("app name");
    tracker.send(new HitBuilders.EventBuilder()
            .set("&cs", "campaign source")
            .set("&ck", "campaign stuff")
            .setCategory(category)

            .setAction(action)
            .setLabel(label)
            .build());
}

Solution

  • The issue was because I was manually setting the campaign source which in turn was resetting my type.

    I fixed it by adding

    .set("&t", "event")