Download Counter

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 20, 2014   (RSS)

Hello, All

My client provides a lot of free educational materials on their site which teachers are invited to download. In order to understand which materials are more popular they have now asked me to implement a download counter. 

There is a section in CMSB called "downloads". Each download record in the section has a title and an upload field to add a single file. There is also a category field so that the record can be assigned to a parent page. The records assigned to the category appear on the page as a list of links. When someone uses the link, the record does not open but simply initiates a download of the file.

As the record does not open I will assume I cannot use the incrementCounterField code.

That being the case, how might I best record the number of times a record is download or simply accessed?

Perch

By Dave - February 20, 2014

Hi Perch, 

You just want to call incrementCounterField($tablename, $fieldname, $recordNumber) before the code the sends the download.

All incrementCounterField() does is get $recordNum from $tablenname and then add 1 to $fieldname (eg: counter).

Hope that helps, let me know any questions.

Dave Edis - Senior Developer
interactivetools.com