Track data for my own action dimension in Matomo (without custom dimensions plugin) - plugins

I need to track some user activity like special clicks, scrolls, and mouse drags, combined with the data I get from the website's back-end.
At first I did it using custom events and created a plugin to read them and generate the reports. But events have their own limitations (like number of archived table rows, ...) and did not fit my use case. Besides events get shown on other reports and views and I don't want to clutter them by my too many events which do not have any meaning out of my plugin's reports.
Using the custom dimensions plugin would not work for me. It is limited and I want to develop and publish my own plugin to my customers.
So I created my own action dimensions.
My plugin works well with the action dimensions I added, and can receive the data from user's activity if I use my previous custom events to send the data. But I don't know how to send my tracking data to it without using events.
I searched for it in Matomo forum, just found some similar questions beening unanswered for a long time.
So my main question is:
How I can send the data of user actions to my plugin's dimension without using events?
Also, am I on the right track? Is creating my own action dimension the correct way to do it?

Related

SAPUI5 multiple users working on one table entry

I'm currently developing an application in the SAP BTP for multiple users. In the application you have one table where all responsibilities of a specific task are written down. These responsibilities may overlap between the users, which means that for one responsibility multiple users are mentioned.
In the application the users should click on either accept or reject if they still are responsible for this task. After they have given their feedback, they can click on a save button to write everything via a batch submit to the hana db. If they are not responsible anymore their name should be removed from the tasks and they should not see this task anymore.
The problem I am facing is that currently everything is stored in one database table and if one user gives feedback to some entries while another user works on the same entries, the user who saves his entries last will override the first one.
I have tried searching for a delta insert into the database or to live update after each user input or to lock the data when another user is currently working. But none of these seem to work fine, because users would still be able to override each others entries or they may lock some entries forever.
My question therefore is, what is the usual approach to manage multiple user inputs on a single table or is using a single table a bad practise at first?
My second question would be if sapui5 supports this approach or if I can handle this in another way?
You need to do server-side validation, before the save action.
UI5 does not support this directly, you can handle it by yourself.
Because we are stateless with ui5 / data you could use the draft concept
https://experience.sap.com/fiori-design-web/draft-handling/
Or something like already said backend logic with checks before safe.

What is better: one large REST API call or many small for a Cordova/Backbone app?

