How can I track # of downloads with 2SXC? - dotnetnuke

I am using 2SXC to display a list of links to PDFs. But I want to be able to track the number of downloads when the users click on them. How would I do that?

We do this in a few places. Overall, I think the best approach is to use Google Analytics and learn how to track your own custom events. Its really convenient, you do not set up anything at all in Analytics, you just define things on the fly. Its worth reading up on and once you get it, you will find lots of uses.
Here is a real, recent example. We have a site that needed to track clicks on a big button that took the user off to another site for scheduling. Added an id="onlineScheduling" to the tag, then added this to the page's document.ready():
$('#onlineScheduling').on('click', function() {
ga('send', {
hitType: 'event',
eventCategory: 'Main',
eventAction: 'LinkClicked',
eventLabel: 'Online Scheduling'
});
});
Analytics just catches it, logs it, and makes it easy to find/use. Then just go to Reports/Behavior, Events, Overview. Put anything you want in Category, Action, and Label.
Reference
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
https://www.seoworks.com/track-file-downloads-in-google-analytics-using-gtm/

Related

Matomo - how to group different URLs in tracking / how to track moodle course activity?

I have the following challenge:
I have a Moodle system and would like to track visitor activity in the courses via Matomo.
The problem is that one course has several activities, but they are found under a different URL structure.
Example: My course has the URL /course/view=1 and also has a few activities that can be found under three completely different URLs (e.g. /mod/forum/view=20, /mod/feedback/view=7 and so on).
Now I would like to have a common tracking for a course room and the activities in it.
Is this possible? Are there any direct solutions for Moodle? Or how could I do this manually in Matomo?
Thanks
It's possible to set a custom URL in Matomo by using the following code in the page:
_paq.push(['setCustomUrl', 'https://yourdomain.com/your-new-page-url']);
You could perhaps do this for all the pages within a "Course" in order to track all of the actions taken in one logical "Page", but this may affect some of the reports for that page (For example page overlay might be broken)
An alternate way of tracking all of the actions would be to set the Page Title that Matomo tracks using:
_paq.push(['setCustomTitle', 'Your Page Title Here'])
This will allow you to group all of the actions under one logical Page Title under the Page Titles report.

Manipulating Soundcloud Stream with Chrome Extension Content Script

I am writing a Chrome extension using AngularJS to add functionality to the Soundcloud stream page. I want to allow the user to create groups of artists so that they may only see a stream with tracks/shares/playlists from that group of artists.
For example, I follow 500 artists, but I want to quickly see a stream from my favorite 10 artists or from the artists I follow that are on the same label.
I am looking for advice on how I could go about making this as seamless as possible. As of right now, my approach involves getting the tracks with the Soundcloud API and using angular's ng-repeat to display the tracks in a view injected into where the stream normally goes. I realized using the Soundcloud widget was too slow and can't be customized to resemble the native stream items, so I copy/pasted the HTML that an actual stream item uses, but obviously the waveform/comment canvas and button functionality don't work.
What are my options as far as how I can approach this? Am I going to need to write my own players that look like the native Soundcloud ones? Any suggestions would be greatly appreciated.
You should use the SoundCloud API which is very well documented.
If you have already the id's of the tracks / artist, you just have to request the url
GET
http://api.soundcloud.com/tracks/ID_OF_TRACK.json?client_id=YOUR_CLIENT_ID
to get all the informations you need about this track, like the waveform_url, and for the comments you was talking about :
GET
http://api.soundcloud.com/tracks/ID_OF_TRACK/comments.json?client_id=YOUR_CLIENT_ID
To reproduce the behaviour of the comments :
POST http://api.soundcloud.com/tracks/ID_OF_TRACK/comments.json?client_id=YOUR_CLIENT_ID
(with a body param which represents the text and a timestamp in ms since the beginnin of the song, note that you must be connected)
If you don't have the id of the track, you could also use the resolve which give you all the info about a ressource if you have only the URL :
GET
http://api.soundcloud.com/resolve.json?url=https://soundcloud.com/poldoore/pete-rock-c-l-smooth-they&client_id=YOUR_CLIENT_ID

What is the recommended approach to maintain view state using ionicframework / angularjs?

