Event tracking with GUID in value field - matomo

Does the value have to be numeric, I am trying to store unique Ids (strings) in the value field, but when I look at the reports only a zero (0) value is being stored.
here is example of issue:
"type": "event",
"eventCategory": "Online-Ordering-Menu",
"eventAction": "ItemAddToCart",
"eventName": "ItemId",
"eventValue": 0 -- I want this be value of the Item which is type GUID structure '4eb3f8ba-6bf2-414b-8146-b75bce6a283f'
is it possible to store that value?
After Reading through the documentation and not rushing a found the answer i was looking for

The event value has to be numeric, but you should be able to store what you want by storing the data in the eventName.
It will log an event with an event category (Videos, Music, Games…), an event action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked…), and an optional event name and optional numeric value.
from https://matomo.org/docs/event-tracking/#tracking-events

Related

Search and get information about each value in ReactJs

I have an app where i search data depending by name from the input. So, for example: if i select 'John' i get the object that contains info about John.
I want to improve the application, because now if i write 'Mike' or i select 'Mike' i get the object that contains information about Mike (in the console), but if i select the second name, EX: if i will have in the input "Mike John", i get an empty array.
I want to solve this issue plus to save all objects that contains info about each names, when i will click on the button using saveBtn function. How to solve the my issue?
link to my app: https://codesandbox.io/s/divine-frost-skle2
Here is a possible solution to your issue:
https://codesandbox.io/s/vigilant-austin-ih1o8
The main issue was that on your search function you were filtering based on a concatenated string (a result of selectedItems.join(",") and looking for it in the elements array which always returned false and resulted in an empty array.
for example
you were searching for:
"mike,john" inside:
//after JSON.stringify() and toLowerString():
{
"key": "1",
"name": "mike",
"age": 32,
"address": "10 downing street"
},
Some other things I changed in your solution was removing the unnecessary slice, and using the Array.prototype.some() method in order to find the element which matches at least one of your selectedItems
As for saving, I've alerted your search output - but you can do anything you like with it. For example, you can reset the selected items using setState([]);

How can I use expressions to reduce array of objects

I am in the process of creating a flow which, upon the trigger activating, sends a prompt to a user.
The user selects a response, and then the flow sends a message in the appropriate channel. The prompt items come from the list channels action. I can use body('ListChannels')?['value] to parse the response. The response is an array with each object looking like:
{
"id":"",
"displayName":"General",
"description":"Used to test in-development features",
"email":"",
"webUrl":""
}
I want to reduce each object to just the displayName key and use the resulting as the inputs for the next action, this is the accepted input for that action:
["General", "Channel2", "Channel3"]
Is there a way to convert this using the provided expressions/actions for power automate? I also need to use the response to lookup the corresponding array entry "id" for sending a message to that channel.
One possibility is to use looping and control statements to perform 'reduce' and 'lookup' actions:
For reduce: Initialize variable(s) (array) first and push the lookup value to the array(s):
Since the input for the next action requires options that are readable to the user we have to use the channel name.
For lookup: Loop through the original object array and compare each object channel name to your query value:
The user response is stored in selectedResponse. We can loop through each item from the original list channels response and compare this to each objects channel name. If there is a match. We can use the current items id as the argument to the "Post your own adaptive card" action.
Result:

How to store values even after the application restarts?

When creating applications with ApplescriptObjC you can create a property like this:
property myValue : "value"
However, if I change the value of this variable, it will get set back to "value" whenever the application restarts. How can I store values so they do not get reset after the application restarts?
You'll need to store your value somewhere before your application quits. Using NSUserDefaults is the best approach:
property NSUserDefaults : ((current application)'s NSUserDefaults's standardUserDefaults)
To save your value, use the following code, where myKey can be any string, and val is the value that you want to save:
NSUserDefaults's setObject:val forKey:myKey
To retrieve your value later on, you can use:
NSUserDefaults's objectForKey:myKey
By the way, NSUserDefaults has several useful functions for getting values, depending on the type of data stored. For example, if you were storing a boolean, you could use "boolForKey:".
However, you should set a default value for your key, in case it has never been saved before. This must be done before trying to retrieve the value for your key, where defVal is the default value:
NSUserDefaults's registerDefaults:((current application)'s NSDictionary's dictionaryWithObject:defVal forKey:myKey)
If you'd like to know more about NSUserDefaults, you can read about it here: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/

How best to store a number in google realtime model, and get atomic change events?

Sounds pretty simple, however...
This number holds an enumerated type, and should be a field within a custom realtime object. Here's its declaration in the custom object registration routine:
MyRTObjectType.prototype.myEnumeratedType =
gapi.drive.realtime.custom.collaborativeField('myEnumeratedType');
I can store it in the model as a simple javascript number, and initialize it like this:
function initializeMyRTObjectType() {
// other fields here
this.myEnumeratedType = 0;
}
...but the following doesn't work, of course, since it's just a number:
myRTObject.myEnumeratedType.addEventListener(
gapi.drive.realtime.EventType.OBJECT_CHANGED, self.onTypeChanged);
I can add the event listener to the whole object:
myRTObject.addEventListener(
gapi.drive.realtime.EventType.OBJECT_CHANGED, self.onTypeChanged);
But I'm only interested in changes to that number (and if I were interested in other changes, I wouldn't want to examine every field to see what's changed).
So let's say I store it as a realtime string, initializing it like this:
function initializeMyRTObjectType() {
var model = gapi.drive.realtime.custom.getModel(this);
// other fields here
this.myEnumeratedType = model.createString();
}
Now I'll get my change events, but they won't necessarily be atomic, and I can't know whether a change, say from "100" to "1001", is merely a change enroute to "101", and so whether I should react to it (this exact example may not be valid, but the idea is there...)
So the question is, is there either a way to know that all (compounded?) changes, insertions/deletions are complete on a string field, or (better) a different recommended way to store a number, and get atomic notification when it has been changed?
You also get a VALUE_CHANGED event on the containing object like you would for a map:
myRTObject.addEventListener(gapi.drive.realtime.EventType.VALUE_CHANGED,
function(event) {
if (event.property === 'myEnumeratedType') {
// business logic
}
});

In Meteor Collections, use an array-field or another collection?

The question
In short, my question is: when an array in a document is changed, will the users receive the new array, or just the changes?
If that question is unclear, I've described my problem below.
The problem
I have a collection whose documents contain an array field two users will push values to. A document in this collection kind of looks like this:
var document = {
userId1: "...user id...", // The id of the first of the two users.
userId2: "...user id...", // The id of the second of the two users.
data: [] // The field the two users will push values to.
}
data will from the beginning be empty, and the users will then take turns pushing values to it.
When one of the user pushes some value to data, the server will send the changes to the second user. Will the second user receive the entire data-array, or just the changes (the pushed value)? I'm a little bit worried that the second user will receive the entire data-array, even though it's just a single value that's been pushed to it, and if data contains many values, I fear this will become a bottleneck.
Is this the case? If it is, using another collection for storing the values will solve it, right? Something like this:
var document = {
id: "...unique id...",
userId1: "...user id...", // The id of the first of the two users.
userId2: "...user id..." // The id of the second of the two users.
}
var documentData = {
idReference: "...the unique id in the document above...",
value: "...a value..."
}
Instead of pushing the values into an array in document, insert them into a collection containing documentData. This (I know) won't have the downside I fear the first solution has (but I rather use the first solution if it doesn't have the downside).
As per https://github.com/meteor/meteor/blob/master/packages/livedata/DDP.md
changed (server -> client):
collection: string (collection name)
id: string (document ID)
fields: optional object with EJSON values
cleared: optional array of strings (field names to delete)
Users will receive the new array. To only send "diffs," use a collection of {userId: userId, value: value} documents.
I inspected what was sent as commented by user728291, and it seems like the entire array-field is sent, and not just the pushed value. I don't know if this always is the case (I just tested with an array containing few and small values; if it contains many or big values Meteor maybe try to do some optimization I couldn't see in my tiny test), but I'll go with the solution using another collection instead of the array-field.

Resources