DotNetNuke Links and Clicks
Let's see an idea of tracking any link on a DotNetNuke web site and then producing a report with the most popular links. For this task we'll use two DotNetNuke modules that come out of the box, the Links and the Reports. To help you decide if it worths your time, I'll show you how to produce reports like the ones I have put on this page.
As you probably already know, the Links module has advanced tracking features which means that when you add a new link, there are options to "Track Number Of Times This Link Is Clicked? " and "Log The User, Date, And Time For Every Link Click?". When we check those checkboxes, we enable the tracking for this specific link. We'll use only the first option for now, as we just want to check the popularity of our links and the number of clicks is just fine for that.
What you probably haven't thought is that using this feature, we can track any inline link on our web site. All we have to do is to place a hidden Links module somewhere, add a link and copy the tracking URL which automatically will be produced by DotNetNuke. Then we can use this URL instead of the real one to put the link in our text. I have to say thanks to Tom Kraak who introduced this simple but valuable idea to me.
I'll add here a link to Cathal's Free DotNetNuke Modules. Mouse over this link and see what appears in your browser's status bar. This exactly is what we're talking about.
The Cathal's URL is:
http://www.cathal.co.uk/Default.aspx?tabid=80
but the URL I use is:
http://www.thinkofdesign.com/LinkClick.aspx?link=http://www.cathal.co.uk/Default.aspx?tabid=80
which gives me the ability to track the clicks on this link.
Let's do it together and see how it works.
- Place a Links module somewhere in your web site and set its visibility to "Page Editors Only" to prevent your guests from viewing this module.
- Add a link to thinkofdesign.com (oops! just kidding), add any link and check the "Track Number Of Times This Link Is Clicked?" checkbox. I consider you know how to add a link. Click Update.
- Right click the link you just created and "Copy Link Location" in FireFox or "Copy Shortcut" in IE.
- From now on you can use this URL every time you want to link to this web site in your text. And you can do that as many times as you want and anywhere in your web site.
- After the first click, a simple report will appear at the bottom area of this link's edit page. Just click the small pencil on the left of the link and you'll find it.
But what if we have lot of links we want to track? And how can we find out which one is the most popular? We have to browse each one's edit page and write down the clicks. No! There is a much better way to do it and here comes the second part of our task. As we initially said, we'll use the Reports module here.
With the Reports module we can pretty easily bring to light any data from our database. All we need is some SQL magic to write the query that will open the door. I am totally newbie with SQL queries but with a little education I was able to accomplish this simple task.
Before we use the Reports module we'll need the ModuleId of the Links module with the links we're tracking. To find that, we just browse the Module Settings and we find it in the URL (it's /ModuleId/345/ in my case).
So, we place a Reports module somewhere in our web site (I created a new Reports page) and then we browse this Module's Settings. At the bottom of this page we find the Report Settings and then the Data Source Settings and the field where we can put our query. Here comes the query I used:
SELECT Url,CreatedDate,Clicks FROM UrlTracking WHERE ModuleID='345' ORDER BY Clicks DESC
This will produce a report with the Url of the links we're tracking, the date we created them and of course the clicks. The most popular link will go first. In the Display Settings we choose the Grid Visualizer. We can also Enable Paging and Sorting or Show a Header above each column with the results. We click Update. Cool eh?
There are cases where the Url of the link we're tracking isn't so descriptive and we need the title of our link. But the titles of our links exist in another table of our database so here the query becomes a little... longer (I spent half an hour to write this):
SELECT Links.Title,UrlTracking.CreatedDate,UrlTracking.Clicks FROM Links,UrlTracking WHERE UrlTracking.Url=Links.Url AND UrlTracking.ModuleID='345' ORDER BY UrlTracking.Clicks DESC
This will produce the same report but instead of the Url, we can see the titles of the links we're tracking.
Check my Reports page.
That was all about it! What do you think?
Comments
Name (required)
Email (required)
Website