Google Analytics not tracking quantity in transactions - android

I've, to the best of my knowledge, successfully integrated Google Aanlytics tracking in an Android app. When viewing the results web, section Conversions - eCommerce - Transactions, the tracked transactions appear correctly, save for the item quantity, which is always zero. However, when debugging my code, the quantity stored in the transaction object is correct. I've also waited several days (about a week), in case the results would update themselves, to no avail. Is there anything "special" I should do to track the item quantity of a transaction? Could this be a bug in the Android GA SDK?
I'm attaching the code I'm using, just in case:
tracker.addTransaction(new Transaction.Builder(orderPK, totalPrice).setStoreName("").setTotalTax(totalTax).setShippingCost(shipping).build());
Item.Builder builder = new Item.Builder(orderPK, productPK, price, quantity);
builder.setItemCategory(category);
Item item = builder.build();
tracker.addItem(item);
tracker.trackTransactions();
tracker.dispatch();
tracker.clearTransactions();

Am giving a working code which has worked for me. please try this code
tracker = GoogleAnalyticsTracker.getInstance();
tracker.addTransaction(new Transaction.Builder("3000",25000).setStoreName("MarIoS").setTotalTax(3.23).setShippingCost(10.44).build());
Item.Builder builder = new Item.Builder("3000", "Mobile",5000,5);
builder.setItemCategory("Electronics");
builder.setItemName("SamsunG");
Log.d("json","In Transaction");
Item item = builder.build();
tracker.addItem(item);
tracker.trackTransactions();
tracker.dispatch();

It's been a while, but I found the problem, so I'm leaving it posted here.
It turns out there is a field of the item, the name, which is mandatory, though it's not listed anywhere as such (other than in the JS API, where I found it).
So the solution is to add the following line:
builder.setItemName(name);

Related

Firebase Search event Term not showing in analytics

