i want to track some values in Google Analytics that are UPDATED not ADDED to the analytics data.
For example, if i want to track what is the average high score among all my users to be able to fine tune the scoring system.
I can add new value of high score every time the game exits, but it will be incremental, the old data from the same user won't be overwritten. So i won't get proper average values.
Is there a way to overwrite the old data in GA?
NOTE:
After filtering based on last update date - this could be used to figure out why your users uninstalled the app and many other things.
Possible workaround to long for a comment no idea if this will work or not:
First I don't know the Android GA side of things but I do have a lot of expense with GA development in general.
When tracking Ecommerce data the only way to remove a transaction is to add a new transaction value of negative the amount you want to remove. This might work in your situation as well, but I wonder if the users will see the negative value when you display them there scores.
Example:
User score : 100 ( the original score)
delete score: -100 ( removing it)
user score: 40 ( re-add the new score)
This will technically mean that there are 3 lines for the user score but when added up by the system they should = the new score.
Again this is how its done in Ecommerce, if this works for you with this I would love to know for future reference I don't think you will be the only one trying to do this.
The concept behind DalmTo's answer is fine, except I would use either event tracking or custom dimensions/metrics. Try the following:
User99 finished their first game with a high score of 125. Send an event with the following structure:
Event Category: User High Score
Event Action: User99
Event Label: (none)
Event Value: 125
When the user plays again and attains a score of 139, send another event with the difference
Event Category: User High Score
Event Action: User99
Event Label: (none)
Event Value: 14
With that data in GA, looking at the events report under the User High Score category will give you a breakdown per user (the Event Action), with the Event Value being the high score for that user.
If you need non-integer values for the high score, then use a custom metric instead.
Depending on your reporting needs, it might be just as easy to define a custom dimension for User ID and a custom metric for High Score and then send a pageview to /game-finished when the game is finished, with those 2 values set accordingly.
Related
i've logged a firebase event using the code below in android (a long time ago).
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
Bundle params = new Bundle();
params.putString(FirebaseAnalytics.Param.VALUE, String.valueOf(subjectvalue));
params.putString(FirebaseAnalytics.Param.CURRENCY, "IRR");
mFirebaseAnalytics.logEvent("Calculate_Cost_of_Hearing", params);
as you can see in this image the events are being logged and sent to firebase and shown separately but the value indicator still shows zero.
should i change my code in order to make it show the values or should i play with the options ? and my ultimate goal is to know the average values not just the SUM.
I am pretty sure that Value displays 0 because the parameter is bundled as a String. If you use params.putDouble() or putLong() instead of putString() the value should accumulate in the Firebase console.
You will not be able to display the average value per user in the event view since it shows only the accumulated value. If you want to work with the data you will have to connect your Firebase instance to BigQuery, pretty much.
Perhaps you could get the Value included in the "revenue per user" - metric on the Dashboard if you make the event count as revenue, but I have no experience doing that.
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.
I have an android app that is essentially a list of timers. Each timer can have the following fields:
title (string, can be up to 255 characters)
id (integer)
seconds (integer)
time_started (integer)
seconds_left (integer)
running (boolean)
order (integer)
There can be an unlimited number of these timers, though for the pebble watch app, it'd be ok if I only send the first n (10, 15, 20).
Currently I've been sending the items to the watch one at a time, and creating the PebbleDictionary like this:
private PebbleDictionary buildTimerDictionary(Timer timer) {
PebbleDictionary data = new PebbleDictionary();
data.addUint32(C.KEY_ID, timer.getId());
data.addUint32(C.KEY_SECONDS, (int)timer.getSeconds());
data.addString(C.KEY_DESCRIPTION, timer.getDescriptionFormatted());
data.addUint32(C.KEY_TIME_STARTED, (int)timer.getTimeStarted());
data.addUint32(C.KEY_TIME_LEFT, (int)timer.getSecondsLeft());
data.addUint8(C.KEY_RUNNING, (byte)(timer.isRunning() ? 1 : 0));
data.addUint32(C.KEY_ORDER, (int)timer.getOrder());
data.addString(C.KEY_TIME_DISPLAY, timer.getSecondsFormatted());
return data;
}
And sending it via a queue that sends the next PebbleDictionary to the watch after the previous is acked.
This works, but it's pretty slow. I feel like I could save a lot of time by packing more than one timer into each message. However, I'm not sure how to do that, considering the inbox size on the pebble watch itself, and the fact that you have to hard define the keys for the dictionary in appinfo.json (it doesn't seem like you can use arbitrary keys).
How is this sort of thing usually done?
There are two ways to do this:
One message for each item (what you are doing now)
Multiple items per message.
In this case you can pack everything into one value by using byte arrays and concatenating all your fields into the byte array.
You can then use the key to send the index of the element in the list.
A few comments:
Defining the keys in appinfo.json is optional and only useful if you are using PebbleKit JavaScript. It has absolutely no use for apps that talk with PebbleKit Android.
You can query the available buffer size on Pebble with app_message_inbox_size_maximum(). Get it when you start your app and send it from Pebble to the Android app.
The best strategy depends on the average size of your messages. Right now your items will be about 25bytes + the strings + the small overhead of a dictionary (7 bytes + 1 byte per key). If the strings are very small you might fit three items per messages, if the description is very long, you might not be able to send the item at all (you should probably truncate it).
I am implementing a preference activity so I can let choices to the user about what my app can and can't do and to define a user profile so I can change the way I request data.
I have one part where I need to show places to the user (restaurant, stores, etc) so I would like to be able to have a "range widget".
Let's say :
1 = poor
2 = cheap
3 = average
4 = rich
I want the user being able to say I want only store between 1 and 3 so it would need to be a widget with a double "circle" allowing the user to create a range.
Any idea of something like this existing ? (I am pretty sure I already seen something like this in the past but I can't remember where)
Take a look at RangeBar. It sounds exactly like what you need
making an android app to do a lottery prize system.
I want to randomly select winners of prizes. but each of the prizes are in different amounts. they are currently stored in a database as three columns, first is index id, auto incremented, the second is the name of the prize, and third is the number of each of these prizes.
for example the most expensive prize is a car and there will be only one of them. but the next cheaper prize will be a small 50 cc scooter, about 10 of them. and the list goes down to to a pencil and pen set where there are 800 winners for this prize.
so the chance of winning the pencil and pen set is much higher than the other prizes.
i am trying to get the idea on what is the best way to code this. i understand that random number generator and even a better one that more evenly distributes true random numbers.
what i am not clear on is the best way to go about this with the different frequency for each of the prizes.
can someone point me in the right direction for this?
Compute the sum of "number of each of these prizes".
Pick a random number between 1 and this sum.
Then order the prizes according some criteria and associate a range to each price (the only car will have the range [1;1]).
Ensure the ranges don't overlap each other. The size of each range must be equal to amount of available prices.
Find the range holding your random number and that's it.
Easiest and least error prone way => put all the prizes in an array. Each prize should be put as many times as there are prizes of the given type. Then generate a random number up to the size of the array and see what is the prize at the given index.
Note that this only considers the case when you know the given user will win a prize. Maybe you should first give a way bigger chance for the user not to win anything for instance say you have 4000 total prizes and you want a user to win a prize with 1/40 chance. So generate a random number up to 40*4000 = 160000 and if the number is not less than 4000 the user wins nothing, otherwise he wins the prize at the index corresponding to the generated value.
Random rand = new Random();
int pickedNumber = rand.nextInt(100);
if(pickednumber>99)
{
pen or pencil
}
else
{
car
}
I'm giving you example and you must me add more condition for scooter or any thing which you want to add on lottery.