Google Analytics Only track 1 screen, Android - android

I am trying to track the users that login into my app, but for no reason it only tracks the first screen.
Sometimes it track it with my package (com.company...), another times with the name Home Screen, and other times with "menu" (This one is what I put it)
I call this meted always I need to call a new screen.
public static void GATrackWithScreenName (String screen) {
Log.d(TAG, "Tracking "+screen);
Tracker tracker = GoogleAnalytics.getInstance(act).getTracker("UA-xxxxx-y");
HashMap<String, String> hitParameters = new HashMap<String, String>();
hitParameters.put(Fields.HIT_TYPE, "appview");
hitParameters.put(Fields.SCREEN_NAME, screen);
tracker.send(hitParameters);
}
Edit:
I also test this code, and some time works also with Map but no with Levels :S
Tracker easyTracker = EasyTracker.getInstance(act);
// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to null.
easyTracker.set(Fields.SCREEN_NAME, screen);
easyTracker.send(MapBuilder
.createAppView()
.build()
);
Also I need to wait like 30 secs in the screen to appear the connection, I got this app on iOS and it's instantly
Any ideas?

Try adding <integer name="ga_dispatchPeriod">10</integer> in your analytics.xml.
It worked for me!

Related

Firebase SDK Auth Package Trouble with Automatically Loading Scene Once Authenticated Unity

