I'm new to this GA thing, and the guide on the official website (https://developers.google.com/analytics/devguides/collection/android/v4/) is not really clear to me.
For my first app I want some simple statistics: when people install the app or delete it, do they return to it after installing.
Also I'd like to make several apk's (not only for Google Play, but also for third-party websites) and see stats for each app (I've heard you can add some kind of markers for that).
I have the required permissions in my manifest:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
I also have a global_tracker.xml but it's not yet functional:
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="TypographyDashes">
<integer name="ga_sessionTimeout">300</integer>
<!-- Enable automatic Activity measurement -->
<bool name="ga_autoActivityTracking">true</bool>
<!-- The screen names that will appear in reports -->
<!-- The following value should be replaced with correct property id. -->
<string name="ga_trackingId">UA-hidden-2</string>
What else do I need to add and where? Is there some better guide rather that the one I linked above?
To track installations on Android you need to enable campaign tracking by registering CampaignTrackingService and CampaignTrackingReceiver in your ApplicationManifest.xml:
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
To also track applications referring your application (like browser link launching your application) you will also need to either enable automatic activity tracking with a call to tracker.enableAutoActivityTracking(true) or manually call tracker.setCampaignParamsOnNextHit(activity.getIntent.getData(). If you expect your app will run on Android API 11 or earlier (this is Android 3.0 Honeycomb) you also need to manually call analytics.reportActivityStart(this) from each Activity.onStart() and analytics.reportActivityStop(this) from each Activity.onStop() of your application activities.
Web sites don't actually distribute your app. They only link to Google Play store entry. You need to provide the web site with the URL to install your application. The URL you provide must include "referrer" parameter with your campaign parameters.
There is detailed campaign tracking devguide on Google Analytics developer site: https://developers.google.com/analytics/devguides/collection/android/v4/campaigns
There is URL builder at the end of the devguide that you can use to generate your download URL.
Related
I created a simple project using Firebase Messaging, using the following dependency.
implementation 'com.google.firebase:firebase-messaging:20.0.0'
I have built the app and checked its merged AndroidManifest.xml file. The only exported component by Firebase Messaging SDK is the following receiver:
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
I couldn't find the definition of the permission com.google.android.c2dm.permission.SEND, even though I have decoded AndroidManifest.xml of Google Play Services APK and found nothing there. Apart from its definition whatever it is, it cannot prevent a malicious app to use-permission it and broadcast forged Intents. Also because of Intents being delivered by system_server, the receiver cannot check the identity of the sender.
How does Firebase Messageing SDK counterattack this threat?
A malicious app installed from the Play Store cannot use any permission that starts with "com.google.android". Those are reserved for system privileged apps.
The Play services "backend" app, which is installed on every device that has the Play store, actually handles incoming FCM messages directly. It is a privileged app, and is the only one that will use those permissions to send data to your app.
If you manage to root your device and install a malicious app with system privileges, then you might have a problem. But that's the risk you take when you bypass the security measures built into the device.
I have uploaded application for android TV so many times but still rejected that application. the reason is "your application crashed when attempting to purchase 'gas.'", but in our case we checked our side like add email in developer account --> account details --> "License Testing" and also check real time purchase like add credit card/debit card so it working perfectly fine, so I don't know what is the reason behind that, so is there any why like we give access to google as a tester? or any other way? so please give me solution
this is the error that exact showing google
I have tried in our side like we check payment part in as a tester and also tried real time test like we add credit/debit card
Please add this in your manifest file.
In your launcher activity add the following intent filter.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
also your manifest file must have this tag.
<uses-feature
android:name="android.software.leanback"
android:required="true" />
These are necessary steps for Android tv apps, otherwise your app is not recognized as a tv app and Google won't accept.
I am using Facebook SDK 4 for Android to send GameRequest along with custom item. That works fine but how do I track that the request was accepted so that I can give that item to the recipient?
When I tap the request in native Facebook app then it shows the app which sent the request and I can tap 'Play' which opens up Google Play store app with that app (even though the app is installed on the device) and since the app is not yet in the store - it says 'Item not found' (that is understandable).
As per Facebook docs, if the app has presence on Canvas then it receives GET params with request IDs but I could not find how this works on mobile. The app is not launched directly so how am I supposed to find out whether the user accepted the request?
My AndroidManifest.xml
<application android:name=".AppEntry" .... >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</aplication>
In Facebook dashboard the Google Play package is the same as in the AndroidManifest and Class Name is specified to .AppEntry, yet still the app is not launched directly but goes into Google Play store app instead.
Commenter Ming Li provided the correct answer:
You should put in a fully qualified class name, like com.your.package.AppEntry
Add libGoogleAnalytics.jar to your project's /libs directory.
Add the following permissions to your project's AndroidManifest.xml manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Add the following code snippet to your project's AndroidManifest.xml manifest file:
<!-- Used for install referrer tracking -->
<receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" >
</intent-filter>
</receiver>
But I never entered my UA-xxxxx-yy ID. The ID entered for Pageviews and Events tracking like this:
tracker.startNewSession("UA-xxxxx-yy", this);
Google Analytics for Android SDK ReadMe says: (NOTE: do not start the GoogleAnalyticsTracker in your Application onCreate() method if using referral tracking).
With referrer tracking where do i put my ID or not? If need, how? If not, why?
At first, it seemed strange to me that Google would require those who only need to do install referrer tracking to incorporate two permissions that might otherwise be unneeded, plus a library, into their apps, given that the information needed to track referrers is already available on the Google Play servers, and could presumably be accessed from there via a Web-based interface, similar to the one used to track purchases on the Chrome Web Store. When you consider that the app-based Analytics interface does not even cover purchases via the GP Web pages, the case for doing this seems even more convincing.
This omission still seems odd in the general case of tracking an arbitrary referrer, but I recently discovered that in the specific case where the referrer that you are trying to track comes from an Adwords ad, there seems to be an easier means of tracking Google Play app installs that does not require any modifications to your app. All of this is set up through the Adwords interface, not through Google Play, and not through modifications to your app.
You did not indicate whether your referrers were from Adwords or from some other source or sources, so I'll provide this information, in case it is useful.
This page
http://support.google.com/adwords/bin/answer.py?hl=en&answer=1722054
describes how to set up conversion tracking of Google Play app sales via Adwords. From that page:
Tracking mobile app downloads from Google Play doesn't require adding a code snippet. It can be done with no changes to your app's code. Simply follow the steps below.
Sign in to your AdWords account at http://adwords.google.com
Click the "Tools and Analysis" tab, and then click the "Conversions" tab.
Click the "+ New conversion" button.
Name your conversion, select "Mobile app download" and click "Save and continue". Enter the package name. (You can find your package name by looking up your app in Google Play. It's the part of the base URL that identifies your application: "https://play.google.com/store/apps/details?id="
Click "Save and continue".
On the next screen, click "Done".
Your mobile app downloads conversion data will now start showing up with the rest of your conversion data within 24 hours.
Note: Mobile application download tracking for Android will only work if your links in Click-to-download or Mobile App Extension ads point directly to the Google Play Store. Third-party tracking URLs are not supported at this time.
Check the GA SDK implementation at - the measurement is explained very clearly. https://developers.google.com/analytics/devguides/collection/android/v2/campaigns#google-play-implement
if I include the code following code in AndroidManifest.xml, then will it send a notification on notification or there is something more to be included.
<receiver android:name="com.google.android.apps.analytics.AnalyticsReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
How to view installation report in Google Account and What parameters are required to be set in the account?
UA-Account number is the id to be used for websites, is it required for android app installation notification.
Can any one specify the exact procedure to view Android application installation in Google Analytics and coding snippets required.
I think all of your questions are answered here.
In summary:
You need to include the Google Analytics SDK for Android
You need a UA number, which you provide when you call startNewSession: tracker.startNewSession("UA-YOUR-ACCOUNT-HERE", this);
Google provides a fully functional sample application which starts/stops the GoogleAnalyticsTracker instance in your Activity and tracks events and page views, as well as dispatches the results (stored locally on the phone until dispatched to the analytics server)
Include AnalyticsReceiver to track referrals