I am trying to integrate Firebase RemoteConfig and Analytics with my Android application. Remote configuration part is working but Analytics part is not working. Here is my build.gradle
// Firebase configuration
compile group:'com.google.firebase', name:'firebase-core', version: '9.4.0'
compile group:'com.google.firebase', name:'firebase-config', version: '9.4.0'
// Firebase analytics
compile 'com.google.android.gms:play-services-analytics:9.4.0'
Here is my Activity code.
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(this);
firebaseAnalytics.setUserId("5107611364");
firebaseAnalytics.setUserProperty("custom_user_property", "custom_user_proerty_value");
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "SomeID");
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "SomeIDName");
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "IdType");
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
I am trying to publish customer property as well as the event but both of them are not working. I have enabled adb logging and I can see that custom event and property are published. These do not appear on the Firebase Analytics console even after 24hrs. I don't know what is wrong.
#Rakesh - you are looking in the wrong location. You are supplying customID feilds, in your example you are supplying CONTENT_TYPE : IdType. You don't need a minimum of 10 users to see the data...if you only have 1 user that data will appear within 24 hours of that user using your app.
I will say this, initially finding your own custom IDs is not very straight forward...it took me a while to find it too.
The place to find that custom reported info is: Anaylytics - Events - once on this page, click on the actual CONTENT_TYPE you are wishing to track, in your example above, it would be idType
Then on the Content graph you will see your customIDs (ie: someID)...click on someID. In my case (and in my screenshots) my equivelant someIDs are "field, button & select"
and then you will see all the data related to the values (someIDName) you passed into someID.
Now, if idType is not appearing for you then that may because Firebase isn't allowing you to create your own CONTENT_TYPE, I am not certain if you can do that as I have not tried...and in that case you would need to use a predefined CONTENT_TYPE. I am not using a custom idType, I am using CONTENT_TYPE : select_content.
Related
In this manual Get started with Google Analytics there is a section "Start logging events":
Java code
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Kotlin code:
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM) {
param(FirebaseAnalytics.Param.ITEM_ID, id)
param(FirebaseAnalytics.Param.ITEM_NAME, name)
param(FirebaseAnalytics.Param.CONTENT_TYPE, "image")
}
Questions:
Confusing between FirebaseAnalytics.Event.SELECT_CONTENT in Java the code and FirebaseAnalytics.Event.SELECT_ITEM in the Kotlin code.. The both parameters are different (SELECT_CONTENT vs SELECT_ITEM). Webpage about events: https://firebase.google.com/docs/analytics/events is Service Unavailable.
When I go to the: Firebase -> Analytics -> Events -> select_content: there is: Events in last 30 minutes. I cannot list of all events. I don't see the values of selected event.. I don't see all the select_content events includes values.
I tried to create custom dimension in Custom definitions, I waited 24 hours and I still don't know where to see the event.
Do you know, how to show all Events with values reported by FirebaseAnalytics.Event.SELECT_CONTENT ? Like in old Firebase before update? This is image of the old Firebase select_content:
The new Firebase logging events is not clear at all to me.
Similar post with unaswered good question:
Do you mean that you can get report for some type of select_content event by item_id? Did you try this?
I'm trying to get deferred deep links working on Android. I added a test device in the dashboard & reset the device data and made sure the app is uninstalled. When I click a branch.io link, it takes me to the play store as expected. I then launch the app from Android Studio onto the phone, then the logs say that Branch SDK sent a request to https://api2.branch.io/v1/install, but the problem is the response doesn't contain the original link, query params, or key value pairs I set in the dashboard. This is the JSONObject I'm receiving in onInitFinished:
{"+match_guaranteed":true,"link_click_id":"976953359423305632","+clicked_branch_link":true,"+click_timestamp":1634196720,"+is_first_session":true,"utm_source":"test-referrer"}
Where is all the other information? This doesn't include the original link, the key-value pairs, tags, etc.
For a comparison, this is what I receive in the iOS app:
["$ios_passive_deepview": "branch_passive_default", "source": "test-referrer", "+is_first_session": 1, "~channel": test-referrer, "$matching_ttl_s": 7200, "~id": 976763609660742721, "~creation_source": 1, "$one_time_use": 0, "~marketing": 1, "~referring_link": "https://myapp.test-app.link/test-referrer", "~feature": "test", "+click_timestamp": 1634249299, "+match_guaranteed": 0, "$og_description": "My app description", "$og_title": "MyApp", "+clicked_branch_link": 1, "$marketing_title": "Test Referral Link", "~tags": ["test-referrer"], "~campaign": "test"]
If I rotate the phone to recreate the Activity or reopen the app a single time, it then sends a request to https://api2.branch.io/v1/open and returns all the info I expected initially. How do I get the information after installing the app?
I'm currently testing with myapp.test-app.link, and I call Branch.enableTestMode() before Branch.getAutoInstance(this) in my custom Application class's onCreate(). I also tried with a live link and got the same result.
These are the libraries I'm using in build.grade:
implementation 'io.branch.sdk.android:library:5.0.13'
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.1.0'
implementation 'androidx.browser:browser:1.3.0'
I've also set up app links and the uri scheme in the dashboard as well as in the app. Using getFirstReferringParams() and getLatestReferringParams() on the first session after installing doesn't help either.
UPDATE:
Repeating the exact same testing process I described above, now the JSONObject that gets passed into onInitFinished has even less information and is claiming that I'm not clicking a branch link:
{"+clicked_branch_link":false,"+is_first_session":true}
And getFirstReferringParams() returns an empty json object.
I'm about to start looking for an alternative at this rate.
I fixed this issue by adding intent.putExtra("branch_force_new_session", true); right after this.activity.setIntent(intent); when initialising the intent. Something like this:
...
this.activity.setIntent(intent);
intent.putExtra("branch_force_new_session", true);
Branch
.sessionBuilder(this.activity)
.withCallback(branchReferralInitListener)
.reInit();
...
Look here for the branch_force_new_session reference.
The other reason for the missing data is the non-existent link alias, but it looks like it is not the case as soon as you tried with the same link in iOS.
I followed every step right in setting up tag manager + firebase:
FirebaseB, GA and Tag Manager properly set up
Install necessary nugets as stated above.
Put the JSON of the tag manager container inside assets/containers
When I tested in iOS, it went smoothly, however in Android, I kept getting this error:
Invalid macro: _gtm.loadEventEnabled
I also encounter this in the device log afterwards:
Failed to load the container. NO default container resource found with resource ID -1
refresh test, containerHolder: com.google.android.gms.tagmanager.dc#XXXXXXX
Steps to Reproduce:
1) Create a Xamarin Forms app.
2) In the Android project, install the necessary nuget packages.
3) Enable firebase and call _firebaseAnalytics.SetAnalyticsCollectionEnabled(true);.
4) Log some events
5) Create a GA and google tag manager account. Create a container (Android), then download the JSON file. Put the JSON file inside Assets/containers folder.
6) Run the application while Device logcat is running (you can check error here)
These are the packages that I used:
PackageReference Include="Xamarin.GooglePlayServices.Analytics" Version="71.1608.1"
PackageReference Include="Xamarin.GooglePlayServices.Base" Version="71.1610.1
PackageReference Include="Xamarin.GooglePlayServices.TagManager" Version="71.1604.1
PackageReference Include="Xamarin.Firebase.Analytics" Version="71.1630.1
PackageReference Include="Xamarin.Firebase.Messaging" Version="71.1740.1
Has anyone encountered this and knows how to fix this?
Welcome to SO !
Using Tag Manager in Xamarin Android , after installing Nuget Package for solution . There are follow steps for reference :
1, Create a Google Analytics account, please make sure you select a mobile account (Under New Property - you'll have to select mobile/Web).
2,Create a Google Tag Manager account - create a container, then create a tag of type Google Analytics - universal analytics. a) Put your analytics account id in the Tracking ID (should be in the form "UA-XXXXXX-X"). b) Create a macro for screen name (you can view in the screenshots 'TagManagerMacro.jpeg') c) The Rule Track Type should be App View. d) In the more settings --> basic configuration --> screen name - add the macro we defined in step b. e) In Firing rules - make sure your rule is set for always.
In your Activity, call to
var tagmanager = TagManagerClass.GetInstance(this);
var pendingResult = _tagmanager.LoadContainerPreferNonDefault("GTM-XXXXXX",
Resource.Raw.gtm_analytics);
pendingResult.SetResultCallback(new TagMnagerResultCallback(), 2, TimeUnit.Seconds);
After the callback as returned, you can fire events like this:
_tagmanager.DataLayer.PushEvent("openScreen", DataLayer.MapOf("screenName", "testScreen"));
This guide was followed by the guidelines instructed here.
Hi,
I have set up my Google Tag Manager and Google Analytics and linked them with one another. Then, I have set up a container in Google Tag Manager and added a variable called "Google Analytics Content Experiment" within the container. I created 2 types of experiment variations ( you can refer the picture).I have also set "Percentage of Users Included in Experiment" to be 50%, so that 50% users get the default config value from the json and the other 50% users get the different value.Then, I published by container and downloaded the binary file and included it in the "raw" folder of the android app.
Then in my android app, I did the following within the onCreate method:
TagManager tagManager = TagManager.getInstance(this);
// Modify the log level of the logger to print out not only
// warning and error messages, but also verbose, debug, info messages.
tagManager.setVerboseLoggingEnabled(true);
PendingResult<ContainerHolder> pending =
tagManager.loadContainerPreferNonDefault(CONTAINER_ID,
R.raw.gtm_default_container);
pending.setResultCallback(new ResultCallback<ContainerHolder>() {
#Override
public void onResult(ContainerHolder containerHolder) {
ContainerHolderSingleton.setContainerHolder(containerHolder);
Container container = containerHolder.getContainer();
if (!containerHolder.getStatus().isSuccess()) {
Log.e("CuteAnimals", "failure loading container");
//displayErrorToUser(R.string.load_error);
return;
}
}
}, 2, TimeUnit.SECONDS);
My objective is to get the values of the key "key1" as supplied by the google tag manager in the android app, so that I can drive the application accordingly. But, I cannot get the values.
Can someone kindly help me out ?
Thanks.
Ones container is loaded successfully, You should be able to load the Experiment variations data.
For Example in your case this would be
containerHolder.getContainer().getString("key1")
Based on your content Experiment variations rate you will get the values "blue", "green" on different devices..
I'm working on implementing the Facebook tracking of Purchase event in Android. I followed the guide here https://developers.facebook.com/docs/app-events/android, and made a custom Bundle to send to FB.
The problem is, on the Facebook page of events, I don't see the Value column updated for the Purchase event.
This is the code:
Bundle parameters = new Bundle();
parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, mCurrency);
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, mProductType);
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mPurchaseID);
Double valueToSum = 12.042289; //this is how the price looks like
AppEventsLogger logger = AppEventsLogger.newLogger(this);
logger.logEvent(AppEventsConstants.EVENT_NAME_PURCHASED, valueToSum, parameters);
My problem is that, the valueToSum does not sum in the Facebook Events page. It's always shown as "-".
Any ideas what I am actually doing wrong?
Much appreciated.
It takes a while for the data to update on the dashboard. Try checking it the next day or so ...