Jump to content

File Download tracking/counting


Nick Belane
 Share

Recommended Posts

I am new to processwire and I just want to track the amount of downloads of different pdf-files. I only want to see in the backend how many times user downloaded different pdf-files from my website.

Thats all. :-)

I do NOT need something like this:

https://processwire.com/talk/topic/4602-flexible-downloads-using-pages/

Thanx in advance

Nick

Link to comment
Share on other sites

Thank you.

hm, probably.. :-) But I don't get it. I have a template with different fields.

One field (type: file) is named "downloads". In this field I stored different pdfs.

But where do I have to put the code in your post?

I only want to show the number of downloads in the backend. Not in the frontend/ website.

Link to comment
Share on other sites

To track how many times a file has been downloaded, the basic process is the following:

  1. Have a field to store this information.
  2. Increment this counter each time someone downloads a file.

Sorry for being so generic, but to be more specific, it would be helpful to have more information:

  • Do you need to track the number of downloads separately for each file?
  • Do you need to track the number of downloads separately for each user?
  • How are files downloaded?

It would also help to be more concrete about your use case (what type of site you are building, what type of files your users are downloading on which type of page), so that we can make a concrete example to help you  :)

Link to comment
Share on other sites

Thanks for your answer!

  • Yes, I want to know the number of downloads for a few pdfs (separately for each file)
  • No, I don't need to track separately for each user.

This is the site and the page "downloads":

http://www.schaefer-consult.com/downloads/

There is one template with different fields.

One field (type:file, name:downloads) contains all the pdf-files of the page.

The body-field contains the links and the copy-text.
Something like that:

<p>Muster-Baubeschreibung für Asphaltarbeiten<br>
(Stand: 01/16)<br>
<a class="pdf" href="/site/assets/files/1020/muster-baubeschreibung_asphalt-16-1.pdf" target="_blank">Muster-Baubeschreibung Asphalt 16-1</a></p>
 

The following would be easier and more dynamic, but not so flexible for my customer:

$liste =" ";
$liste .="<ul>";
$pdf_files = $page->downloads;
foreach($pdf_files as $pdf_file) {
    $liste .="<li>{$pdf_file->description}<br><a href='{$pdf_file->url}' class='pdf'>{$pdf_file->name}</a></li>";
}
$liste .="</ul>";
echo $liste;

The best solution for us would be something like that in the backend:

file-a.pdf  (321)

file-b.pdf  (222)

file-c.pdf  (123)

Danke für die Geduld! ;-)

Grüße Nick

Link to comment
Share on other sites

That's why your excluded workflow (flexible downloads) is called flexible.... ;)

First solution ("your no-way please not" one) switch to a one file approach in combination with a PageTable Field to add more than one file....and use the flexible downloads solution. It could be done just with some thinking - setup some fields - setup templates for the single document and the overview - some code - finished

Second solution adapt the core modul itself and change it - this is not the easy part if your a not familiar with creating or changing PW (core) modules.

Some impression how the first/easy solution could end (even easy to use for the client):

post-2327-0-33533700-1461322708_thumb.jp

Regards mr-fan

  • Like 2
Link to comment
Share on other sites

@Nick

There's just no way to track a download count without additional fields. And as soon as you need additional fields related to files you either resort to using PageTables or ImageExtra, with the first one being the more flexible solution.

  • Like 1
Link to comment
Share on other sites

If you are using Google analytics you could easily use it to track your downloads and have nice statistics and setup conversion goals and so on. You would only have to change your template code. No extra fields... easier than it may sound from the docs: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#setting-up-event-tracking

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...