简体   繁体   中英

How to track user preferences with Google Analytics for Android?

I would like to understand what kind of Preferences my users have in my application. I was thinking about something like:

EasyTracker easyTracker = EasyTracker.getInstance(context);
easyTracker.send(MapBuilder
        .createEvent("user",
                "prefs",
                "data",
                (long) data)
                .build()
        );

And then pass the data like:

if (user_name != "") { data += 1; }
if (user_address != "") { data += 10; }
if (user_phone != "") { data += 100; }

But will I be able to track then for ex., how many users have empty user_address ?

I think there are 2 better options for this type of data.

  1. Your applications database. SQL select statements can give you counts and specific values already. No need to track in an additional place. Example:

    select sum(if(user_name is null,0,1)) as num_Users_With_UserName from users group by if(user_name is null,0,1)

  2. If you only have these 3 preferences to track and you want to see them in GA for whatever reason I recommend custom variables or custom dimensions (depending on what version of GA you're using) not events. These can be set with a user scope you can track changes for a user but keep the state of their preference across visits. Events are best for tracking clicks and user variables are best tracked in custom variables or custom dimensions. (You may want to combine a custom dimension for 'Has Username' and an event for when the Username field changes state for example.)

I would recommend using:

EasyTracker.getTracker().sendEvent("user", "prefs","has_name", 1l);
EasyTracker.getTracker().sendEvent("user", "prefs","has_address", 1l);
EasyTracker.getTracker().sendEvent("user", "prefs","has_phone", 1l);

Although you have to be sure to send such even once, when entering it for the first maybe? You could send -1 when user unsets ( not 100% if it would work ), and you dont have to care if he edits it.

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