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.
Related
If I install the app when clicking the dynamic link. All of that information from dynamic should be still available when I open the app for the first time.How can I get that information? It is not working when I use this: getInitialLink() returns Promise<string|null>;
Since, you haven't mentioned - I'm assuming you are having problems with shorter urls, if that's the case try putting the longer url.
Or refer here on Simon's answer: When I use the long instead of short links, everything works perfectly fine.
On Android, you use the getInvitation() method to get data from the Dynamic Link:
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false).setResultCallback
(/* ... */);
Then, in the callback, you can get the data passed in the Dynamic Links link parameter by calling the getDeepLink() method:
Firebase Documentation - Use Case
For future reference or detailed answer on Firebase Dynamic Links
Behave just like normal Links
In cases where the application doesn’t require installation (say, if it’s already installed) then clicking the Dynamic Link will automatically open the link to the desired screen.
Dynamic Links have a very simple process flow:
The user begins by clicking the Dynamic Link
If the the needs of the Dynamic Link target are satisfied (this is, the application being installed) then the user is navigated to the target location
Otherwise, if the application requires install in order to navigate
to the Dynamic Link target, the the user is taken to the point of
install for the application. Once the application has been installed,
the user is navigated to the target location of the Dynamic Link
And if that wasn’t all, we can integrate Dynamic Links with Firebase Analytics to track the interaction with any links that we generate for our applications. But if we only require simple tracking, then we can use the automatic built-in analytics from the Dynamic Links panel within the Firebase Console where we can also obtain attribution and referrer information for interacted links with no extra effort required from our side.
What makes it different from Google Analytics?
One of the first things that came to my mind when I read about Firebase Analytics was, “What about my Google Analytics setup?”. So if you already have Google Analytics in place, then why would you make the switch to Firebase Analytics? Well, here’s a couple of differences between the two:
Audiences
We can use Firebase Analytics to create Audiences — these are groups of users that we can then interact with using other Firebase service such as Firebase Notifications and / or Firebase Remote Config.
Integration with other Firebase Services
An awesome thing with Firebase Analytics is that we can integrate other Firebase services with analytics. For example, creating an Audience of users who have experienced a crash reported through Firebase Crash Reporting.
Lower Method Count
The Google Analytics dependency on Android has a total count of 18,607 methods and has a total of 4kb used for dependancies. On the other hand, Firebase Core (for Analytics) has a method count of 15,130 and only 1kb used for dependancies.
Automatic Tracking
When we add the firebase core dependency, it will automatically begin tracking a collection of user engagement events and device information for us — this is useful if you’re looking to only collect the minimal data for your app.
Unlimited Reporting
For up to 500 events, Firebase Analytics provides us with unlimited reporting straight out of the box for free!
No Singleton Initialisation
When setting up Google Analytics on Android we are required to initialize a Singleton instance. Firebase Analytics are simply available by fetching the instance directly from where we wish to track data. This isn’t much effort obviously but just makes the setup flow slightly easier.
Single Console
All of the data for every Firebase service is available for a single console. That makes it both easier and quicker for us to navigate from checking the analytic stats for our app to viewing the latest crash reports.
It looks like this is a react-native-firebase open bug for android
For fix the only thing that is required to be changed in module code:
private boolean isInvitation(PendingDynamicLinkData pendingDynamicLinkData) {
return FirebaseAppInvite.getInvitation(pendingDynamicLinkData) != null;
}
to
private boolean isInvitation(PendingDynamicLinkData pendingDynamicLinkData) {
FirebaseAppInvite invite = FirebaseAppInvite.getInvitation(pendingDynamicLinkData);
if (invite != null && invite.getInvitationId() != null && !invite.getInvitationId().isEmpty()) {
return true;
}
return false;
}
Bug reference : https://github.com/invertase/react-native-firebase/issues/1273
Please Check Your Manifest file
open AndroidManifest.file => In your activity tag there is intent-filter tag put below line in that tag.
<data android:scheme="https" android:host="your.dynamic.link" />
<data android:scheme="http" android:host="your.dynamic.link" />
If already done then check this link for the full blog on the dynamic link with react native.
Link: http://blog.logicwind.com/react-native-dynamic-links-using-firebase/
I hope this will help. sorry for the typos.
I have a Android project and plan to send data to Google Analytics.
I would like to use EasyTracker and send activity start and stop info. I found just a function like this:
EasyTracker.getInstance(this).activityStart(this);
It works, but in Google Analytics report the package name and I want set custom tag for this.
Can I do this? How?
I am implementing GTM in Android project which will not use GoogleAnalytics SDK or Adword SDK,but I want data in Google Analytics and Adword.
In order to achieve this,
I have implemented Google Anaytics tag in GTM,Added Rule {Always},
Screen Name data is being sent to GTM which is reflected in Analytics,This is tested and working properly
I need InstallReferrals for Application which also should manage through GTM.
To achieve this,
Added a tag in GTM for Adword with the type Adword Remarketing,
Added ConversionId and label from Adword.
Added tagmanager.InstallReferralService and tagmanager.InstallReferralReceiver to Android manifest.xml.
According to source code of InstallReferralService it passes data to CampaignTrackingService of Analytics,which should upload data to Adword and Google Analytics.
But I am unable to get any data.
Please correct me if I am doing anything wrong in this process.
I also need Adword Conversion Tracking to be used through GTM without Adword SDK.
Not sure how to achieve this.
I'm trying to use Google Tag Manager to report screenviews and events to Google Analytics. I followed the google's tutorial but I'm not able to even report the screenviews.
Also spent hours searching in google but there was no match. Almost all the information available is for Android's v3 or the old GTM web interface.
This is my configuration
Pushing the event to the data layer throws no error. However screenName seems not been sent.
Java code
public static void pushScreenViewEvent(#NonNull Context context, #NonNull String screenName) {
DataLayer dataLayer = TagManager.getInstance(context).getDataLayer();
dataLayer.pushEvent("screenView",
DataLayer.mapOf("screenName", screenName));
}
Debug log after push data
02-23 19:12:39.376 31787-31888/com.example.debug V/GoogleTagManager﹕ Sending hit to service PATH: https: PARAMS: sr=1080x1776, a=558676027, v=1, ht=1424686354314, an=Example app, ul=ja-jp, t=appview, _u=.L, tid=UA-XXXXXX-1, cid=XXXXXX, aid=com.example.debug, av=1.0.0,
Google Play Services version
compile 'com.google.android.gms:play-services-base:6.5.87'
There's this tutorial but it is for the old GTM v3 with the old GTM web screenshots
https://developers.google.com/tag-manager/android/v3/ua#screenviews
Ok, it was my fault.
There was two problems.
Fields to set were wrong
In order to track the screen in GA it's necessary to set the Screen Name's Measurement protocol parameter &cd
In my case Client Id and User Id are also necessary, that's why I send &ci and &uid
I was using a default binary container from a different test account. After use the correct container it worked like a charm.
It seems like firing rule is incorrect.
Try something like {{event}} equals screenView or Always as firing rule.
And it will take 24hrs to update in the Google Analytics dashboard, so it will not appear in the real time. Let me know if it doesn't work.
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);