简体   繁体   中英

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());
}

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM