screenName confusion in Google Analytics SDK v4 for Android - android

I have learnt integrating Google Analytics in my Android app from here. But, I am unable to understand the priorities of the screen name mentioned in xml and mentioned programatically via setScreenName. If both are mentioned which one will I see in the reports? Should I use any one approach instead of both? I am not providing code because it's available in the above-mentioned page.

You can find the answer for yourself by logging the screen name to the console after you set it:
// log which screen name Google Analytics is associated with right now
String screenName = tracker.get("&cd");
Log.d("GA Screen Name", screenName == null ? "(not set)" : screenName);

Related

Firebase DynamicLinks - Can i see analytics of link created by the new buildShortDynamicLink API?

I'm using the new buildShortDynamicLink API of Firebase (And it's great).
And i see there are two methodes for the ShortDynamicLink result:
Uri shortLink = task.getResult().getShortLink();
Uri flowchartLink = task.getResult().getPreviewLink();
I tried to use both but still the link doesn't apear in the Firebase dashboard.
What is getPreviewLink used for anyway?
Thanks.
Only analytics for links created in the console will show up in the console.
You can still access the analytics for your short links created via the API by using the Firebase Dynamic Links Rest API as described here (https://firebase.google.com/docs/reference/dynamic-links/analytics).
The getPreview returns the url to a visual flowchart that helps illustrate clearly how the link will work in each context. You can use it to debug the link if you want and to visually see how it will behave in different contexts.
Full disclosure: I work for Firebase.
This is expected. Only links created through the dashboard will show up there.
Think about it from this perspective: when your users are creating hundreds or even thousands of links per day, it will quickly make the dashboard completely useless if they all show up there.
At Branch.io (full disclosure: I'm on the Branch team), we take the same approach by default, though we do offer a manual flag you can change on programmatically-generated links to have them show up on the dashboard if desired.

Google analytics version 4 not able to send custom dimension

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

Google Play Game Service - Cannot unlock Achievements

I have implemented Google Play Game Service into my game by referring to the quick start given by Google.
I have added the achievement ids in my 'id.xml' file. My game has around 10 achievements. The code to unlock my achievements is as follows:
Games.Achievements.unlock(getApiClient(), "achievement_1_0");
where 'achievement_1_0' is the string name of one of my achievements.
My issue is that non of my achievements are getting unlocked, even when the conditions are correct. After viewing my log, I got this E/AchievementAgent(13528): Couldn't find local achievement to update for achievement ID achievement_1_0 from the session filter com.google.android.gms(Session Filter)
Any thoughts on what might have gone wrong? or is it a bug ..???
The code for unlocking an achievement is as follows:
Games.Achievements.unlock(getApiClient(), "your_achievement_id");
Here the achievement id is the id you get while creating achievement in Google Game Services.
That is in Google developer Console->Game Services->Your Application->Achievement
Hope this will help you..
#Anu is 100% correct. You are indeed using an incorrect ID for your achievements. However, using the codes from the Game services console is a very bad way to refer to your achievements (and it is very error prone).
The better way to refer to an achievement is to export your achievement IDs by using the Get resources link at the bottom of the Achievements screen in the Game services console. These are then placed inside a xml file in your apps resources. It seems like this is what you are referring to in your question (the id.xml file), so you may have already completed this step.
Once the xml file is in place you can then refer to your achievements using the descriptive IDs that were exported from the console. Do that as follows:
activity.getBaseContext().getString( R.string.achievement_1_0 );
Use your main Activity for activity and change the achievement_1_0 to the achievement's name attribute from the xml file. NOTE: achievement_1_0 must NOT be a string (i.e. not in quotes as in your current code), since it is referring to a string resource.
Always use this method to refer to your achievements - do not hardcode either the strings or the codes from the console as it will make your code much harder to maintain.
Im get this error debugging an app not in release.
I fix the problem adding my account/email as a new tester.
Google play console > Game Services > Testing > Add tester

How to track app by user id : Google Analytics

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:

How to use tracking id of google analytics in android app?

I am trying to integrate google analytics with my android app. I followed the steps in the following link:
https://developers.google.com/analytics/devguides/collection/android/v3/#manifest
Then i tried the look at the statistic of my app, but it seems like analytics is not working, i must have done something wrong. The problem is, in those steps we do not make use of the tracking id, and in google analytic's web site, it says that
Download the Google Analytics SDK for Android or iOS and implement the tracking code,
including this tracking ID.
What does it mean to "implement the tracking id"? What should i do about this can anyone help me?
Thanks
Use this:
Tracker tracker = GoogleAnalytics.getInstance(context).getTracker(ga_trakingId);
Then you can SET some variables, that will be send to GoogleAnalytics:
tracker.set(Fields.APP_NAME, "Best Android Application");
tracker.set(Fields.APP_VERSION, "1.0");
To SEND some info, events:
tracker.send(MapBuilder.createEvent("UX", "App Launch", null, null).build());
You must watch Behind the Code: The Google Analytics v3 Mobile SDKs, all info from there.
Update 1
Google Analytics API v4 you should create google-services.json file from here and then you can use:
public Tracker getTracker() {
return GoogleAnalytics.getInstance(this).newTracker(R.xml.global_tracker);
}
And then you canuse it like this way:
getTracker().setScreenName("SomeScreenOrActivityName");
getTracker().send(new HitBuilders.ScreenViewBuilder().build()); // send screen name
The new process generates a file by Google which is called GoogleService-Info.plist.
This file contains (key, string) and one of them is:
<key>TRACKING_ID</key>
<string>*YOUR TRACKING ID*</string> // Auto generated by GAI
Just open the file and confirm that this is your tracking ID.

Categories

Resources