I report a Search event and add the search query to the bundle.
In Firebase, only the event is shown. I can see the stat on the search event log, but I can't see the value of the Term that were searched. From what I understand, the Term param is supported by Firebase.
Here is my code:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.SEARCH_TERM, query);
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SEARCH, bundle);
What should I do to get the search term to appear in `Firebase?
You can use custom definitions to solve this problem.
Here's how
Go to firebase console
Then select the custom definition from the left panel
click on "create custom dimension" at the top right
Then enter the details as shown in this photo
After entering detail give it some time and then make a search event from your app.
now go to the events tab -> select search event -> and you will see your search term with the count in a separate card.
More info about the custom dimensions
From what I can understand from your code in the question, the code does not have any errors.
If you are implementing firebase analytics for the first time, it will take 24 hours for the events to appear in the dashboard.
After first event reported, next events takes around 3-4 hours to update in google dashboard.
Hope this info helps :)

Why searchtimeline is not showing any tweets for my hashtag using fabric

I am trying to show tweets containing a hashtag(#helpplus) that I newly created for testing but as results it shows no tweets while I try to do it with any other hashtag it shows up.
Please suggest what should I do so that hashtag created by me comes in results.
my code is:
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query("#helpplus")
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
.setTimeline(searchTimeline)
.setViewStyle(R.style.tw__TweetLightWithActionsStyle)
.build();
setListAdapter(adapter);
As I responded over on the Twitter developer forums, if a user ID or a hashtag is very new, they may not appear in the Search API results immediately because the search index is not complete and there are measures to keep low quality results from appearing. It is likely that your Tweets were not indexed at the time that you tried this code. As of now, there are a few results in the search API that match, so it should work.
Also note that there is a 7-day limit on the search index, so if you were searching for something that hadn't been Tweeted about within that period of time, then your timeline would be empty even though you may see results in a search on Twitter.com

How do I set multiple notifications using one date selection?

I need to set multiple notifications at the same time based on a list of mutiple choice questions. I will figure the radio buttons and if statements out later, for now I'm just setting the dates randomly for testing purposes.
If the user selects jan 1st and clicks a button. It will set a notification in the future with a reminder to do an activity. It also saves this information so the user can edit the details if he desires or change a few options.
This part I already have coded and it works just fine. however, It only sets a single notification currently. It is a pretty involved code consisting database, receivers, fragments, etc. that all talk to each other.
As I said, this part I have working just fine but I am not including all the code because it is seriously involved and no one would try to break it down if i drown you in a sea of code. I can certainly post specific code if someone request it.
My issue is that I need it to set a good amount of notifications at various future dates upon the button click, not just one. I need to change the notification message to a preset variable string for each additional notification event but some things like title will remain the same.
my current working code executes like this....
User Selects Jan 1 > User Clicks Button > Notification set for Feb 14 with a unique title and message set by the user and saved for future editing...
At the same time the notifications are set they are saved so the user can change the date and a few options if needed. I want only one title and a single date saved. I have the save feature already working but I need to know how to link the additional reminders to the existing saved item. Im trying to make all the data linked so that if the user deletes the saved item, all the set notifications for that file are deleted and not just the one that falls on the user selected date.
===== This is what I am trying to pull off
User Picks Some Options and Clicks A Button [I have this working already]
Upon Click of said button, the following notifications are all set in the future :
[currently it sets this notification only]
Jan 1 notification :
(title)Day Master App
(message)Happy New Year
[Im trying to figure out how to add the following notifications upon the above button click and also save this information to the existing db under the same item]
Feb 14 notification : (title)Day Master App - (message)Its V Day
March 1 notification : (title)Day Master App - (message)Spring Is Near
March 14 notification : (title)Day Master App - (message)Its probably raining
(((and we'll just pretend i finished the list...)))
I cant make the future notifications a static number because when the future notifications are set is determined by a bunch of radio button choices before the user clicks the execute button. This is going to be a pretty complex and hacky if/else novel the way I think I have to do it. Am I correct?
I have a display/edit listview that shows your saved notifications and the unique name and date the user set. This works fine currently but only sets a single notification based on user input.
I need to add some more notifications but i dont need to save them under a different item or name. I want them all under the same save item so all the notifications that were set when the button was clicked can be added and deleted as a group. There will be no option to delete certain notifications that were set. It will be all or none.
I would imagine I could just add some more variables into the existing "save notification" code? As in piggyback some more items (like all the dates and messages) for the additional notifications? do i need to write a new function for each future notification I set in order to be able to delete it?
do I need to create a new db for each additional notification that is set? A separate Adapter? Im so confused...
===
Im not looking for a code example exactly, I want to know how this would be implemented into an existing code. I realize there is probably 100 ways to code what I have described. I just need the process explained.
Please explain this to me slowly. I know im way overthinking this.
I tried to explain this as best I could, if you need clarification on something please ask. Thank You.
I have solved my problem although I could not accomplish exactly what I was trying to originally.
I managed to set the multiple notifications on a single click with different dates by simply copying the same code I used to display the single notification and simply giving each additional notification a unique ID and creating a new variables to give them individual text, future dates, separate times, etc. These variables can be easily set programmaticly or by the user when you set them up.
// On clicking the set notifications button
public void SetNotificationsButton(View v){
ReminderDatabase rb = new ReminderDatabase(this);
// Creating Original Reminder
int ID = rb.addReminder(new Reminder(mTitle,
mDate, mTime, mRepeat, mRepeatNo, mRepeatType, mActive));
// Create Feeding Notification
int FeedingID = rb.addReminder(new Reminder("Have you fed the cat today?",
mFeedingDate, mFeedingTime, mRepeat, mRepeatNo, mRepeatType, mActive));
}
//
// and just continued copy and pasting the rest of the notification events
// changing the ID for each individual notification. Without a unique ID
// the current notification will override the previous notification and
// appear to only set the last reminder.
I was not able to remove all notifications by selecting a single list item, I probably could have figured this out by grouping the notifications into a separate variable but once I realized that you can only have a maximum of 50 notifications set at any given time it seemed like overkill.
Since I have a repeat option for certain notifications I can keep my notifications set; numbers low and stay away from the 50 at a time limit while still firing a reminder to the user every day.
I found a great example for setting single notifications I used as reference.
https://github.com/blanyal/Remindly
Thank those of you who took the time to read my question.

Possible to query against the count of an included key?

I have an application where I need to return the first user found that meets certain criteria, some of that criteria is having a certain number of objects stored.
For example, let's say I want to return the first store I can find that has at-least 3 employees with atleast two children. I know, what an odd-ball example. So I would have a query something like this:
PFUser.query()?
.whereKey("objectId", notEqualTo: PFUser.currentUser()?.objectId!)
.includeKey("stores.employees.children")
// .whereCountForkey("stores.employees", greaterThan: 2)
// .whereCountForKey("stores.employees.children", greaterThan: 1)
.getFirstObject();
Notice the commented out lines, I'm trying to find a way to do soemthing like this in a single query. I'm using parse, which I believe uses MongoDB on the back end, but I don't believe you can execute custom database queries..?
This is a mobile application for both iOS and Android, although the code shown is in SWIFT I have two variations of the project. Examples in either swift, obj-C, Java, or C# will be fine.
Also more than happy with Cloud-code solutions.
There is an example in the documentation
var Team = Parse.Object.extend("Team");
var teamQuery = new Parse.Query(Team);
teamQuery.greaterThan("winPct", 0.5);
var userQuery = new Parse.Query(Parse.User);
userQuery.matchesKeyInQuery("hometown", "city", teamQuery);
userQuery.find({
success: function(results) {
// results has the list of users with a hometown team with a winning record
}
});

Google in app purchasing get products list

I found the following code from here to get products list from google play store
ArrayList skuList = new ArrayList();
skuList.add("premiumUpgrade");
skuList.add("gas");
Bundle querySkus = new Bundle();
querySkus.putStringArrayList(“ITEM_ID_LIST”, skuList);
is there a way to get dynamic products list? here its hard coded.what happens when i add new products after app launch?
This is not currently possible using Google API.
Create a JSON file that contains current SKUs and place it on some server.
In your app, first load this file from server URL and then use this list of SKUs to retrieve product details via Google API.
To Google: Provide function for this, SHAME ON YOU!
If you don't want to implement the logic to acquire the product list from your own server, another option would be to use pre-defined "dummy" product ids, like product id slots:
private static final String[] PRODUCTIDS = {"product1", "product2", "product3", etc. };
The getSkuDetails function will simply return null for non-existing product ids. So if you don't expect your product list to vary too often or too much, then you could just define a small number of product ids in your app, and skip null values returned by getSkuDetails.
If you want to add a new product, just use the id defined by the next unused slot in the developer console, and your app will list it without updating the app.
Deleting a product can be tricky, because inactive and deleted product ids will still be returned, so you could mark a product deleted using its description field - use a pre-defined constant, like "NOT AVAILABLE" and check for its presence in your app. If a product description equals to this constant, simply skip it and don't list it.
I know, I know. It's a dirty hack. But it works.
It is not possible for a reason. If you were able to fetch the updated inapp product list how would you be able to serve those new products without changing the app code? If you change the product list then you have to release an update for the app that deals with the new products.
The only reason to fetch new products without changing the app code would be to change prices for the products themselves but that would mean going against the Google terms & conditions
This is now possible using the Inappproducts: list API:
List all the in-app products for an Android app, both subscriptions and managed in-app products.
Also, read about Authorization which is needed for making use of above API.
One way you can do this is to create a copy of all your product IDs in a database (like Firebase DB), query these IDs in your app and add them to a String list. Then finally pass this list to the SkuDetailsParams setSkusList() method:
SkuDetailsParams params = SkuDetailsParams.newBuilder()
.setType(INAPP)
.setSkusList(skuList) //pass the list there
.build();
I guess, the simplest way is to use Firebase Remote Config, where skuList will be updated automatically once published to all devices.
Check Remote Config for implementation:
https://firebase.google.com/docs/remote-config/use-cases

Categories

Resources