I want to use Google Analytics to collect more information about the use of my applications, how to add Google Analytics to my Android application?
That's was made very easy now a days by Android Studio guys.
i. create analaytics id from Google analytics, sign in to your google analytics account. In the home page -> choose admin -> property column ->click the first dropdown - > press create new property.
ii. In this create property screen you are going give information like whether you need analytics id for website/app, fill information you will get an tracking id.
iii. open your android studio -> your porject - > right click project name- > open module settings -> choose google analytics -> it will list the property name which you have just created, select and click okay. (It will add needed dependencie files)
That's it, you are done add events with trackers to your project.
I always like to start with a sample, you can try the Google Analytics sample first, you can download it from here.
In order to run it, you have to download a json file and add it to your project's 'app' folder, you can get that from here.
Basically just have to follow this (in comment) page with the sample you successfully build, you should be good to go. It's surprisingly simple to implement specially if you worked with other google services before, good luck!
Related
I need to use Google analytics services in my app (android and ios). I created a project in Google API Console and imported it into Firebase for FCM services. But after that, I cannot link the Google project into Google Analytics and get configuration file. When I try to get configuration file and select app name, it jumps to Firebase console.
If I add Android or iOS in the Firebase project, the configuration file I got doesn't have google analytics info.
Anyone know how to solve this. I need to use Google Analytics in my app but not the Firebase analytics.
I also need to support both standalone Google Analytics SDK and Firebase Analytics, and I was finally able to find a solution in this Google Analytics Support answer (Analytics for mobile apps).
Google Analytics without Firebase:
Go to Google Analytics > Admin > Create new Property
Select Website, using your app name as Website Name, and optionally your company website as Website URL.
Back up to the Admin page.
For the Property you just created, in the right-most column (View), there should be an "All Website Data" view. Create a new View.
Select Mobile App, naming the view something appropriate, like "All Mobile Data".
Note: Property Settings will now contain a valid GA Tracking ID you'll need for client set-up.
Google Analytics with Firebase:
Create a Firebase project for your app.
Go to Google Analytics > Admin > Create new Property
Select Mobile App, then use the "Link to Firebase" dropdown to connect to the Firebase project you created in Step 1.
Keep in mind that while there is still a standalone, non-Firebase Google Analytics API to support legacy applications, Google is definitely pushing all new application-development over to Firebase APIs. My opinion is that this solution is mainly good for libraries that need to support new & legacy apps, or during a transitional period.
Refill and Re-enter your application name in App name field manually, so that you will not have to select the routing to the Firebase option and it will not take you to the firebase console.
It's a silly thing by google
TO go to enable or disable the api like map , drive and other of google apis from Firebase project go to this link and will see all api , hope this help.
1. If you don't have GoogleAnalytcs library in your project, get it.
You can use cocoapods: pod 'Google/Analytics'.
2. Get Tracking ID from https://analytics.google.com. If you have not created an analytics account yet, you can do it there:
3. Add this Tracking ID to GoogleService-info.plistwith key TRACKING_ID:
4. Configure the app:
// Configure tracker from GoogleService-Info.plist.
var configureError:NSError?
GGLContext.sharedInstance().configureWithError(&configureError)
5. Example - sending screenView:
func sendScreenView(name: String) {
let tracker:GAITracker = GAI.sharedInstance().defaultTracker as GAITracker
let build = GAIDictionaryBuilder.createScreenView().set(name, forKey: kGAIScreenName).build() as NSDictionary
tracker.send(build as [NSObject : AnyObject])
}
Note: Above procedure is for iOS, Android configurations should be similar.
EDIT
I'm following this tutorial to Add Analytics to myAndroid App
but when I reach the step where I should get a a configuration file when I go to the page where I should download my JSON file it just gives me the spinning downloading circle for a long long time and I can't get the file.
I'm logged in with my Google account.
Is there any other way to get the file?
It turned out that it's a common issue
check out this issue in analytics-issues group here.
To solve this problem I followed those steps
Go here and sign in with your account.
Create a project.
Give your project a name.
In Use Google APIs click Enable and manage APIs.
From Advertising APIs click Analytics API.
Click Enable API.
if it shows this warning Click "Go to Credentials" if not skip to Finally
This API is enabled, but you can't use it in your project until you
create credentials. Click "Go to Credentials" to do this now
(strongly recommended).
From the list Where will you be calling the API from? select the platform. In my case was Android.
Click find out what Credentials I need and see it
Click Cancel.
Then you will be prompted to create Credentials you need. Create them.
Finally:
Now go to this Link which in the tutorial to get your JSON file
Pick a platform.
Create or choose an app.
Choose service and configure.
Choose or create an account from the dropdown list
Choose Analytics property
Click Enable Analytics services .
If you don't see the big blue button Generate configuration file scroll down to see it.
Hit it.
Hit Download google-services.json and voila
You got it.
I have two Google Analytics accounts A and B, each with their own properties which I am attempting to generate configuration files for (more specifically, google-services.json files) in order to use Google Analytics with my Android app. I'm using the Enable Google Services for your app wizard.
When you reach the Choose and configure services step, it should allow you to choose both a Google Analytics account and an Analytics Property from their associated selection boxes every time you run this wizard. The problem is that the selection box for choosing a Google Analytics Account only appears on the first run of this wizard, and afterwards becomes a pre-filled field that cannot be modified.
This means that if I generate a configuration file for a Property using Account A, I cannot generate another configuration file for a Property using Account B since the wizard pre-fills a non-modifiable text box with Account A, and only Account A's Properties appear in the next selection box.
How can I generate a google-services.json configuration file for a Property under a Google Analytics Account I cannot switch to?
I have admin access to both of these accounts, so this is not an issue.
The configuration file is necessary for Google Analytics to work once the app is released to the public (as described here).
Similar unsolved questions have been asked here for Android and here for iOS (both platforms use the same wizard to enable the Google Analytics service).
Managed to figure out a very simple workaround to solve my own question: remove yourself from the account you're stuck on, so the wizard is then forced to let you choose another account.
To achieve this:
Log into Google Analytics and choose the Admin tab.
In the ACCOUNT column, from the drop-down box, choose the account you were bound to (in the Enable Google Services wizard).
In the same column, choose User management.
Click the Remove myself from this account button.
Then go back to the Enable Google Services wizard again and you should now be able to select another account.
I hope this helps others at least until Google fixes the site, as this was a rather annoying problem to solve!
I figure out the solution for this issue is that we can move the account to trash. After we create an config file, restore the account.
Hope this may help
On this page Google staff gave an answer to this bug:
This is currently working as intended even though it may not seem so. There may be an update to fix this but in the meantime you can just copy an existing Configuration file and edit it. The only thing you need to change is the Analytics tracking ID value.
For example, in the configuration JOSN file you'll see an entry like:
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": "UA-XXXXX-YY"
}
},
Replace the UA-XXXXX-YY value with the property ID (for the GA
Account) you want to use. You can use the Account Explorer to find the
correct property ID:
https://ga-dev-tools.appspot.com/account-explorer/
Note that Tracking ID and Property ID mean the same thing.
I am developing an Android app and I'd like to start testing out push notifications. From a code perspective, I'm all set. My current challenge is that I simply do not know how to get a Google Cloud Messaging API key from Google.
There are loads and loads of tutorials and videos online showing how this can be done in about 10 seconds but Google has recently updated it's developer center and none of the tutorials seem to apply any more. The current process seems very cumbersome and not at all similar to what I've seen online.
I realize that this barely passes as a programming question (if at all) but there is no way that I'm going to even begin to be able to develop anything without an API key from Google.
Is someone able to point me in the right direction?
CommonsWare was right about three years ago (2013). This is a revision to his answer.
Note: Even if you have already enabled any services and have API keys this will still work.
Log in to Google Services with your google account. (This is not the same as the Google Console)
Click on Pick a Platform
Click on Enable services for Android
Fill out the app name and package name
Select Cloud Messaging. (Or any other service you want. You can come back to this later and add more)
Click on Generate Configuration Files
Boom. Right there on top in the Cloud Messaging card under Server API key
Also, you will want to download the google-services.json file and copy it to the app/ or mobile/ module directory in your Android project
but Google has recently updated it's developer center and none of the tutorials seem to apply any more
:: sigh ::
That's yet more work for my next book update...
The current process seems very cumbersome and not at all similar to what I've seen online.
Bearing in mind that I am already set up with keys, and therefore may be seeing somewhat different stuff than would somebody with no keys:
Step #1: Log into https://cloud.google.com/console with your Google account
Step #2: In the navigation on the left, go into "APIs & auth > APIs"
Step #3: Find "Google Cloud Messaging for Android" and click the "OFF" button next to it (note: this might involve then agreeing to additional terms of service)
Step #4: In the navigation on the left, go into "APIs & auth > Registered apps"
Step #5: Wait a really long time, apparently.
Step #6: Click the red REGISTER APP button.
Step #7: Give the app a name and choose Web Application, then click Register
Step #8: Click the "Server Key" section for your server key
Google has updated their api console recently to Google Cloud Console.
In short terms , you need to create an Android application and pick Accessing APIs via a web server. this service has a detailed guide for that
The easiest way to configure GCM API key and Sender ID, is to Google login with your account and continue the Wizard : https://developers.google.com/mobile/add :)
To get FCM (Firebase cloud messaging) key for a web app
login into Firebase
Create a new app by clicking the big 'Add Project' button
Wait a few seconds and watch the circle chase its tail
Click "Add Firebase to your web app "
Copy the api key
I have created Android client id for expense.loremipsum.tracker for my app. Actually I have created 2 id, one for by Eclipse keystore and one is for my signed key store. My application is live so I can not change package.
I have tried by deleting project and recreating project but couldn't work. Now I am not able to create client id for expense.loremipsum.tracker.
I refereed this question. Should I contact Google? Now from any project I am getting this error This client ID is globally unique and is already in use
My application is live and not working Google Plus client.
Edit
Right now I have not any Android client id regarding this expense.loremipsum.tracker and I am still not able to create single one for this.
Try going here to see if you have old projects:
https://cloud.google.com/console#/project
What ended up resolving this for me is what Ketan suggested. You need to go here:
https://code.google.com/apis/console/
Then click the drop down menu in the top left underneath your name (if you don't have any, create a basic project, then go to the dropdown menu). From there, you can see in Ketan's screenshot that there is an undelete. Undelete your project.
Once undeleted, go to the 'API Access' section. If you have anything under 'Client ID for installed applications', click delete of this on the right. Then you can delete this project again.
Once that was done, I was able to recreate my game services OAuth 2.0 in the Google Play Game Services page at the regular Google Play publish page:
https://play.google.com/apps/publish/
No need to contact Google.
If you delete project it doesn't mean you delete client id.
You have to delete client id because it's unique.
If you have deleted project then Go to undelete>(your project) and delete client id
Go to the https://console.developers.google.com/project
select a deleted project then in the sidebar on the left, expand APIs & auth. Select credentials and click delete button to deactivate the clientID.