I'm new to Ionic Framework and AngularJs as well.
The app I'm working on has a view where user can search and the results are presented in a list. When the user clicks one of the list items, it navigates to details view. When user presses the "back" button at the header bar, the search text box and results list are empty and he must search again.
What is the recommended approach to, when the user presses the back button from details view, bring the search view populated with the previous search term and results? (would be nice to have the scroll position restored as well)
I know I can just store this information into some service, but this sounds like a lot of work.
Are there any other cool stuff like a view state service or something that can do this for me?
I know I can just store this information into some service, but this
sounds like a lot of work.
really?
app.factory('searchData', function() {
return {
searchTerm: '',
results: []
};
});
that's how it's done. But it sounds like what you're really looking for is a cure for laziness...

While attempting to show user specific data throughout the application, how can I minimize the usage of Firebase resources?

I'm working on an angular application, using Firebase for persistence. I have multiple locations on the page, each show user specific info (i.e. profile pic, current logged in status, etc).
I am struggling to come up with a "good" solution that will allow me to embrace the 3 way data data-binding, and maintain a proper separation of concerns.
For a very specific instance of my problem. I have a HeaderMessagesCtrl, which pulls a list of messages from firebase at /users/x/messages. The messages, which contain a fromUserId, are bound to $scope.messages;
I have an angular view that does ng-repeat on the messages collection, and for each row, I would like to use the fromUserId to determine the user's logged in status, profilePicUri, etc.
http://jsfiddle.net/brkAq/5/
function HeaderMessagesCtrl($scope, $timeout) {
$scope.messages = [
{fromUserId: 1},
{fromUserId: 2}
];
$timeout(function(){
$scope.messages.push({fromUserId: 3});
}, 1500);
}
The above fiddle shows a sample collection that then gets modified at a later time. Hopefully this can assist to provide an example solution.
Thanks in advance.
Edit
I was asked to suggest a pattern, so below is the first thing to come to mind.
I was thinking of creating a watch on the scope variable, that contained the array that firebase will be updating. This watch would reach out to the UserService to obtain the profilePicUri, and thus create a scope array that was more like a view model instead of an exact replica of the data in firebase.
The other option was to create a user-profile-box widget, which you could provide the user id, and it would figure out the uri from the UserService, and use those details to make the widget html, etc.
Either way, my struggle is the "relationship-less" nature of firebase.

Show Opportunity related Contacts in Custom Object Field

I have the next issue.
I have a custom object called 'Application', and I have this requirement:
"Show all Contacts related to an Application. Create a field on Application object, must be read only".
I solve it with apex code. 'Application' has a lookup to Opportunity, Opportunity to Account, and all my contacts have AccountId, so this way, I get all the contacts using apex code in a trigger.
But, I've been ask to change this to a Formula field in Application object.
So, my issue is next. I'm not able to get all contacts with advance formula editor, because they're not part of any object. I have no master-detail relationship.
Does any one know how can I achieve this using configuration? I should not use apex code for this req.
Thank in advance guys.
I don't think you can do it.
In formulas / merge fields syntax there's no way to go "up, up then down" (Application -> Opportunity -> Account -> down to Contacts related list). There's also nothing that would let you loop through Contacts (and display what? Ids? Names? Emails?). Roughly speaking you can only go up through dots.
You might want to explore path of "cross object workflow" rules but I imagine that when I add a new Contact to Account it should somehow "spread itself" to all related Applications? There's no straight way to fire a workflow on delete too - so you'd eventually end up with inaccurate list.
I'd say trigger was a good solution. Maybe it ws unoptimized but if it has to be in a field - tough.
There might be a fairly simple way of achieving that by embedding a visualforce page within Application page layout.
This should be doable with pure Visualforce (so technically there will be no Apex code ;))
Something as simple as
<apex:relatedList list="Contacts" subject="Application__c.Opportunity__r.AccountId" />
would be a good start (if you want your own layout and not a rel. list - you should be still able to pull it off with <apex:repeat> or <apex:pageBlockTable>.
There's one BUT here: it's not a field, just a display trick. Forget about using it in reports, mobile applications etc.
Another way - would it be acceptable to be 1 click away from these contacts? You could make a report "Account with Contacts", filter it by Id of one Account and later use "URL hacking" to change the filter depending on from which Application you'll click it. This link could be either a formula field or a real custom button/link. Technically - it's pure config, no apex & VF.
You can read more about URL hacking at Ray Dehler's excellent post and specifically about dynamic Reports here or here.

Resources