android google analytics: need onreceive()? - android

I'm trying to integrate google analytics into an android app using the steps here:
http://code.google.com/mobile/analytics/docs/android/
Everything (i.e. screen views, events) is working except for the campaign/referral tracking. Is it enough to update the manifest.xml file? or do I also have to add an onReceive() method?
In the doc, the statement "Only one BroadcastReceiver class can be specified per application" is confusing me. I'm not sure if that means I have to implement one or is just a warning about potential conflicts if I already have one implemented.
New to Android, hopefully this is easy to solve... (

com.google.android.apps.analytics.AnalyticsReceiver is implemented already.
The statement in the docs means that if you want to use Analytics and AdMob referral tracking in one application you need to implement it yourself.
Also keep in mind that it doesn't work in realtime so it may take a day or two until some data shows up.

Related

Tracking an app is being uninstalled before or after specific time using Firebase Analytics

I'm having an issue now, I have an android app and its using Firebase Analytics, it has a tutorial when start, and I want to track people will uninstall my app after or before tutorial. I'm tried to add custom parameter
here
and tried to log an event with this code:
Firebase.Analytics.FirebaseAnalytics.LogEvent("app_remove", "first_tutorial", 1);
but it returns an error. I still don't know how to use parameter reporting right way.
Anyone can help me?
The app_remove event is logged automatically on Android. You don't need to write any code for it.
If you want to be able to analyze how many people completed the tutorial before uninstalling, you should log your own custom event (e.g. finished_tutorial) when the user finished the tutorial. Then you can compare the event counts in the dashboard, or do more complex funnel analysis in BigQuery.

How to correctly use and track App-invites?

Background
Google allows to perform app-invites and also track how well they improve your app installations:
https://www.youtube.com/watch?v=UfdCNYXMC9M
The problem
I made a simple app invite, and it seems people do use it, using this code:
public static Intent getAppInviteIntent(Context context) {
return new AppInviteInvitation.IntentBuilder(title,appName).setCustomImage(imageUri).setMessage(message).setCallToActionText(download).build();
}
startActivityForResult(getAppInviteIntent(this), GOOGLE_APP_INVITES_REQUEST_CODE);
This works, but in the Analytics webpage, I can't find a way to show the statistics of the app-invite, and that's even though they say it's automatic (here). Sadly, even what I've found seem quite old and they use deprecated functions.
What I've tried
I thought that maybe it's not quite automatic (because the tutorial has some extra code for the receiver part too, here), and that we might need to add some code, as this docs say :
When the user accepts an invitation and installs the app, getInvitation(GoogleApiClient, Activity, boolean) will update the invitation state to installed and return the invitation data in an intent accessed from AppInviteInvitationResult using getInvitationIntent()
Looking at Google's sample (here), I've noticed they created 2 activities. One is the main activity, which does have a call to "getInvitation" , and another is called "DeepLinkActivity" , and handles deep links (which is probably for extra data, like coupons).
I've also found some stackOverflow questions about the tracking (like here), but all I see is that people didn't succeed tracking yet.
The questions
What is the minimal code needed in order to track the invitations and how well they work, as shown on the video? What should be configured in Analytics page itself? I don't use deep linking currently, so I don't want to use it.
It seems that Google moved the app-invites feature to "firebase" gradle repositories. Is it a must-have? What are the advantages? We currently use the previous ones ("com.google.android.gms:play-services-appinvite:..." ). The dashboard of FireBase doesn't seem to include as much UI for analytics as Google Analytics. Not to mention of app-invites.
If the answer to #1 is that I need to use "getInvitationIntent", does it have to be on the main activity of the app ? Does it have to be in an activity at all (maybe broadcastReceiver?) ?
It seems it's possible to also invite to IOS too ( as shown here and here, using "setOtherPlatformsTargetApplication"). Is this correct? How does it work? What happens when an IOS user clicks the link? What should be put into the parameter of "clientId" and where do I get it from ?
Does G+ have app-invites? If so, does it also have analytics?
Great questions. I'll do my best to answer everything. Please ask if you need clarification.
Analytics tracking requires a tracking Id that you'll need to set using setGoogleAnalyticsTrackingId(String trackingId), which I don't see in your example. This tracking Id is then handed to the downstream events that record analytics tracking events for you:
When invitations are send (both email and sms).
When the invited user accepts the invitation by clicking on the invitation link or button.
When the developer calls getInvitation()
When the developer calls convertInvitation()
So, to answer your specific questions, here goes:
Just add your tracking ID to the builder as described above, and all the tracking events will be reported. No need for a deeplink, that's optional on invites.
Yes, appinvites api is copied to firebase while retaining the original. For now they are exactly the same. Future improvements will be in firebase, so migrate when you have time.
getInvitationIntent() is called on the result returned in the callback from getInvitation(), so the callback should be within an activity. Also, since you'll only expect an invitation immediately after launch, you really only need to check in the main activity and any activity that would be launched from intent filters that trigger on the deeplink. Sounds like you don't use deeplinks, so only the main activity. Generally you should call getInvitation() from all activities that may be directly launched from an invitation, this is how you determine if your app is launched from an invitation.
Yes, invites can go cross-platform in both directions, iOS -> android, and android -> iOS. You need to define both apps in the same project in console.developers.google.com, which is necessary to associate them. If there is more than one iOS app in the project, that api call is necessary to disambiguate the iOS app that is paired with the android app. The ClientID parameter is generated in the console when you create the OAuth Client Id using the pulldown menu from credentials section.
There isn't any separate G+ invites.
Answers:
The Firebase Dynamic Links on Android documentation explains how to view the analytics data shown directly in the Firebase console. The critical step is to follow the Firebase setup instructions, most importantly:
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
The Firebase analytics integration has been streamlined from the legacy integration that required a tracking Id. Now with Firebase only setup and a call to getInvitation() are needed. No additional code or tracking ids required. Remember it takes up to 24 hours to see the results in the console. However, you can see the messages being sent immediately which is a great indication that it's working. Just enable verbose logging as described in Analytics Log Events documentation.
The Firebase and android developer documentation for appinvites are identical.
Yes, you must call getInvitation() to get analytics tracking, and do the setup as described above.
The iOS and Android equivalence apps should be in the same project. Just move them to a single project in the Firebase console. You can just remove one from it's existing project and add it to the other to make a combined project. The change should be reflected instantly.

Google App indexing API deprication

Hi I want to implement google app indexing for android. But the documentation is confusing. Months ago I implemented local autocompletion using the following guide:
https://codelabs.developers.google.com/codelabs/app-indexing/#0
Now I want to enable google search feature, the doc claims that google systems will crawl my manifest file and based on intent-filters will do the indexing, here is a fragment of that doc:
https://developers.google.com/app-indexing/android/publish#add-app-indexing-api-calls
So I'm confused, what is the difference between this two links? Should I have both of them in my code or the previous link is just the old version of doing things ?
There is no difference in both the guides you mentioned. Except that in the 1st guide, you are capturing the result of AppIndex.AppIndexApi.start and writing it to log. And in the 2nd one, you are not.
Compare the onStart() method in both of them. You are first connecting to GoogleApi client. Then calling the start method of AppIndexApi.

Configuring Campaign Measurement on Android

For some time I have been trying to configure Google Campaign Measurement in my android app. I have followed the tutorial here and, after struggling with Google's documentation mess, arrived at the point where everything works as it should according to that tutorial. I receive the GAThread logcat message properly.
However, my Analytics panel receives no data, despite being paired with the Developer account. I think I may have a wrong idea of the whole process after following the tutorial, so please clarify:
I am following the first solution in the tutorial, with the already-implemented Receiver, which should send the data automatically. Do I need to have a Tracker configured for it anyway?
If I do need a tracker, which and where? It it enough to put a meta-data tag in my manifest like this:
android:name = "com.google.android.gms.analytics.globalConfigResource"
android:resource="#xml/global_tracker" />
If it is not enough, which of the trackers defined here do I need in order to receive the data properly?
Thanks!
You should use the latest Google Play Service 7.3, it provides more robust campaign tracking. You need to register both the campaign receiver and the campaign service in your AndoridManifest.xml as show in the hello world example app. You also need to configure at least one tracker and send at least one hit with it for campaign tracking to function correctly. To send hit it might be simpler to enable auto activity tracking with tracker.enableAutoActivityTracking(true). Installation campaign will be send to all known trackers you use in your app.

Missing ecommerce data and bad event tracking code

I have been using Google Admob and Google Analytics to track my apps so far with no any issue. I currently had notification on Analytics page as below:
Missing Ecommerce Data
Property Default view is configured for Ecommerce, but no data is flowing.
Bad Event Tracking Code
(not set) entry present in reports for property xxx | Android.
Note: Seems, app tracking also stopped for last 2 days. I have not made any changes in neither Analytics configurations nor within Android app.
How can i solve this issue? Thank you.
Same problem for us, suddenly stopped tracking eCommerce data for no reason, we haven't made any code changes so i'm not sure why. I heard that Google may be phasing out classic GA since UA is out of beta but i thought they would inform us rather than making changes and telling nobody.

Categories

Resources