I am stuck with a functionality of the Firebase SDK (Auth package) regarding the Scenes and it's integration. Here's how they work:
1st: Loading Scene
Here, I just added the FirebaseInit code EXACTLY as suggested by Patrick, which it's only function is to call the next scene (Login/Register) once everything loads correctly.
2nd: Login/Register Scene
Here I do all the Login AND ALSO the register logic. I set up a button that alternates between the two (Activating the respective parent gameObject within the Canvas). Once the user log's in, the 3rd scene comes into play.
3rd: App's Main Screen Scene
Main Screen of the app, where the user can LOGOUT and return to the Login Scene.
Problem
I added the 'LoadSceneWhenUserAuthenticated.cs' in the 2nd Scene, and it works (kind of).
It actually does what it is supposed to. If I log in, quit the game without loging out, and open it again, it does come back directly to the 3rd scene. BUT some things are happening and they aren't supposed to.
First
When I Sign Up a user, I call the method 'CreateUserWithEmailAndPasswordAsync()'. Once it completes, it should activate the login screen and stay there, waiting for the user to fill in the password, but the 'FirebaseAuth.DefaultInstance.StateChanged' comes into play and forces the 3rd screen to be loaded, skipping several other steps that should be taken (email registration for example).
Second
As I mentioned in the end of number 1 above, if I try to log in to an account that does not have it's email verified, it works! (due to the 'LoadSceneWhenUserAuthenticated.cs' which is added in the scene). Code:
var LoginTask = auth.SignInWithEmailAndPasswordAsync(_email, _password);
LoginTask.ContinueWithOnMainThread(task =>
{
if (task.IsCanceled || task.IsFaulted)
{
Firebase.FirebaseException e =
task.Exception.Flatten().InnerExceptions[0] as Firebase.FirebaseException;
GetErrorMessage((AuthError)e.ErrorCode, warningLoginText);
return;
}
if (task.IsCompleted)
{
User = LoginTask.Result;
if (User.IsEmailVerified == true)
{
UIControllerLogin.instance.MainScreenScene();
}
else
{
warningLoginText.text = Lean.Localization.LeanLocalization.GetTranslationText($"Login/VerifyEmail");
}
I know that it's possible to fix this issue by adding an extra scene just before the login scene (as Patrick does in the youtube video) but it doesn't make any sense in my app. It would actually only harm the UX of it.
Patrick's Video:
https://www.youtube.com/watch?v=52yUcKLMKX0&t=264s
I'm glad my video helped!
My architecture won't work for every game, and I tried to boil it down to the bare minimum to get folks started. You may be able to get the functionality you want by adding an additional check in HandleAuthStateChanged:
private void HandleAuthStateChanged(object sender, EventArgs e)
{
if (_auth.CurrentUser != null && !_auth.CurrentUser.IsAnonymous && _auth.CurrentUser.IsEmailVerified)
{
SceneManager.LoadScene(_sceneToLoad);
}
}
but it does sound like, at this point, you'll want to build out a more robust registration/sign in flow that fits your use case.
If you need more help, I might suggest re-posting on the community mailing list or the subreddit. Those resources may be more better suited to discussing various pros/cons of different architectures or spitballing ideas (and feel free to link to any new posts in a comment so myself or others interested can follow along).

Firebase Analytics not showing screen names and events

I'm migrating from old google analytics to Firebase Analytics and now I'm tracking the screens using this:
mFirebaseAnalytics.setCurrentScreen(SectionManager.getInstance().getCurrentActivity(), name, null /* class override */);
And also tryed using this:
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "screen");
params.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, params);
And I'm tracking events using this:
Bundle params = new Bundle();
params.putString("category", "command");
params.putString("action", "test command");
params.putString("label", "command test label");
mFirebaseAnalytics.logEvent("ga_event", params);
I'm testing the application openning some screens and passing it's name, and also I'm pressing some times a button which executes the event tracking code I showed.
The first problem is that in firebase panel, I can't find the "test command" event... Don't sure where should I find it, but I can't find it.
The second problem is that I can see the "screen class" of the activities I'm using for opening the screens, which represents the name of the activity, but the name of the screens I passed as a parameter to firebase is not present. If i filter to show the screen name I got this:
User engagement Screen name Screen name % total Avg. time
(not set) NaN - 0m 0s -100
If you're using the setCurrentScreen() event, you should be able to see it at the Analytics > Events panel. Then, select screen_view and a screen with, beyond other stuff, a card titled firebase_screen will show you the sceen_view events grouped by the name you gave them when logging the event.
Another card titled User engagement will show you the screen_class you want to see, as well as the visualization percentage and average time spent on each screen.
Custom events (like your ga_event) should also be shown at the Analytics > Events section at the Firebase Dashboard.
Important: Custom events might take up to 24 hours after called to show up on Firebase.

Android : Tracking service component using google-analyticsV3

I made an application showing a window while calling in certain case, using service component.
The window contains info of callee.
I wanna know how to track this window.
Few buttons would be added with functions - ex : sending sms.
And I just wanna count how many times this window has been shown.
I found this question - Android: can I use Google Analytics inside a Service?
But it seems it's about old version of GA.
And I failed to make that in my app.
(I tried :
public class view extends Service {
...
GoogleAnalytics mGA;
Tracker gat;
...
#Override
public void onCreate() {
super.onCreate();
mGA = GoogleAnalytics.getInstance(app);
gat = mGA.getTracker("UA-my-account");
Map<String, String> params = new HashMap<String, String>();
params.put("event", "test");
gat.send(params); )
Let me know how to make tracker work in my app with GA V3.
Thanks for any help.
I made it.
GA = GoogleAnalytics.getInstance(YourContext);
Tracker = GA.getTracker("Your UA-xxxxxxxxxxxxxxxxxxx");
1. Tracker.send(MapBuilder.createEvent("category","action","label",long type value).build());
2. Tracker.set(Fields.SCREEN_NAME, "SCREEN NAME");
Tracker.send(MapBuilder.createAppView().build());
now wait for a day for this to be shown.

Where can i view the data sent by tracker on Google Analytics?

I have sent much data by Tracker to Google Analycis as following codes:
tracker= GoogleAnalytics.getInstance(this).getTracker("UA-46451607-1");
HashMap<String, String> hitParameters = new HashMap<String, String>();
hitParameters.put("type", "appview");
hitParameters.put("screen_name", "My Screen");
tracker.send(hitParameters);
After sent these data to platform,where can i see the result?
I would like to see the value of "type " and "screen_name",but i dont know how to view them on web.
Check it.
import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.Fields;
import com.google.analytics.tracking.android.MapBuilder;
public class YourBaseActivity extends Activity {
#Override
public void onStart() {
super.onStart();
EasyTracker tracker = EasyTracker.getInstance(this);
tracker.activityStart(this);
String trackingId = "UA-ABCDEFG-I";
tracker.set(Fields.TRACKING_ID, trackingId);
String category = "Activity Lifecycle Callback";
String action = "onStart()";
String label = "Screen: " + getClass().getSimpleName();
tracker.send(MapBuilder
.createAppView()
.createEvent(category, action, label, 0L)
.build();
);
}
#Override
protected void onStop() {
super.onStop();
EasyTracker.getInstance(this).activityStop(this);
}
}
Then go to www.google.com/analytics/. Click Access Google Analytics.
And on the screen: tab Reporting (at the top panel) -> Real-time -> Events. And you'll see something like this (maybe not immediately, but within a few minutes):
Select category (at the bottom of the figure - here is CATEGORY_ACTIVITY_CALLBACK) and you'll see a number of actions:
But unfortunately I still have not found a way to see "not-realtime" data.
Sorry for my English
Follow these steps
open this link www.google.co.in/analytics/
Click on access Google Analytics button in the right side of the top most corner of this screen.
It will redirect you to your home screen. Here you can see your app name
Click on All Mobile App data link on home screen just below the title of your project
It will redirect you to App overview page.
It is where you want to be . Yo can see complete report and details of your app.
You may want to use Fiddler2 as a proxy to view the data.
open your Google Analycis account. You can check all the details related to the app. use this link
https://www.google.com/analytics/web/?hl=en#report/app-overvi/a46388977w77407404p80019218/
and Sign up the account.
When your offline to see the google analytics report follow the below steps.
Step 1. Go to Reporting
Step 2. Behavior and check Overview and Screens
Note: The total report will submit to google analytics once in 24hrs of time

Google play services, sign in succeeded but error on create room

This is very similar to a problem someone else had on here except that the solution that fixed theirs is not my problem. (Note: I am using libgdx to develop this but I'm pretty sure that has nothing to do with this issue since the signing part is working)
#Override
public void startQuickGame() {
boolean signedIn = getSignedIn();
System.out.println(signedIn);
// automatch criteria to invite 1 random automatch opponent.
// You can also specify more opponents (up to 3).
Bundle am = RoomConfig.createAutoMatchCriteria(1, 4, 0);
// build the room config:
RoomConfig.Builder roomConfigBuilder = makeBasicRoomConfigBuilder();
roomConfigBuilder.setAutoMatchCriteria(am);
RoomConfig roomConfig = roomConfigBuilder.build();
// create room:
aHelper.getGamesClient().createRoom(roomConfig);
}
And here is where I check when the room is created.
final static int RC_WAITING_ROOM = 10002;
#Override
public void onRoomCreated(int statusCode, Room room) {
if (statusCode != GamesClient.STATUS_OK) {
System.out.println(statusCode);
return;
}
// get waiting room intent
Intent i = aHelper.getGamesClient().getRealTimeWaitingRoomIntent(room, Integer.MAX_VALUE);
startActivityForResult(i, RC_WAITING_ROOM);
}
The status code I'm getting there is 6 which corresponds to
STATUS_NETWORK_ERROR_OPERATION_FAILED
I'm definitely signed in before it creates the room as signedIn is always true.
My package name is matching, and I'm even seeing this in my api console.
Are you creating the room by Auto-Picking a name? Or by selecting someone in your circles?
I have not published my app in final release (several months of alpha/beta testing, and I'm close :) ), but when I create rooms that I have invited people that are NOT part of the testing group, I get Error 6 (and in fact I have created methods to handle that situation for the release version.. if that same error occurs when a user tries to create a room when released)
If the auto-pick works fine, and you have added the selected people into your testing emails, then the only time I've gotten error 6 would be when the network is having issues (whether on my end or Google's, not sure) but it has been very temporary in nature.
So, I would think ensuring that they are part of your testing group (and may even have to have installed the app, not sure on that part as I haven't tested that out... new test to add!), would be where I would start.
Figured it out. Misleading Javadoc plus human error.
I took that second argument to mean the max number of players, not the max number of players to invite, hence you + 3 others.
So here is the culprit in my code =p
Bundle am = RoomConfig.createAutoMatchCriteria(1, 4, 0);
Should be
Bundle am = RoomConfig.createAutoMatchCriteria(1, 3, 0);
And now it works just fine =)

Categories

Resources