I am new to Google Analytics.
I want to track my application by unique user id.
I am using Google Analytics SDK for Android v3.
I have this code on onStart().I read about user id and created a new view for user tracking.
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-xxx-2");
tracker.set(Fields.SCREEN_NAME, "Main Acitivty");
tracker.set("&uid", id);
tracker.send(MapBuilder.createAppView().build());
But I am not getting how can I get this uid in my Google Analytics Console,
I am trying to track user by their user_id , so I can get complete report of particular user.
I am able to get count of the total active user , screens and hit events.
But I didn't get any success on getting the same report user-wise.
I also tried to create custom dimension and metrics but those are also not reflecting on account.I have no idea Where can I check this field.
For custom variables :
easyTracker.send(MapBuilder
.createAppView()
.set(Fields.customDimension(1), "premiumUser")
.build()
);
I have searched , but I didn’t find any good tutorial on this.
Any help, suggestion , reference link would be greatly appreciated.
Thanks.
User Id is only used internally to make sure that the sessions from one user are tracked together - it just makes your stats more accurate, and enables cross device analytics.
You cannot acces the userId though:
User ID - Feature Reference
Limits
The User ID value can not be queried as a dimension in reports in either the web interface or the APIs
Also be sure not to send any user id like name or email:
User ID Policy
You will not upload any data that allows Google to personally identify an individual (such as certain names, social security numbers, email addresses, or any similar data)
You can find User ID Converage under Behaviour in the Audience section
check this image:
Related
Sorry for the ambiguity in the question but it is actually quite a simple one.
When my android Application boots up I initialize AppCenter as follows:
AppCenter.start(
this, BuildConfig.APP_CENTER_SECRET,
Analytics::class.java, Crashes::class.java, Distribute::class.java
)
if(BuildConfig.FLAVOR != ApplicationVariants.ProductFlavors.PRODUCTION){
AppCenter.setLogLevel(Log.VERBOSE)
}
AppCenter.setUserId(UUID.randomUUID().toString())
Distribute.setUpdateTrack(UpdateTrack.PUBLIC)
Distribute.checkForUpdate()
However, when the user logs into the application I would like to set the UserId to the users email as follows once the user logs in:
JwtUtils.getIdentityTokenModel(requireContext())?.let {
AppCenter.setUserId(it.email)
}
Lastly when the user logs out I reset the user Id to a random guid. The reason for this is visibility on which user has which crash logs. This is a requirement from business.
However, in the app center crash logs, it seems the UserId never changes to the email even if an error occurs while the user is logged in.
My question is simple. Is there a restriction on how many times I am allowed to change the AppCenter User Id? I cannot seem to find it anywhere in the docs.
Thanks in advance
Please see these docs about userId API:
The value for the user ID is limited to 256 characters. It will be
shown with your crash reports but not used for aggregation or counts
of affected users. In case you set user ID multiple times, only the
last user ID will be used. You need to set the user ID yourself before
each application launch, because this value isn't stored by the SDK
between launches.
I am trying to set user information to crash reports in crashlytics in Android App, so that it will help me to find out which of our users experienced a given crash. I have explored and found there are 3 APIs can set user information in crash report.
Those are,
void Crashlytics.setUserIdentifier(String identifier);
void Crashlytics.setUserName(String name);
void Crashlytics.setUserEmail(String email);
It is recommended to use all the APIs. All documented at http://support.crashlytics.com/knowledgebase/articles/120548-how-do-i-set-user-information-
But I have no idea,
1. How to get user-identifier, name and email details, which are input to those APIs?
2. Which place in program to call these crashlytics APIs?
Please share some ideas, how to implement this.
Regards
Annada
Looks like detail UI in Fabric has been changed.
Select one of crash issue.
Click Version in Recently Activity
On detail page top right hand corner, you should see affected user information.
If your application uses some form of user identification (i.e. login, email, phone, device specific id) you can use that as crashlitics user information. I suppose you can generate user id when your app is first launched and save it in shared preferences, for example. It'll be shown at top-right corner of detailed crash view.
i.e. I set ID and name as soon as user authenticates in my app.
You typically want to set them as soon as possible (as your data arrives) and all info has been initialized.
For new Firebase api
FirebaseCrashlytics.getInstance().setUserId("12345")
For More
Customize your Firebase Crashlytics crash reports
I have integrated Google Analytics into my Android app. The app is a photo printing app which contains a set of predefined themes that users can choose. However, is it possible to retrieve the stats from Google Analytics (e.g., the top 5 themes selected by user) using some api rather than using the Google Analytics console?
What you are looking for to retrieve the information is the Core Reporting API. Because the Google Analytics API requires all requests to be authenticated and your users are not authorized to access your Google Analytics account It is probably best to set up the API call on the server side using a service account here is an example of how to set up a python application to use a service account to access the API.
But what should your query be?
analytics.data().ga().get(
ids='ga:' + profile_id,
start_date='30daysAgo',
end_date='today',
metrics='ga:totalEvents',
dimensions='ga:eventLabels').execute()
Your application will need a way to access the results of the query from your own servers. You might also want to look into using the Google Analytics Super Proxy which solves a similar problem of allowing external users to access the results of an authenticated API request.
You could create an event in Google Analytics that would effectively track this. Events have Categories, Actions, labels, and event values. So you can fairly effectively add a theme or anything you wanted as a dynamic value. Then you would be able to search and sort in Google Analytics on the event category and find which Theme was used the most
#Override
public void themeSelected(String theme) {
// May return null if a Tracker has not yet been initialized with a
// property ID.
Tracker tracker = Tracker.getInstance(this);
// that are set and sent with the hit.
tracker.send(MapBuilder
.createEvent("Theme", // Event category (required)
"Theme Selected", // Event action (required)
theme, // Event label - Can dynamically set this with the theme that was selected so you can search in Google Analytics on it.
null) // Event value
.build()
);
}
Screenshot showing sorting off of the Event Label. My labels were numbers that users entered. Notice you can see the number of times each one was entered in the TotalEvents Column which should give you the information you were looking for
i have 2 different apps in the appstore, i am saving some data in a database (sql) like uid, ip, what page the user is on etc.
Is there a way to give a unique visitor an id or something like that so i can track the users activity in both apps.
And is it possible to see what buttons the user is clicking on.
I have added google analytics to the app but i only can see that there is a user on com.example.mainactivity and not the html pages that are the app.
Hope you guys understand what i mean.
You can use Google analytics to solve this problem with two different approaches. You can use the built in userId feature and it will even keep track of cross device sessions.
/**
* An example method called when a user signs in to an authentication system.
* #param User user represents a generic User object returned by an authentication system on sign in.
*/
public void onUserSignIn(User user) {
// Be careful when creating new trackers -- it is possible to create multiple trackers for the
// same tracking Id.
Tracker t = GoogleAnalytics.getInstance(context).newTracker("UA-XXXX-Y");
// You only need to set User ID on a tracker once. By setting it on the tracker, the ID will be
// sent with all subsequent hits.
t.set("&uid", user.getId());
// This hit will be sent with the User ID value and be visible in User-ID-enabled views (profiles).
t.send(new HitBuilders.EventBuilder().setCategory("UX").setAction("User Sign In").build());
}
Alternatively, you can use the Data Import feature to import external user infromation from multiple sources such as CRM data base and your SQL data base and you need to map their user representations to your own custom dimensions. You can follow the example in "Importing User Data to create AdWords Remarketing Lists" article. It shows how to use a custom dimension to represent a user id, and then upload even more custom dimensions about that user.
ga('create', 'UA-XXXX-Y', 'auto');
ga('require', 'displayfeatures');
ga('set', 'dimension1', 'NNNN'); // Where NNNN represents the CRM User Id.
ga('send', 'pageview');
Remember though Google Analytics does not support sending Personally Identifiable information, see the TOS.
I am trying to send the custom data in google analytics version 4 where the sending procedure seems to be different then previous version, I have create a custom dimention from google analytics web page then with the corresponding index I am sending the repective value as mention below,
Tracker tracker = ((Application) getApplication())
.getTracker(TrackerName.APP_TRACKER);
tracker.send(new HitBuilders.AppViewBuilder()
.setCustomDimension(1, "info1")
.build());
tracker.send(new HitBuilders.AppViewBuilder()
.setCustomDimension(2, "info2")
.build());
from the logs it seems that the data is send but not sure as I am unable to view any data in the google analytics web page.
You'll have to create a custom report and select the custom dimension, and any metrics associated with that custom dimension. For some reason Google hasn't (and who knows if they will) update the Custom Variables report.
You can define a custom report (Google Analytics > Customization (top tab)), but you need to make sure you select the right Metric or your information will not appear (e.g. ga:hits). https://support.google.com/analytics/answer/1151300?hl=en
Alternatively you can query the information through Google Analytics Query Explorer, although not choosing the correct dimension / metric will result in no data to appear (e.g. ga:dimension1 + ga:hits). http://ga-dev-tools.appspot.com/explorer/
Obviously might take a few good seconds / couple of minutes for information to be available, and important for fresh information make sure the date range includes today (yes, it happens to best of us to refresh furiously and find out Google Analytics date range was up to yesterday :-)
Developer reference (for anyone else looking for it): https://developers.google.com/analytics/devguides/collection/android/v4/customdimsmets