This is my first Cordova/Backbone application.
I have grasped the whole deal with Models, Views, etc. somewhat, and now I have gotten to actually making proper view structure for my app.
It is a user centered app, which means that views are dynamic depending on who the user is and their status in the app.
Could you please help me to understand what is a better choice: making one (large-ish) api call to the server to get the data for all user-related app views (that would get all user info, various menus for the current user etc) and put them in one User model or make several smaller api calls that each get a fragment of the information (let's say, profile information, newsfeed information and options for two menus, so 4 ajax calls total) and keep the models separate? All the relevant views (UserProfile, SideMenu, UserProfileMenu and ActivityFeed) are rendered on user login. Some of them are available for user at all times (SideBar menu for example), some get switched out as user navigates elsewhere.
I design the server-side API myself, so I can freely choose what data is returned and when.
"it depends". If you need all the info (from 4 ajax calls) from start, it would be better to create one big api call, because callig server 4 times will last longer than one big call - 4x server ping time. you could use the big call on app start and still create the 4smaller ones to refresh data when needed.

salesforce trigger to update a visualforce page

I am fairly new to salesforce and I'm having a problem statement which I'm unable to solve.
There is a Custom object named XYZ which has the fields: username, points and Id. Now I want that whenever a particular user points gets updated I get a pop up notification in a visualforce page. I am fairly familiar with the concept of Trigger but I don't know how to use that trigger to update the visualforce page with a pop up notification.
I think you may want to rethink your approach. Triggers are completely data driven, and will perform an action on data within the database, but they aren't going to give you any kind of interaction on the front end save for error messaging.
Your details are a little sketchy, but for the pop-up you probably want to use a Javascript alert, or maybe even some kind of modal window.
If you give more details about the process you're trying to achieve it might be a little easier to give you a more solid response.
Finally, I ended up changing my approach and creating a PushTopic for the update. And subscribed to this PushTopic using cometd javascript library.

How to programmatically create a new version of a CQ5 page?

Is it possible to programmatically create a new version of a CQ5 page that has a start time some time in the future?
As an example, let's say we have a page that displays tax rates. We have a component that allows the author to upload a new rates table (in the form of a css file) and it creates the rates page content. We would like to allow the author to upload rates that will be effective the first of next month.
I know the jcr supports multiple versions of nodes, but its unclear how (or whether) this relates to cq5 page versioning. And, further, whether a new version can be activated in the future.
Given the requirements as you've described them, I would probably accomplish the task in a slightly different way...
Instead of storing my rates table information directly within the page's jcr:content node (or a sub node their of) I'd probably abstract it out to somewhere else in the repository. You could then, if you so desired, create some sort of an admin interface to allow content authors to upload their csv file of new rates, and ingest that into the repository as needed. Alternatively, assuming that data comes from some sort of a database, you could probably just write a job to automatically injest it on some sort of a scheduled basis by using a JDBC connection from CQ. Once the data is in the repository, you could then write the display component to read the data from the repository, instead of it being directly inside the page.
This approach has the advantage of making that data re-useable within CQ to be shown on multiple pages, multiple sites, even many different display formats if need be. In addition, you can design your jcr structure to support whatever requirement you have around updates to the data, including daily, monthly, weekly, yearly etc., obviously this will depend on the specific requirements.
The one downside to this is that since there is a separation b/w the data and the page(s) where it is displayed, you may need to find a way to ensure the cache is properly cleared whenever the data does change.
Update (based on your comment):
The problem I foresee with versioning the page, and granted I've not tried this so maybe it will work, is that there can only ever be one active version at a time. Therefore, once the next months data is uploaded, you need to maintain the old data (active) and the new data (not yet active) at the same time. What happens if you require a separate content change during that window...from a business process perspective that just seems messy to me.
Back to cache clear issues, If you know the affected pages, especially if they are all in one subtree, you could write a custom workflow process that uses the replicator service to clear the cache for the affected pages, then set up a launcher to run the wf on node change for the data.
The other option, and this one is less defined in my head, so some experimentation required, would be to use CQs built in activate later and de-activate later functionality.
Maybe create a specific template for the rates data, with the implicit requirement that only one page using that template is ever active at one time. Your display components could use a query to find the currently active rates data.
I have not personally tried this, but...
I assume that you can use the PageManager service's createRevision method, and then if that returns without throwing an exception, you may call page.getContentResource.adaptTo(Node.class), and from there take the node that is returned and edit the JCR properties for your tax rates component.
See PageManager
You could write a workflow that includes a publish step that is triggered by the arrival of a calendar date. The version of the page with the new tax rates remains in the workflow pipeline in draft form and is only published/activated when the date arrives. (So you'd need some sort of process that wakes up once a day to check the calendar.)
Each time a page is modified cq creates a version of the page.
This modified page's modification time is set in jcr:lastModified property of the page.
Manipulation of this property can be done to save future date and activate page on that date though its not preferred way.
You can store the future date as a property in the page.
Later as suggested by #David you can create a workflow or a scheduled job which activates pages with a future date.

How do I see the aggregates of my published "news.reads" actions?

I have a Facebook application that wants to publish document reads to a user's OpenGraph.
Since read is a reserved, built-in action, my objects have to have the type article. The publishing of reads to the user's graph works fine and the last read is also shown on the user's timeline.
Additionally, I have set up some aggregators that would show the last 5 reads, the most popular authors etc. The problem is that I can not find those aggregators anywhere in my timeline/profile or in the App section of my user.
Is it not possible to control/show the aggregators for built-in actions and objects?
I have a feeling it should be, since I can set them up and (for example) Spotifiy also uses the built-in music.song objects, as shown below - this is basically, what I also want.
All I am seeing on my app's timeline section, though, is this:
I believe you are not in control of when facebook displays your aggregations as you have defined them in your open graph settings, since facebook uses the so called 'GraphRank' to determine whether to show your aggregation or not. The calculation goes like this:
GraphRank = affinity * weight * interactions * time
affinity (score): this is the relationship between the viewing user and the creator of the action.
weight: if two users interact frequently with each other, the respective actions in the open graph are rated higher than for users who do not have the same interest and are not in close contact on Facebook.
interactions: how often does the user interact with the application and how do friends react to the activities in the social channels (if nobody clicks on the published actions it's bad for the GraphRank).
time: if an app is used irregularly or only once, actions will receive less attention in the long run and will be presented less prominently on the timeline.
See this article: http://www.insidefacebook.com/2011/12/27/edgerank-and-graph-rank-defined/
This is not the perfect answer to the actual question but I was able to solve the problem nevertheless. In case someone else is in the same spot, you might profit from my learnings:
The application I'm building wants to push read actions to a user's OpenGraph. My aggregation problem was that my reads from the built-in news.reads action did not get aggregated. To this day, I do not know why not.
Instead, I managed to create my own read action. It is not connected to the built-in one and exists in my own namespace.
This action can now be connected to my own objects as well and is not bound to the article object – as is the built-in one.
Having my own actions and objects, it was a breeze to follow the instructions for aggregations and create as many aggregations as I like. They also actually show up in my test users' profiles. Yeah.